src/Utility/LinkScanner.php
protected function _getResponse($url)
    {
        $this->alreadyScanned[] = $url;
        $cacheKey = sprintf('response_%s', md5(serialize($url)));

        $response = $this->getConfig('cache') ? Cache::read($cacheKey, 'LinkScanner') : null;

        if ($response && is_array($response)) {
            list($response, $body) = $response;

            $stream = new Stream('php://memory', 'wb+');
            $stream->write($body);
            $stream->rewind();
            $response = $response->withBody($stream);
        }

        if (!$response instanceof Response) {
            try {
                $response = $this->Client->get($url);

                if ($this->getConfig('cache') && ($response->isOk() || $response->isRedirect())) {
                    Cache::write($cacheKey, [$response, (string)$response->getBody()], 'LinkScanner');
                }
            } catch (Exception $e) {
                $response = (new Response)->withStatus(404);
            }
        }

        return $response;
    }
protected function _getResponse($url)
    {
        $this->alreadyScanned[] = $url;
        $cacheKey = sprintf('response_%s', md5(serialize($url)));

        $response = $this->getConfig('cache') ? Cache::read($cacheKey, 'LinkScanner') : null;

        if ($response && is_array($response)) {
            list($response, $body) = $response;

            $stream = new Stream('php://memory', 'wb+');
            $stream->write($body);
            $stream->rewind();
            $response = $response->withBody($stream);
        }

        if (!$response instanceof Response) {
            try {
                $response = $this->Client->get($url);

                if ($this->getConfig('cache') && ($response->isOk() || $response->isRedirect())) {
                    Cache::write($cacheKey, [$response, (string)$response->getBody()], 'LinkScanner');
                }
            } catch (Exception $e) {
                $response = (new Response)->withStatus(404);
            }
        }

        return $response;
    }
protected function _getResponse ( $ url ) { $ this -> alreadyScanned [ ] = $ url ; $ cacheKey = sprintf ( 'response_%s' , md5 ( serialize ( $ url ) ) ) ; $ response = $ this -> getConfig ( 'cache' ) ? Cache :: read ( $ cacheKey , 'LinkScanner' ) : null ; if ( $ response && is_array ( $ response ) ) { list ( $ response , $ body ) = $ response ; $ stream = new Stream ( 'php://memory' , 'wb+' ) ; $ stream -> write ( $ body ) ; $ stream -> rewind ( ) ; $ response = $ response -> withBody ( $ stream ) ; } if ( ! $ response instanceof Response ) { try { $ response = $ this -> Client -> get ( $ url ) ; if ( $ this -> getConfig ( 'cache' ) && ( $ response -> isOk ( ) || $ response -> isRedirect ( ) ) ) { Cache :: write ( $ cacheKey , [ $ response , ( string ) $ response -> getBody ( ) ] , 'LinkScanner' ) ; } } catch ( Exception $ e ) { $ response = ( new Response ) -> withStatus ( 404 ) ; } } return $ response ; }
Performs a single GET request and returns a `ScanResponse` instance.

The response will be cached, if that's ok and the cache is enabled.
@param string $url The url or path you want to request
@return Response
@uses $Client
@uses $alreadyScanned
@uses $fullBaseUrl
Performs a single GET request and returns a ScanResponse instance .