Converts the variable into a serializable Data instance.

This array can be displayed in the template using
the VarDumper component.

@param mixed $var

@return Data
343138
protected function cloneVar($var)
    {
        if ($var instanceof Data) {
            return $var;
        }
        if (null === $this->cloner) {
            if (!class_exists(CutStub::class)) {
                throw new \LogicException(sprintf('The VarDumper component is needed for the %s() method. Install symfony/var-dumper version 3.4 or above.', __METHOD__));
            }
            $this->cloner = new VarCloner();
            $this->cloner->setMaxItems(-1);
            $this->cloner->addCasters($this->getCasters());
        }

        return $this->cloner->cloneVar($var);
    }
584333
public static function varToText($var) {
				
		$type = gettype($var);
		$text = is_null($type) ? 'NULL' : $type . ':';
		
		switch ($type) {

			case 'boolean':
				$text .= $var ? 'TRUE' : 'FALSE';
				break;

			default:
				$text .= $var;
				break;
				
			case 'array':
				$parts = array();
				foreach ($var as $k=>$v) {
					$parts[] = $k . '=>' . self::varToText($v);
				}
				$text .= 'array:[' . implode(',', $parts) . ']';
				break;
				
			case 'object':
				$text .= get_class($var);
				break;
				
			case 'NULL':
				break;

		}
					
		return $text;
		
	}
38433
public static function returnStdObject(&$var)
    {
        // check if $var is already a standard object
        if (self::isInstanceOf($var, AbstractStdObject::class)) {
            return $var;
        }

        // try to map $var to a standard object
        if (self::isString($var)) {
            return new StringObject($var);
        } else {
            if (self::isArray($var)) {
                return new ArrayObject($var);
            }
        }

        // return value as StdObjectWrapper
        return new self($var);
    }
427547
protected function getDumpedHtml($var)
    {
        ob_start();

        dump($var);

        $content = ob_get_contents();

        ob_get_clean();

        return substr($content, strpos($content, '<pre '));
    }
274596
public static function toPhp($var)
    {
        switch (gettype($var)) {
            case 'array':
                $skipKeys = (range(0, count($var) - 1) === array_keys($var));
                $ret = 'array(';
                $i = 0;
                foreach ($var as $key => $value) {
                    if ($i++ > 0) {
                        $ret .= ', ';
                    }
                    if (!$skipKeys) {
                        $ret .= self::toPhp($key) . ' => ';
                    }
                    $ret .= self::toPhp($value);
                }
                $ret .= ')';
                break;
            default:
                $ret = var_export($var, true);
        }
        return $ret;
    }
206104
public static function returnDump( $var, $html = true ) {
		$dump = null;
		ob_start();
		var_dump( $var );
		$dump = ob_get_contents();
		ob_end_clean();
		if ( $html ) {
			return '<pre>' . htmlspecialchars( $dump ) . '</pre>';
		}
		return $dump;
	}
1202259
protected function serialize($vars)
    {
        $data = '';
        if (is_array($vars)) {
            foreach ($vars as $var=>$value)
                $data .= $var.'|'.serialize($value);
        }
        else {
            $data = 'b:0;';
        }

        return $data;
    }
12309
public static function getVariableValues(Variable $variable) {

        $returnValue = array();

        $baseType = $variable->getBaseType();
        $cardinalityType = $variable->getCardinality();
        $value = $variable->getValue();
        
        // This only works if the variable has a value ;)
        if ($value !== null) {
            
            if ($baseType === BaseType::IDENTIFIER) {
            
                if ($cardinalityType === Cardinality::SINGLE) {
            
                    $returnValue[] = $value->getValue();
                }
                else if($cardinalityType === Cardinality::MULTIPLE) {
            
                    foreach($variable->getValue() as $value) {
            
                        $returnValue[] = $value->getValue();
                    }
                }
            }
        }

        return $returnValue;
    }
217533
public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
148696
function varIsArray($var)
		{
			$var_ser = serialize($var);
			array_push($this->arrHistory, $var_ser);

			$this->makeTableHeader("array","array");
			if(Arrays::isArray($var)) {
				foreach($var as $key => $value) {
					$this->makeTDHeader("array", $key);

					//check for recursion
					if(Arrays::isArray($value)) {
						$var_ser = serialize($value);
						if(Arrays::inArray($var_ser, $this->arrHistory, TRUE))
							$value = "*RECURSION*";
					}

					if(Arrays::inArray(gettype($value), $this->arrType)) {
						$this->checkType($value);
					} else {
						$value = (trim($value)=="") ? "[empty string]" : $value;
						echo $value;
					}
					echo $this->closeTDRow();
				}
			} else {
				echo "<tr><td>" . $this->error("array") . $this->closeTDRow();
			}
			array_pop($this->arrHistory);
			echo "</table><hr class=thinDebugHr />";
		}
604275
public function load( $var )
    {
        $success = true;
        $val = apc_fetch( $this->_prefix . $var, $success );

        if( $success === false )
            return null;

        return $val;
    }
680007
public function serialize($value)
    {
        $this->reset();

        return $this->serializationStrategy->serialize($this->serializeData($value));
    }
1213639
public function getDataPoolValue($variable)
    {
        $value = null;
        $pool  = $this->getDataPool();

        if (
            true === isset($pool[$variable]) &&
            true === isset($pool[$variable])
        ) {
            $value = $pool[$variable];
        }

        return $value;
    }
780813
protected function _varExport($var)
    {
        $export = var_export($var, true);
        $export = str_replace("\n", PHP_EOL . str_repeat(' ', 8), $export);
        $export = str_replace('  ', ' ', $export);
        $export = str_replace('array (', 'array(', $export);
        $export = str_replace('array( ', 'array(', $export);
        $export = str_replace(',)', ')', $export);
        $export = str_replace(', )', ')', $export);
        $export = str_replace('  ', ' ', $export);

        return $export;
    }
27395
protected function unserializeData($value)
    {
        if ($value === null || !is_array($value)) {
            return $value;
        }

        if (isset($value[self::MAP_TYPE]) && !isset($value[self::CLASS_IDENTIFIER_KEY])) {
            $value = $value[self::SCALAR_VALUE];

            return $this->unserializeData($value);
        }

        if (isset($value[self::SCALAR_TYPE])) {
            return $this->getScalarValue($value);
        }

        if (isset($value[self::CLASS_PARENT_KEY]) && 0 === strcmp($value[self::CLASS_PARENT_KEY], 'SplFixedArray')) {
            return SplFixedArraySerializer::unserialize($this, $value[self::CLASS_IDENTIFIER_KEY], $value);
        }

        if (isset($value[self::CLASS_IDENTIFIER_KEY])) {
            return $this->unserializeObject($value);
        }

        return \array_map([$this, __FUNCTION__], $value);
    }
525407
public function date($var = null)
    {
        if ($var !== null) {
            $this->date = Utils::date2timestamp($var, $this->dateformat);
        }

        if (!$this->date) {
            $this->date = $this->modified;
        }

        return $this->date;
    }
266656
public function header(array $var = null)
    {
        $content = $this->content();

        if ($var !== null) {
            $content['header'] = $var;
            $this->content($content);
        }

        return $content['header'];
    }