BrowscapPHP\Util\Logfile\ReaderCollection::read PHP Method

read() public method

public read ( string $line ) : string
$line string
return string
    public function read($line)
    {
        foreach ($this->readers as $reader) {
            if ($reader->test($line)) {
                return $reader->read($line);
            }
        }
        throw ReaderException::userAgentParserError($line);
    }

Usage Example

コード例 #1
0
 /**
  * @expectedException \BrowscapPHP\Exception\ReaderException
  * @expectedExceptionMessage Cannot extract user agent string from line "Test"
  */
 public function testReadNotSuccessFull()
 {
     $reader = $this->getMock('\\BrowscapPHP\\Util\\Logfile\\ApacheCommonLogFormatReader', array('test', 'read'), array(), '', false);
     $reader->expects(self::once())->method('test')->will(self::returnValue(false));
     $reader->expects(self::never())->method('read')->will(self::returnValue('TestUA'));
     $this->object->addReader($reader);
     $this->object->read('Test');
 }
All Usage Examples Of BrowscapPHP\Util\Logfile\ReaderCollection::read