public function validFile($source, $file)
    {
        if (! file_exists($source)) {
            throw new PortableElementParserException('Unable to locate extracted zip file.');
        }

        $filePath = rtrim($source, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . preg_replace('/^\.\//', '', $file);

        if (file_exists($filePath) || file_exists($filePath . '.js')) {
            return true;
        }

        if (array_key_exists($file, ClientLibRegistry::getRegistry()->getLibAliasMap())) {
            return true;
        }

        throw new PortableElementInvalidAssetException(
            'Asset "' . $file . '" is not found in the source "'.$source.'"" neither through alias'
        );
    }