Returns parsed/converted value.
@since 1.0.0

@param mixed $value

@return mixed
551762
private function parseValue($value)
    {
        if (is_string($value))
            return new String_($value);
        if (is_bool($value))
            return new ConstFetch(new Name([$value ? 'true' : 'false']));
        if (is_float($value))
            return new DNumber($value);
        if (is_numeric($value))
            return new LNumber($value);
        if (is_array($value)) {
            $items = [];
            foreach ($value as $key => $value) {
                $items[] = new ArrayItem(
                    $this->parseValue($value),
                    $this->parseValue($key)
                );
            }
            return new Array_($items);
        }
        return null;
    }
657699
public static function convertUnmappedToPHPValue($value)
    {
        $type  = key($value);
        $value = current($value);

        switch ($type) {
            case 'S':
            case 'B':
            case 'BOOL':
                return $value;
            case 'NULL':
                return null;
            case 'N':
                // Use type coercion to unmarshal numbers to int/float.
                return $value + 0;
            case 'M':
            case 'L':
                foreach ($value as $k => $v) {
                    $value[$k] = self::convertUnmappedToPHPValue($v);
                }

                return $value;
            case 'BS':
            case 'NS':
            case 'SS':
                $childType = substr($type, 0, 1);

                return array_map(
                    function ($childValue) use ($childType) {
                        return self::convertUnmappedToPHPValue([$childType => $childValue]);
                    },
                    $value
                );
        }

        throw new \UnexpectedValueException("Unexpected type: $type.");
    }
756936
public function parse($value)
    {
        if (is_array($value)) {
            return $this->parseSet($value);
        } else {
            return $this->parseValue($value);
        }
    }
239416
protected function getValueType($value)
    {
        switch (true) {
            case is_scalar($value):
                $type = gettype($value);
                break;

            case is_array($value):
                $type = 'array';
                break;

            case is_object($value):
                $type = get_class($value);
                break;

            case is_resource($value):
                $type = 'resource';
                break;

            default:
                $type = 'unknown';
                break;
        }

        return $type;
    }
540973
protected function parseScope($value)
    {
        switch ($value) {
            case 'singleton':
                return Configuration::SCOPE_SINGLETON;
            case 'prototype':
                return Configuration::SCOPE_PROTOTYPE;
            case 'session':
                return Configuration::SCOPE_SESSION;
            default:
                throw new InvalidObjectConfigurationException('Invalid scope "' . $value . '"', 1167574991);
        }
    }
526705
public static function getType($value)
    {
        if (preg_match(self::REGEXP_TCP, $value)) {
            return self::TYPE_TCP;
        }

        if (preg_match(self::REGEXP_SSL, $value)) {
            return self::TYPE_SSL;
        }

        if (preg_match(self::REGEXP_UNIX, $value)) {
            return self::TYPE_UNIX;
        }

        return null;
    }
322874
private function processValue($value)
    {
        if ($value === "NOW()") {
            return $this->connection()->quote(gmdate("Y-m-d H:i:s"));
        } elseif ($value === "NULL") {
            return 'NULL';
        } elseif (is_array($value)) {
            return $this->connection()->quote(json_encode($value));
        } else {
            return $this->connection()->quote($value);
        }
    }
625113
public function convert($value)
    {
        if (!is_object($value)) {
            return $value;
        }

        if ($value instanceof Collection) {
            return $value->map(function ($item) {
                return $this->formatter($item)->format($item);
            })->toArray();
        }

        return $this->formatter($value)->format($value);
    }
286827
public static function parse($value)
    {
        if (\is_string($value)) {
            $operator = null;
            if (\strpos($value, AbstractMatcher::OPERATOR_AND)) {
                $operator = AbstractMatcher::OPERATOR_AND;
                $value = \explode(AbstractMatcher::OPERATOR_AND, $value);
            } elseif (\strpos($value, AbstractMatcher::OPERATOR_OR)) {
                $operator = AbstractMatcher::OPERATOR_OR;
                $value = \explode(AbstractMatcher::OPERATOR_OR, $value);
            } elseif (0 === \strpos($value, AbstractMatcher::OPERATOR_NOT)) {
                $value = [AbstractMatcher::OPERATOR_NOT => \substr($value, 1)];
            }
            if (null !== $operator) {
                return [
                    $operator => \array_map(
                        function ($val) {
                            return 0 === \strpos($val, AbstractMatcher::OPERATOR_NOT)
                                ? [AbstractMatcher::OPERATOR_NOT => \substr($val, 1)]
                                : $val;
                        },
                        $value
                    )
                ];
            }
        }

        return $value;
    }
894822
private function convertType($value)
    {
        $type = gettype($value);

        if ($this->type === $type || !is_scalar($value)) {
            return $value;
        }

        switch ($this->type) {
            case self::TYPE_BOOL:
                return $this->convertBool($value);
            case self::TYPE_INT:
                return $this->convertInt($value);
            case self::TYPE_FLOAT:
                return $this->convertFloat($value);
            default:
                return $this->convertString($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;
	}
1291139
protected function getValue($value)
    {
        if (is_numeric($value)) {
            return false !== strpos('.', $value) ? (double)$value : (int)$value;
        }
        return $value;
    }
462904
public function convert($value)
    {
        if (!is_array($value)) {
            return false;
        }


        if (empty($value)) {
            return false;
        }

        $result = '';

        foreach ($value as $key => $item) {
            if (!is_scalar($item)) {
                return false;
            }

            if (empty($key)
                && !is_int($key)
                && empty($item)
                && !is_int($item)
            ) {
                return false;
            }

            $result .= $this->converter->convert($key) . '_' . $this->converter->convert($item) . '_';
        }

        return rtrim($result, '_');
    }
104444
public static function parse($value)
    {
        $expression = Expression::getExpression();

        $return = preg_match(
            $expression,
            $value,
            $matches
        );

        if (!$return) {
            return null;
        }

        $parsed = new \stdClass();

        $parsed->key = $matches['key'];
        $parsed->mode = Globals::KEY_VARIABLE;

        if (isset($matches['function']) && !empty($matches['function'])) {
            $parsed->mode = Globals::KEY_FUNCTION;

            if (key_exists('parameters', $matches)  && strlen((string)$matches['parameters'])) {
                //Handles only one parameter
                $parsed->parameters = [$matches['parameters']];
            }
        } elseif (isset($matches['array'])  && !empty($matches['array'])) {
            $parsed->mode = Globals::KEY_ARRAY;
            //should exists
            $parsed->index = $matches['index'];
        }

        return $parsed;
    }
466479
public function parse_value( $value ) {
		if ( is_array( $this->defaults ) ) {
			$value = is_array( $value )
				? wp_parse_args( $value, $this->defaults )
				: $this->defaults;
		}

		return $value;
	}
1231895
protected function phpTypecastValue($value)
    {
        if ($value === null) {
            return null;
        }

        switch ($this->type) {
            case Schema::TYPE_BOOLEAN:
                switch (strtolower($value)) {
                    case 't':
                    case 'true':
                        return true;
                    case 'f':
                    case 'false':
                        return false;
                }
                return (bool) $value;
            case Schema::TYPE_BIT:
                return bindec($value);
            case Schema::TYPE_BINARY:
                return is_string($value) && strncmp($value, '\\x', 2) === 0 ? pack('H*', substr($value, 2)) : $value;
            case Schema::TYPE_JSON:
                return json_decode($value, true);
            case Schema::TYPE_TIMESTAMP:
            case Schema::TYPE_TIME:
            case Schema::TYPE_DATE:
            case Schema::TYPE_DATETIME:
                return new \DateTime($value);
            case Schema::TYPE_COMPOSITE:
                return $this->phpTypecastComposite($value);
        }

        return $this->typecast($value);
    }
346679
protected function value($value)
    {
        if (is_numeric($value)) {
            return $value;
        }

        if (is_bool($value)) {
            return $value ? 1 : 0;
        }

        if (is_string($value)) {
            return "'" . str_replace("'", "''", $value) . "'";
        }

        return 'NULL';
    }