Ejemplo n.º 1
0
 public function testToArray()
 {
     $engine = new Engine();
     $this->assertEquals([], $engine->toArray());
     $engine->set(['name' => null]);
     $this->assertEquals([], $engine->toArray());
     $engine->reset(['name' => 'WebKit', 'version' => new Version(['value' => '601.3.9'])]);
     $this->assertEquals(['name' => 'WebKit', 'version' => '601.3.9'], $engine->toArray());
 }
Ejemplo n.º 2
0
 /**
  * Get an array of all defined properties
  *
  * @return array
  */
 public function toArray()
 {
     $result = ['browser' => $this->browser->toArray(), 'engine' => $this->engine->toArray(), 'os' => $this->os->toArray(), 'device' => $this->device->toArray()];
     if (!count($result['browser'])) {
         unset($result['browser']);
     }
     if (!count($result['engine'])) {
         unset($result['engine']);
     }
     if (!count($result['os'])) {
         unset($result['os']);
     }
     if (!count($result['device'])) {
         unset($result['device']);
     }
     if ($this->camouflage) {
         $result['camouflage'] = true;
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  *
  * @param Model\RenderingEngine      $engine
  * @param \WhichBrowser\Model\Engine $engineRaw
  */
 private function hydrateRenderingEngine(Model\RenderingEngine $engine, \WhichBrowser\Model\Engine $engineRaw)
 {
     $engine->setName($this->getRealResult($engineRaw->getName()));
     $engine->getVersion()->setComplete($this->getRealResult($engineRaw->getVersion()));
 }