private static function process(Url $url, array $config, DispatcherInterface $dispatcher)
    {
        $response = $dispatcher->dispatch($url);

        //If is a file use File Adapter
        $adapter = self::getClass('File', $config);

        if ($adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        //Search the adapter using the domain
        $adapter = self::getClass($response->getUrl()->getClassNameForDomain(), $config);

        if (class_exists($adapter) && $adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        //Use the default webpage adapter
        $adapter = self::getClass('Webpage', $config);

        if ($adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        if ($response->getError() === null) {
            $exception = new Exceptions\InvalidUrlException(sprintf("Invalid url '%s' (Status code %s)", (string) $url, $response->getStatusCode()));
        } else {
            $exception = new Exceptions\InvalidUrlException($response->getError());
        }

        $exception->setResponse($response);

        throw $exception;
    }
private static function process(Url $url, array $config, DispatcherInterface $dispatcher)
    {
        $response = $dispatcher->dispatch($url);

        //If is a file use File Adapter
        $adapter = self::getClass('File', $config);

        if ($adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        //Search the adapter using the domain
        $adapter = self::getClass($response->getUrl()->getClassNameForDomain(), $config);

        if (class_exists($adapter) && $adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        //Use the default webpage adapter
        $adapter = self::getClass('Webpage', $config);

        if ($adapter::check($response)) {
            return new $adapter($response, $config, $dispatcher);
        }

        if ($response->getError() === null) {
            $exception = new Exceptions\InvalidUrlException(sprintf("Invalid url '%s' (Status code %s)", (string) $url, $response->getStatusCode()));
        } else {
            $exception = new Exceptions\InvalidUrlException($response->getError());
        }

        $exception->setResponse($response);

        throw $exception;
    }
private static function process ( Url $ url , array $ config , DispatcherInterface $ dispatcher ) { $ response = $ dispatcher -> dispatch ( $ url ) ; //If is a file use File Adapter $ adapter = self :: getClass ( 'File' , $ config ) ; if ( $ adapter :: check ( $ response ) ) { return new $ adapter ( $ response , $ config , $ dispatcher ) ; } //Search the adapter using the domain $ adapter = self :: getClass ( $ response -> getUrl ( ) -> getClassNameForDomain ( ) , $ config ) ; if ( class_exists ( $ adapter ) && $ adapter :: check ( $ response ) ) { return new $ adapter ( $ response , $ config , $ dispatcher ) ; } //Use the default webpage adapter $ adapter = self :: getClass ( 'Webpage' , $ config ) ; if ( $ adapter :: check ( $ response ) ) { return new $ adapter ( $ response , $ config , $ dispatcher ) ; } if ( $ response -> getError ( ) === null ) { $ exception = new Exceptions \ InvalidUrlException ( sprintf ( "Invalid url '%s' (Status code %s)" , ( string ) $ url , $ response -> getStatusCode ( ) ) ) ; } else { $ exception = new Exceptions \ InvalidUrlException ( $ response -> getError ( ) ) ; } $ exception -> setResponse ( $ response ) ; throw $ exception ; }
Process the url.

@param Url $url
@param array   $config
@param DispatcherInterface   $dispatcher

@throws Exceptions\InvalidUrlException If the urls is not valid

@return Adapter
Process the url .