Browscap\Parser\IniParser::getLinesFromFile PHP Method

getLinesFromFile() public method

public getLinesFromFile ( ) : array
return array
    public function getLinesFromFile()
    {
        $filename = $this->filename;
        if (!file_exists($filename)) {
            throw new \InvalidArgumentException("File not found: {$filename}");
        }
        return file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
    }

Usage Example

Example #1
0
 /**
  * tests throwing an exception if the input file does not exist
  *
  * @group parser
  * @group sourcetest
  */
 public function testGetLinesFromFileThrowsExceptionIfFileDoesNotExist()
 {
     $file = '/hopefully/this/file/does/not/exist';
     $parser = new IniParser($file);
     $this->setExpectedException('\\InvalidArgumentException', 'File not found: ' . $file);
     $parser->getLinesFromFile();
 }