Get a string containing a JavaScript representation of the object

@return string
166627
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";
    }
736676
public function toString(): string
    {
        return 'has the key ' . $this->exporter->export($this->key) .
                ' with the value ' . $this->exporter->export($this->value);
    }
543020
function toString()
    {
        $modes = array();
        $levels = array(E_USER_NOTICE  => 'notice',
                        E_USER_WARNING => 'warning',
                        E_USER_ERROR   => 'error');
        if ($this->mode & PEAR_ERROR_CALLBACK) {
            if (is_array($this->callback)) {
                $callback = (is_object($this->callback[0]) ?
                    strtolower(get_class($this->callback[0])) :
                    $this->callback[0]) . '::' .
                    $this->callback[1];
            } else {
                $callback = $this->callback;
            }
            return sprintf('[%s: message="%s" code=%d mode=callback '.
                           'callback=%s prefix="%s" info="%s"]',
                           strtolower(get_class($this)), $this->message, $this->code,
                           $callback, $this->error_message_prefix,
                           $this->userinfo);
        }
        if ($this->mode & PEAR_ERROR_PRINT) {
            $modes[] = 'print';
        }
        if ($this->mode & PEAR_ERROR_TRIGGER) {
            $modes[] = 'trigger';
        }
        if ($this->mode & PEAR_ERROR_DIE) {
            $modes[] = 'die';
        }
        if ($this->mode & PEAR_ERROR_RETURN) {
            $modes[] = 'return';
        }
        return sprintf('[%s: message="%s" code=%d mode=%s level=%s '.
                       'prefix="%s" info="%s"]',
                       strtolower(get_class($this)), $this->message, $this->code,
                       implode("|", $modes), $levels[$this->level],
                       $this->error_message_prefix,
                       $this->userinfo);
    }
1065114
public function ToString()
	{
		if ( is_null( $this->domNode ) ) return "";
		if ( $this->domNode instanceof \DOMDocument )
		{
			$result = $this->domNode->saveXML( null );
			// Remove any initial PI
			$result = preg_replace( "/^<\?xml.*\?>\s/", "", $result );
			return $result;
		}
		else
		{
			// InnerXml?
			// return array_reduce(
			// 	iterator_to_array( $this->domNode->childNodes ),
			// 	function ( $carry, /** @var \DOMNode */ $child )
			// 	{
			// 		return $carry.$child->ownerDocument->saveXML( $child );
			// 	}
			// );
			$result = $this->domNode->ownerDocument->SaveXML( $this->domNode );
			return $result;
		}
	}
39136
public function toString()
    {
        $data = $this->toArray();

        // Root should be JSON object, not array
        if (count($data) === 0) {
            $data = new ArrayObject();
        }

        // Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
        $data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_SLASHES);

        if (JSON_ERROR_NONE !== json_last_error())
        {
            throw new InvalidArgumentException(
                'Cannot encode data to JSON string: ' . json_last_error_msg()
            );
        }

        return $data;
    }
52515
public function toJavaScript()
    {
        $lines = [];

        foreach (get_object_vars($this) as $key => $value) {
            if (!is_null($value)) {
                $line = $key . ": ";

                if ($key == 'version') {
                    $line .= 'new Version({ ' . $value->toJavaScript() . ' })';
                } elseif ($key == 'family') {
                    $line .= 'new Family({ ' . $value->toJavaScript() . ' })';
                } elseif ($key == 'using') {
                    $line .= 'new Using({ ' . $value->toJavaScript() . ' })';
                } else {
                    switch (gettype($value)) {
                        case 'boolean':
                            $line .= $value ? 'true' : 'false';
                            break;
                        case 'string':
                            $line .= '"' . addslashes($value) . '"';
                            break;
                        case 'integer':
                            $line .= $value;
                            break;
                    }
                }

                $lines[] = $line;
            }
        }

        return implode($lines, ", ");
    }
1302168
public function toString()
    {
        if (empty($this->stringRepresentation)) {
            $this->stringRepresentation = sprintf('%s%s_%s', static::MESSAGE_TO_STRING_PREFIX, $this->getSourceId(), $this->getResourceId());
        }
        return $this->stringRepresentation;
    }
194905
public function toString(): string
    {
        $parts = array_map(
            function (AttributeTypeAndValue $tv) {
                return $tv->toString();
            }, $this->_attribs);
        return implode("+", $parts);
    }
19054
public function toString()
    {
        $string = '';
        if (!empty($this->tag)) {
            $string .=  '<' . $this->tag;
            $string .= $this->attributesToString();
            if ($this->autoclosed) {
                $string .= '/>';
            } else {
                $string .= '>' . $this->contentToString() . '</' . $this->tag . '>';
            }
        } else {
            $string .= $this->text;
            $string .= $this->contentToString();
        }
        return $string;
    }
430518
public function toString(){
		
		$s = "\n<!--OWEB displays all CSS includes-->\n";
		//DIsplaying all Css Headers
		foreach ($this->css_headers as $id => $h){
			$s .= $h->getCode($id);
		}
		
		$s .=  "\n<!--OWEB displays all JS includes and codes-->\n";
		
		//Displaying Javascript Headers
		foreach ($this->js_headers as $id => $h){
			$s .= $h->getCode($id);
		}
		
		$s .=  "\n<!--OWEB displays personalized header codes-->\n";
		//Displaying all other headers
		foreach ($this->other_headers as $id => $h){
			$s .= $h->getCode($id);
		}
		
		return $s;
	}
888555
public function toString()
	{
		$attributes = $this->buildAttributes();

		$select = array();
		$select[] = '<select '.$attributes.'>';

		$firstValue = $this->firstValue;
		
		$value = isset($this->override) ? $this->override : (isset($this->attributes['value']) ? $this->attributes['value'] : '');

		if($firstValue)
		{
			$selected = $value == $firstValue['value'] ? 'selected' : '';
			$select[] = '<option '.$selected.' value="'.$firstValue['value'].'">'.$firstValue['label'].'</option>';
		}

		foreach($this->options as $val => $label)
		{
			if(is_array($label))
			{
				$select[] = '<optgroup label="'.$val.'">';
				foreach($label as $v => $l)
				{
					$selected = $v === $value ? 'selected' : '';
					$select[] = '<option '.$selected.' value="'.$v.'">'.$l.'</option>';
				}
				$select[] = '</optgroup>';
			}
			else
			{
				$selected = $val === $value ? 'selected' : '';
				$select[] = '<option '.$selected.' value="'.$val.'">'.$label.'</option>';
			}
		}

		$select[] = '</select>';

		return implode('', $select);
	}
505810
public function toString()
	{
		// Reflect on class to get private or protected props
		$privateProperties = with(new \ReflectionClass($this))->getProperties(\ReflectionProperty::IS_PROTECTED);

		// Remove each private or protected prop
		foreach ($privateProperties as $prop)
		{
			$name = (string) $prop->name;
			unset($this->$name);
		}

		// Output as json
		return json_encode($this);
	}
1162907
protected function getInlineJavaScript()
    {
        $javascript = parent::getInlineJavaScript();

        $colors = "'" . implode("', '", $this->colors) . "'";

        if ($this->none_option) {
            $none_option =
                $this->none_option_title === null
                    ? 'null'
                    : SwatString::quoteJavaScriptString(
                        $this->none_option_title
                    );
        } else {
            $none_option = 'null';
        }

        $js_class_name = $this->getJavaScriptClassName();

        $javascript .=
            "\nvar {$this->id}_obj = new {$js_class_name}(" .
            "'{$this->id}', [{$colors}], {$none_option});\n";

        return $javascript;
    }
1072404
protected function getInlineJavaScript()
    {
        $quoted_string = SwatString::quoteJavaScriptString($this->id);
        return sprintf(
            'var %s_obj = new SwatRating(%s, %s);',
            $this->id,
            $quoted_string,
            intval($this->maximum_value)
        );
    }
907619
public function toString()
    {
        if (!$this->_renderer || !$this->_renderer->canRender($this)) {
            return '';
        }

        return $this->_renderer->render($this);
    }
537028
public function getScript()
    {
        $sJsCode = '';
        switch($this->sType)
        {
        case Jaxon::FORM_VALUES:
            $sJsCode = $this->getJsCall('getFormValues', $this->xValue);
            break;
        case Jaxon::INPUT_VALUE:
            $sJsCode = $this->getJsCall('$', $this->xValue) . '.value';
            break;
        case Jaxon::CHECKED_VALUE:
            $sJsCode = $this->getJsCall('$', $this->xValue) . '.checked';
            break;
        case Jaxon::ELEMENT_INNERHTML:
            $sJsCode = $this->getJsCall('$', $this->xValue) . '.innerHTML';
            break;
        case Jaxon::QUOTED_VALUE:
            $sJsCode = $this->getQuotedValue(addslashes($this->xValue));
            break;
        case Jaxon::BOOL_VALUE:
            $sJsCode = ($this->xValue) ? 'true' : 'false';
            break;
        case Jaxon::PAGE_NUMBER:
            $sJsCode = (string)$this->xValue;
            break;
        case Jaxon::NUMERIC_VALUE:
            $sJsCode = (string)$this->xValue;
            break;
        case Jaxon::JS_VALUE:
            if(is_array($this->xValue) || is_object($this->xValue))
            {
                // Unable to use double quotes here because they cannot be handled on client side.
                // So we are using simple quotes even if the Json standard recommends double quotes.
                $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT));
            }
            else
            {
                $sJsCode = (string)$this->xValue;
            }
            break;
        }
        return $sJsCode;
    }
147520
public function toString()
    {
        $request = sprintf('%s %s HTTP/%s', $this->getMethod(), (string) $this->getUrl(), $this->getVersion());

        $str = trim($request) . "\r\n";
        $str .= $this->getHeaders();
        $str .= "\r\n";
        $str .= $this->getContent();
        return $str;
    }