public function parseUrl($referer)
    {
        if (is_null($referer)) return null;

        $parsed = parse_url($referer);
        $parts  = explode('.', $parsed['host']);
        $domain = array_pop($parts);

        if (count($parts) > 0)
            $domain = array_pop($parts).'.'.$domain;

        return [
            'url'    => $referer,
            'domain' => $domain,
            'host'   => $parsed['host'],
        ];
    }
public function parseUrl($referer)
    {
        if (is_null($referer)) return null;

        $parsed = parse_url($referer);
        $parts  = explode('.', $parsed['host']);
        $domain = array_pop($parts);

        if (count($parts) > 0)
            $domain = array_pop($parts).'.'.$domain;

        return [
            'url'    => $referer,
            'domain' => $domain,
            'host'   => $parsed['host'],
        ];
    }
public function parseUrl ( $ referer ) { if ( is_null ( $ referer ) ) return null ; $ parsed = parse_url ( $ referer ) ; $ parts = explode ( '.' , $ parsed [ 'host' ] ) ; $ domain = array_pop ( $ parts ) ; if ( count ( $ parts ) > 0 ) $ domain = array_pop ( $ parts ) . '.' . $ domain ; return [ 'url' => $ referer , 'domain' => $ domain , 'host' => $ parsed [ 'host' ] , ] ; }
Parse the referer url.

@param  string  $referer

@return array
Parse the referer url .