Export given array as PHP code

@param  array  $value Original value
@return string        PHP code
503605
protected static function export(array $value)
	{
		$pairs = [];
		foreach ($value as $k => $v)
		{
			$pairs[] = var_export($k, true) . '=>' . var_export($v, true);
		}

		return '[' . implode(',', $pairs) . ']';
	}
262626
public function describeValue(Exporter $exporter, $value): string
    {
        if (is_array($value)) {
            return 'an array';
        }

        return $exporter->export($value);
    }
741575
public function unserializeData($value)
    {
        if (\is_array($value)) {
            return $value;
        }

        if (0 === strpos($value, 'a:')) {
            return \unserialize($value, ['allowed_classes' => false]);
        }

        return $value;
    }
753648
protected function valueCode($value)
	{
		if (empty($value)) return Yii::$app->formatter->nullDisplay;
		return html::tag('code', $value);
	}
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;
    }
1174514
private function escapeArray($value) {
        if (!is_array($value)) {
            return $this->escape($value);
        }
        foreach ($value as $key => $prop) {
            $value[$key] = $this->escape($prop);
        }
        return $value;
    }
714736
protected static function getArrayIfJSON($value)
    {
        if (is_array($value)) {
            return $value;
        } else {
            $toArray = json_decode($value, true);

            if (json_last_error() === JSON_ERROR_NONE) {
                return $toArray;
            } else {
                return $value;
            }
        }
    }
1048818
public function utf8Value($value)
    {
        if (is_array($value)) {
            return $this->utf8AllTheThings($value);
        }

        return StringHelper::convertToUtf8($value);
    }
189818
public function makeStorableArrayFieldValue($value)
    {
        if ($this->_isEncodedArrayFieldValue($value)) {
            $value = $this->_decodeArrayFieldValue($value);
        }

        $value = $this->_serializeValue($value);
        return $value;
    }
357887
public static function toArray($value)
    {
        $data = [];

        $cookies = $value ? explode(';', $value) : [];
        foreach ($cookies as $cookie) {
            list($name, $value) = explode('=', $cookie);
            $name = trim($name);
            $value = urldecode($value);
            if (!isset($data[$name])) {
                $data[$name] = $value;
            }
        }
        return $data;
    }
89002
public function value($value)
    {
        //terminal case
        if (!is_array($value)) {
            if (strpbrk($value, Lexer::ESCAPED_STRING) !== false) {
                if (!(substr($value, 0, 1) == '"' && substr($value, -1) == '"')) {
                    return '(' . addcslashes($value, Lexer::ESCAPED_STRING_PAREN_ENCAPSED) . ')';
                }
            }
            return $value;
        }

        //composite value case
        $pairs = array();
        foreach ($value as $key => $subval) {
            $pairs[] = "{$this->identifier($key)} = {$this->value($subval)}";
        }

        return '(' . implode(', ', $pairs) . ')';
    }
254385
protected function sanitizeToArrayValue($value)
    {
        if ($value instanceof Message) {
            return (new self($value))->toArray();
        }

        if ($value instanceof RepeatedField) {
            $values = [];
            foreach ($value as $k => $v) {
                $values[] = $this->sanitizeToArrayValue($v);
            }

            return $values;
        }

        if ($value instanceof self) {
            return $value->toArray();
        }

        return $value;
    }
900172
public function serialize($value) : string
    {
        if (null !== $value && !is_array($value)) {
            throw InvalidValueException::valueDoesNotMatchType($this, $value);
        }

        return json_encode($value);
    }
1162474
public static function maybeEncode($value)
    {
        if (is_array($value) || is_object($value)) {
            $value = json_encode($value);
        }

        return $value;
    }
1006256
protected function _humanizeMultilingualData(array $value) {
        $out = array();
        foreach ($value as $key => $data) {
            $out[] = "[$key]: $data";
        }
        return implode(" - ", $out);
    }
391941
public function compile($value)
    {
        // Only continue is shortcodes have been registered
        if(!$this->enabled || !$this->hasShortcodes())
            return $value;

        // Set empty result
        $result = '';

        // Here we will loop through all of the tokens returned by the Zend lexer and
        // parse each one into the corresponding valid PHP. We will then have this
        // template as the correctly rendered PHP that can be rendered natively.
        foreach (token_get_all($value) as $token)
        {
            $result .= is_array($token) ? $this->parseToken($token) : $token;
        }

        return $result;
    }
424245
static public function urlencode($value)
    {
        if (is_string($value)) {
            return urlencode($value);
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = static::urlencode($v);
            }
        }
        return $value;
    }