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'
        );
    }
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'
        );
    }
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' ) ; }
Valid a file if exists or alias

@param string $source Temporary directory source
@param string $file Path to the file
@return bool
@throws PortableElementInvalidAssetException
@throws PortableElementParserException
Valid a file if exists or alias