Decode RAW string into contents.

@param string $var
@return array mixed
358015
protected function decode($var)
    {
        $lines = (array) preg_split('#(\r\n|\n|\r)#', $var);

        $results = array();
        foreach ($lines as $line) {
            preg_match('#^\[(.*)\] (.*)  @  (.*)  @@  (.*)$#', $line, $matches);
            if ($matches) {
                $results[] = ['date' => $matches[1], 'message' => $matches[2], 'url' => $matches[3], 'file' => $matches[4]];
            }
        }

        return $results;
    }
1265570
public static function asArray($var, $delimeter = ',')
	{
		if (static::is_array($var)) {
			return $var;
		}
		try {
			if (NULL === $var) {
				$result = [];
			} else {
				$var = trim((string) $var);
				$result = strlen($var) ? preg_split('#' . $delimeter . '#i', $var, -1, PREG_SPLIT_NO_EMPTY) : [];
			}
		} catch (Exception $e) {
			$result = [];
		}

		return $result;
	}
705876
private function parseString(&$var, BasicObject $o)
    {
        $string = new BlobObject();
        $string->transplant($o);
        $string->encoding = BlobObject::detectEncoding($var);
        $string->size = BlobObject::strlen($var, $string->encoding);

        $rep = new Representation('Contents');
        $rep->contents = $var;
        $rep->implicit_label = true;

        $string->addRepresentation($rep);
        $string->value = $rep;

        $this->applyPlugins($var, $string, self::TRIGGER_SUCCESS);

        return $string;
    }
369812
def decode(var, encoding):
    
    if PY2:
        if isinstance(var, unicode):
            ret = var
        elif isinstance(var, str):
            if encoding:
                ret = var.decode(encoding)
            else:
                ret = unicode(var)
        else:
            ret = unicode(var)
    else:
        ret = str(var)
    return ret
785760
protected function decode($var)
    {
        // Try native PECL YAML PHP extension first if available.
        if (\function_exists('yaml_parse') && $this->setting('native', true)) {
            // Safely decode YAML.
            $saved = @ini_get('yaml.decode_php');
            @ini_set('yaml.decode_php', 0);
            $data = @yaml_parse($var);
            @ini_set('yaml.decode_php', $saved);

            if ($data !== false) {
                return (array) $data;
            }
        }

        try {
            return (array) YamlParser::parse($var);
        } catch (ParseException $e) {
            if ($this->setting('compat', true)) {
                return (array) FallbackYamlParser::parse($var);
            }

            throw $e;
        }
    }
328024
protected function filter($var)
    {
        switch (true) {
            case strpos(trim($var), "#") === 0:
                return null;
            case strpos($var, "=") !== false:
                list($key, $val) = array_map("trim", explode("=", $var ,2));
                return array($key, $val);
            default:
                return null;
        }
    }
604949
protected function decode($string)
    {
        $charset = $this->getDataCharset();
        if ($charset !== $this->getConnectionCharset()) {
            $string = iconv($this->getConnectionCharset(), $charset, $string);
        }
        if (get_magic_quotes_gpc()) {
            $string = stripslashes($string);
        }

        return $string;
    }
278648
public function decode($data)
    {
        $result = [];
        $offset = 0;
        $length = strlen($data);
        while ($offset < $length)
        {
            if (!strstr(substr($data, $offset), '|'))
            {
                return [];
            }
            $pos = strpos($data, '|', $offset);
            $num = $pos - $offset;
            $varname = substr($data, $offset, $num);
            $offset += $num + 1;
            $dataItem = unserialize(substr($data, $offset));
            $result[$varname] = $dataItem;
            $offset += strlen(serialize($dataItem));
        }
        return $result;
    }
298500
protected function _arrayToString(array $var)
    {
        foreach ($var as $rowIndex => $row) {
            foreach ($row as $k => $v) {
                if (is_resource($var[$rowIndex][$k])) {
                    $var[$rowIndex][$k] = stream_get_contents($v);
                }
            }
        }

        $var = json_decode(str_replace(['(', ')'], ['&#40', '&#41'], json_encode($var)), true);
        $var = var_export($var, true);

        return str_replace(['array (', ')', '&#40', '&#41'], ['[', ']', '(', ')'], $var);
    }
1257837
public function get(string $var){
		$var = strtoupper($var);
		$env = null;

		if($this->global === true){

			if(array_key_exists($var, $_ENV)){
				$env = $_ENV[$var];
			}
			elseif(function_exists('getenv')){
				$env = getenv($var);
			}
			// @codeCoverageIgnoreStart
			elseif(function_exists('apache_getenv')){
				/** @noinspection PhpComposerExtensionStubsInspection */
				$env = apache_getenv($var);
			}
			// @codeCoverageIgnoreEnd

		}

		return $env ?? $this->_ENV[$var] ?? null;
	}
1072435
public static function dump($var, $echo = true)
    {
        ob_start();
        var_dump($var);

        $output = ob_get_clean();
        $output = preg_replace("/\]\=\>\n(\s+)/m", "] => ", $output);

        if (PHP_SAPI == "cli") {
            $output = PHP_EOL . PHP_EOL . $output . PHP_EOL;
        } else {
            $output = "<pre>" . htmlspecialchars($output, ENT_QUOTES) . "</pre>";
        }

        if ($echo) echo($output);

        return $output;
    }
423376
public static function getArray($var)
    {
        if (is_null($var) || empty($var)) {
            return [];
        }

        foreach ($var as $value) {
            if ((gettype($value) == 'object')
                && (get_class($value) == 'SimpleXMLElement')
            ) {
                return (array) $var;
            } elseif (!is_array($value)) {
                return [$var];
            }
        }

        return $var;
    }
115546
public function getParam($var = null)
    {
        $param = [
            'left'      => $this->getLeftnode(),
            'right'     => $this->getRightnode(),
            'level'     => $this->getLevel(),
            'position'  => $this->getPosition(),
        ];

        if (null !== $var) {
            if (false === array_key_exists($var, $param)) {
                return;
            }

            return $param[$var];
        }

        return $param;
    }
753563
public function raw($var = null)
    {
        if ($var !== null) {
            $this->raw = (string) $var;
            $this->content = null;
        }

        if (!\is_string($this->raw)) {
            $this->raw = $this->load();
        }

        return $this->raw;
    }
1320526
public static function DecodePgArray(string $str) :array
        {
            if ($str == '{}' || $str[0] != '{' || $str[-1] != '}') {
                return [];
            }

            $nestLevel = -1;
            $res       = [];
            $len       = strlen($str);
            $item      = "";

            for ($i = 0; $i < $len; $i++) {
                if ($str[$i] == "{") {
                    if (++$nestLevel > 0) {
                        $item .= $str[$i];
                    }
                }
                else if ($str[$i] == "}") {
                    if ($nestLevel-- > 0) {
                        $item .= $str[$i];
                    }

                    if ($nestLevel == -1) {
                        if (is_numeric($item)) {
                            $item = $item * 1;
                        }
                        else if ($item[0] == "{") {
                            $item = self::DecodePgArray($item);
                        }
                        else {
                            $item = trim($item, "\"");
                        }

                        $res[] = $item;
                        $item  = '';
                    }
                }
                else if ($str[$i] == ',' && !$nestLevel) {
                    if (is_numeric($item)) {
                        $item = $item * 1;
                    }
                    else if ($item[0] == "{") {
                        $item = self::DecodePgArray($item);
                    }
                    else {
                        $item = trim($item, "\"");
                    }

                    $res[] = $item;
                    $item  = '';
                }
                else {
                    $item .= $str[$i];
                }
            }

            return $res;
        }
123510
public function raw($var = null)
    {
        $file = $this->file();

        if ($var) {
            // First update file object.
            if ($file) {
                $file->raw($var);
            }

            // Reset header and content.
            $this->modified = time();
            $this->id($this->modified() . md5($this->filePath()));
            $this->header = null;
            $this->content = null;
            $this->summary = null;
        }

        return $file ? $file->raw() : '';
    }
861487
public function toUpperCaseLast($var)
    {
        $v = '' . $var;
        $len = $this->strlen($var);
        if (!$len) {
            return '';
        }
        if (static::$nativeSupport['mbstring']) {
            if ($len > 1) {
                return mb_substr($v, 0, $len - 2) . mb_strtoupper(mb_substr($v, $len - 2));
            }
            return mb_strtoupper($v);
        }
        return $v;
    }