UserAgentParser\Model\UserAgent::toArray PHP Method

toArray() public method

public toArray ( $includeResultRaw = false ) : array
return array
    public function toArray($includeResultRaw = false)
    {
        $data = ['browser' => $this->getBrowser()->toArray(), 'renderingEngine' => $this->getRenderingEngine()->toArray(), 'operatingSystem' => $this->getOperatingSystem()->toArray(), 'device' => $this->getDevice()->toArray(), 'bot' => $this->getBot()->toArray()];
        // should be only used for debug
        if ($includeResultRaw === true) {
            $data['providerResultRaw'] = $this->getProviderResultRaw();
        }
        return $data;
    }

Usage Example

 protected function assertProviderResult($result, array $expectedResult)
 {
     $this->assertInstanceOf('UserAgentParser\\Model\\UserAgent', $result);
     $model = new UserAgent();
     $expectedResult = array_merge($model->toArray(), $expectedResult);
     $this->assertEquals($result->toArray(), $expectedResult);
 }
All Usage Examples Of UserAgentParser\Model\UserAgent::toArray