/** * Get a string containing a JavaScript representation of the object * * @return string */ public function toJavaScript() { return "this.browser = new Browser({ " . $this->browser->toJavaScript() . " });\n" . "this.engine = new Engine({ " . $this->engine->toJavaScript() . " });\n" . "this.os = new Os({ " . $this->os->toJavaScript() . " });\n" . "this.device = new Device({ " . $this->device->toJavaScript() . " });\n" . "this.camouflage = " . ($this->camouflage ? 'true' : 'false') . ";\n" . "this.features = " . json_encode($this->features) . ";\n"; }