decode

@param $value
@return bool|string
496141
public function decode($value)
    {
        if ($value === '' || !is_scalar($value)) {
            return false;
        }

        $cryptText = $this->safeBase64Decode($value);
        $ivSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
        $iv = mcrypt_create_iv($ivSize, MCRYPT_RAND);
        $decryptText = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->secureKey, $cryptText, MCRYPT_MODE_ECB, $iv);

        return trim($decryptText);
    }
963167
public function encode($value)
    {
        $json = json_encode($value);

        if ($code = json_last_error()) $this->throwError($code);

        return $json;
    }
1250122
public static function htmlspecialchars_decode($value) {
		$value = str_replace('&gt;', '>', $value);
		$value = str_replace('&lt;', '<', $value);
		$value = str_replace('&quot;', '"', $value);
		$value = str_replace('&amp;', '&', $value);
		return $value;
	}
456465
private function sanitize($value)
    {
        if ($value === null) {
            $value = 'null';
        }

        if (is_array($value)) {
            $value = 'array';
        }

        if (is_bool($value)) {
            $value = $value
                ? 'true'
                : 'false';
        }

        return $value;
    }
13392
public function parse($value) {
		$json = $this->decode($value);
		if (JSON_ERROR_NONE == json_last_error()) {
			return $json;
		}
		$float = filter_var($value, FILTER_VALIDATE_FLOAT);
		return $float !== false ? $float : $value;
	}
1174969
public function encode($value)
    {
        $encryptedValue = $this->getEncryptor()->encrypt($value);
        $encodedValue = base64_encode($encryptedValue);

        return $encodedValue;
    }
1221836
public static function encode($value)
    {
        $encoded = self::safeEncode($value);
        $lastErrorCode = self::lastError();
        if ($lastErrorCode !== JSON_ERROR_NONE || $encoded === false) {
            throw new JsonEncodeException(self::lastErrorMessage(), $lastErrorCode);
        }
        return $encoded;
    }
472228
public function obfuscate($value)
    {
        $safe = '';

        foreach (str_split($value) as $letter) {
            if (ord($letter) > 128) {
                return $letter;
            }

            switch (rand(1, 3)) {
                case 1:
                $safe .= '&#'.ord($letter).';';
                break;
                case 2:
                $safe .= '&#x'.dechex(ord($letter)).';';
                break;
                case 3:
                $safe .= $letter;
            }
        }

        return $safe;
    }
835565
public static function decode(Value $value, Context $context)
    {
        if ($value instanceof BooleanValue) {
            return $value->value();
        } elseif ($value instanceof StringValue) {
            return $value->value();
        } elseif ($value instanceof IntegerValue) {
            return $value->value();
        } elseif ($value instanceof NumberValue) {
            return $value->value();
        } elseif ($value instanceof NullValue) {
            return null;
        } elseif ($value instanceof UndefinedValue) {
            return null;
        } elseif ($value instanceof DateObject) {
            return new \DateTime('@' . intval($value->valueOf() / 1000));
        } elseif ($value instanceof BooleanObject) {
            return $value->valueOf();
        } elseif ($value instanceof StringObject) {
            return $value->valueOf()->value();
        } elseif ($value instanceof NumberObject) {
            $val = $value->valueOf();
            return strpos($val, '.') === false ? intval($val) : $val;
        } elseif ($value instanceof RegExpObject) {
            return $value->getSource()->value();
        } elseif ($value instanceof ArrayObject) {
            $result = [];
            for ($i = 0; $i < $value->length(); $i++) {
                $result[] = self::decode($value->get($context, new IntegerValue($context->getIsolate(), $i)), $context);
            }
            return $result;
        } elseif ($value instanceof FunctionObject) {
            return function(...$arguments) use ($value, $context){
                $result = $value->call(
                    $context,
                    Encoder::encode(new \stdClass(), $context),
                    array_map(function($value) use ($context){
                        return Encoder::encode($value, $context);
                    }, $arguments)
                );

                return self::decode($result, $context);
            };
        } elseif ($value instanceof ObjectValue) {
            $names  = $value->getOwnPropertyNames($context);
            $result = new \stdClass();

            for ($i = 0; $i < $names->length(); $i++) {
                $name = $names->get($context, new IntegerValue($context->getIsolate(), $i));
                if ($name instanceof StringValue) {
                    $key = $name->value();
                    $val = $value->get($context, $name);

                    $result->$key = self::decode($val, $context);
                }
            }

            return $result;
        } else {
            return null;
        }
    }
881602
public function encodeValue($value)
    {
        if ($this->urlEncode == self::RFC_3986) {
            return rawurlencode($value);
        } elseif ($this->urlEncode == self::FORM_URLENCODED) {
            return urlencode($value);
        } else {
            return (string) $value;
        }
    }
81817
public static function decode(string $value)
    {
        $stdObject = json_decode($value);
        // catch error if it occurs
        self::catchError();

        if (self::getError()) {
            return self::getError();
        }

        return $stdObject;
    }
720295
public function decode($value)
    {
        if (is_array($value)) {
            $newValue = array();
            foreach ($value as $key => $val) {
                $newValue[$key] = html_entity_decode($val, ENT_QUOTES, 'UTF-8');
            }

            return $newValue;
        }

        return html_entity_decode($value, ENT_QUOTES, 'UTF-8');
    }
1162474
public static function maybeEncode($value)
    {
        if (is_array($value) || is_object($value)) {
            $value = json_encode($value);
        }

        return $value;
    }
25900
public function filter($value)
    {
        if (!is_scalar($value)) {
            return $value;
        }
        $value = (string) $value;

        if (null !== $this->getEncoding()) {
            return mb_strtolower($value, $this->options['encoding']);
        }

        return strtolower($value);
    }
1316276
static public function urldecode($value)
    {
        if (is_string($value)) {
            return urldecode($value);
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = static::urldecode($v);
            }
        }
        return $value;
    }
898484
public static function convertString($value)
    {
        if (strpos($value, '\\') === false) {
            return substr($value, 1, -1);
        }

        if ($value[0] === "'") {
            return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']);
        }

        $value = substr($value, 1, -1);

        return preg_replace_callback(
            '/\\\(n|r|t|v|e|f|\$|"|\\\|x[0-9A-Fa-f]{1,2}|u{[0-9a-f]{1,6}}|[0-7]{1,3})/',
            function ($match) {
                switch ($match[1][0]) {
                    case 'n':
                        return "\n";
                    case 'r':
                        return "\r";
                    case 't':
                        return "\t";
                    case 'v':
                        return "\v";
                    case 'e':
                        return "\e";
                    case 'f':
                        return "\f";
                    case '$':
                        return '$';
                    case '"':
                        return '"';
                    case '\\':
                        return '\\';
                    case 'x':
                        return chr(hexdec(substr($match[0], 1)));
                    case 'u':
                        return self::unicodeChar(hexdec(substr($match[0], 1)));
                    default:
                        return chr(octdec($match[0]));
                }
            },
            $value
        );
    }
1222027
public static function decode($value)
    {
        if (empty($value)) {
            return null;
        }

        if (!is_string($value)) {
            throw new \InvalidArgumentException(sprintf(
                "Value type '%s' is not a PHP string so it cannot be unserialized.",
                gettype($value)
            ));
        }

        $data = unserialize($value);

        return $data;
    }