BrowscapPHP\Command\LogfileCommand::handleLine PHP Method

handleLine() private method

private handleLine ( Symfony\Component\Console\Output\OutputInterface $output, ReaderCollection $collection, Browscap $browscap, integer $line )
$output Symfony\Component\Console\Output\OutputInterface
$collection BrowscapPHP\Util\Logfile\ReaderCollection
$browscap BrowscapPHP\Browscap
$line integer
    private function handleLine(OutputInterface $output, ReaderCollection $collection, Browscap $browscap, $line)
    {
        $userAgentString = '';
        try {
            $userAgentString = $collection->read($line);
            try {
                $this->getResult($browscap->getBrowser($userAgentString));
            } catch (\Exception $e) {
                $this->undefinedClients[] = $userAgentString;
                throw $e;
            }
            $type = '.';
            ++$this->countOk;
        } catch (ReaderException $e) {
            $type = 'E';
            ++$this->countNok;
        } catch (UnknownBrowserTypeException $e) {
            $type = 'T';
            ++$this->countNok;
        } catch (UnknownBrowserException $e) {
            $type = 'B';
            ++$this->countNok;
        } catch (UnknownPlatformException $e) {
            $type = 'P';
            ++$this->countNok;
        } catch (UnknownDeviceException $e) {
            $type = 'D';
            ++$this->countNok;
        } catch (UnknownEngineException $e) {
            $type = 'N';
            ++$this->countNok;
        } catch (\Exception $e) {
            $type = 'U';
            ++$this->countNok;
        }
        $this->outputProgress($output, $type);
        // count all useragents
        if (isset($this->uas[$userAgentString])) {
            ++$this->uas[$userAgentString];
        } else {
            $this->uas[$userAgentString] = 1;
        }
        if ('.' !== $type && 'E' !== $type) {
            // count all undetected useragents grouped by detection error
            if (!isset($this->uasWithType[$type])) {
                $this->uasWithType[$type] = [];
            }
            if (isset($this->uasWithType[$type][$userAgentString])) {
                ++$this->uasWithType[$type][$userAgentString];
            } else {
                $this->uasWithType[$type][$userAgentString] = 1;
            }
        }
    }