public function getParser()
{
if ($this->parser !== null) {
return $this->parser;
}
$this->parser = new UserAgent();
return $this->parser;
}
public function testParser() { $provider = new Zsxsoft(); $this->assertInstanceOf('UserAgent', $provider->getParser()); $parser = $this->getParser(); $provider = new Zsxsoft($parser); $this->assertSame($parser, $provider->getParser()); }