src/Utility/LinkScanner.php
protected function _singleScan($url, $referer = null)
    {
        $url = clean_url($url, true, true);
        if (!$this->canBeScanned($url)) {
            return null;
        }

        $this->dispatchEvent('LinkScanner.beforeScanUrl', [$url]);
        $response = $this->_getResponse($url);
        $this->dispatchEvent('LinkScanner.afterScanUrl', [$response]);

        //Follows redirects
        if ($response->isRedirect() && $this->getConfig('followRedirects')) {
            $location = $response->getHeaderLine('location');
            if (!$this->canBeScanned($location)) {
                return null;
            }

            $this->dispatchEvent('LinkScanner.foundRedirect', [$location]);

            return call_user_func([$this, __METHOD__], $location);
        }

        $this->ResultScan = $this->ResultScan->appendItem(new ScanEntity([
            'code' => $response->getStatusCode(),
            'external' => is_external_url($url, $this->hostname),
            'location' => $response->getHeaderLine('Location'),
            'type' => $response->getHeaderLine('content-type'),
        ] + compact('url', 'referer')));

        return $response;
    }
protected function _singleScan($url, $referer = null)
    {
        $url = clean_url($url, true, true);
        if (!$this->canBeScanned($url)) {
            return null;
        }

        $this->dispatchEvent('LinkScanner.beforeScanUrl', [$url]);
        $response = $this->_getResponse($url);
        $this->dispatchEvent('LinkScanner.afterScanUrl', [$response]);

        //Follows redirects
        if ($response->isRedirect() && $this->getConfig('followRedirects')) {
            $location = $response->getHeaderLine('location');
            if (!$this->canBeScanned($location)) {
                return null;
            }

            $this->dispatchEvent('LinkScanner.foundRedirect', [$location]);

            return call_user_func([$this, __METHOD__], $location);
        }

        $this->ResultScan = $this->ResultScan->appendItem(new ScanEntity([
            'code' => $response->getStatusCode(),
            'external' => is_external_url($url, $this->hostname),
            'location' => $response->getHeaderLine('Location'),
            'type' => $response->getHeaderLine('content-type'),
        ] + compact('url', 'referer')));

        return $response;
    }
protected function _singleScan ( $ url , $ referer = null ) { $ url = clean_url ( $ url , true , true ) ; if ( ! $ this -> canBeScanned ( $ url ) ) { return null ; } $ this -> dispatchEvent ( 'LinkScanner.beforeScanUrl' , [ $ url ] ) ; $ response = $ this -> _getResponse ( $ url ) ; $ this -> dispatchEvent ( 'LinkScanner.afterScanUrl' , [ $ response ] ) ; //Follows redirects if ( $ response -> isRedirect ( ) && $ this -> getConfig ( 'followRedirects' ) ) { $ location = $ response -> getHeaderLine ( 'location' ) ; if ( ! $ this -> canBeScanned ( $ location ) ) { return null ; } $ this -> dispatchEvent ( 'LinkScanner.foundRedirect' , [ $ location ] ) ; return call_user_func ( [ $ this , __METHOD__ ] , $ location ) ; } $ this -> ResultScan = $ this -> ResultScan -> appendItem ( new ScanEntity ( [ 'code' => $ response -> getStatusCode ( ) , 'external' => is_external_url ( $ url , $ this -> hostname ) , 'location' => $ response -> getHeaderLine ( 'Location' ) , 'type' => $ response -> getHeaderLine ( 'content-type' ) , ] + compact ( 'url' , 'referer' ) ) ) ; return $ response ; }
Internal method to perform a single scan.

### Events
This method will trigger some events:
- `LinkScanner.beforeScanUrl`: will be triggered before a single url is
scanned;
- `LinkScanner.afterScanUrl`: will be triggered after a single url is
scanned;
- `LinkScanner.foundRedirect`: will be triggered if a redirect is found.
@param string|array $url Url to scan
@param string|null $referer Referer of this url
@return ScanResponse|null
@uses _getResponse()
@uses canBeScanned()
@uses $ResultScan
@uses $hostname
Internal method to perform a single scan .