Parses an annotation value
@param string $value
@return mixed
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;
	}
1077640
private function parse(string $value): void
    {
        // Check for castling:
        if (preg_match('/^(O-O|O-O-O)(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->castling = $matches[1];
            $this->check = $matches[2] === '+';
            $this->checkmate = $matches[2] === '#';
            $this->annotation = isset($matches[3]) ? $matches[3] : null;
            return;
        }

        // Pawn movement:
        if (preg_match('/^([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[1];
            $this->targetRow = (int)$matches[2];
            $this->check = $matches[3] === '+';
            $this->checkmate = $matches[3] === '#';
            $this->movedPiece = self::PIECE_PAWN;
            $this->annotation = isset($matches[4]) ? $matches[4] : null;
            return;
        }

        // Pawn movement (long san):
        if (preg_match('/^([a-h])([1-8])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->movedPiece = self::PIECE_PAWN;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            $this->longSan = true;
            return;
        }

        // Piece movement:
        if (preg_match('/^([KQBNR])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        // Piece movement from a specific column:
        if (preg_match('/^([KQBNR])([a-h])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece movement from a specific row:
        if (preg_match('/^([KQBNR])([0-9])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece movement from a specific column and row (long san):
        if (preg_match('/^([KQBNR])([a-h])([0-9])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->movedPieceDisambiguationRow = (int)$matches[3];
            $this->targetColumn = $matches[4];
            $this->targetRow = (int)$matches[5];
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Pawn capture:
        if (preg_match('/^([a-h])x([a-h])([1-8])(?:=?([KQBNR]))?(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->movedPiece = self::PIECE_PAWN;
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->capture = true;
            $this->promotedPiece = $matches[4] ?: null;
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Pawn capture (long san):
        if (preg_match('/^([a-h])([1-8])x([a-h])([1-8])(?:=?([KQBNR]))?(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->movedPiece = self::PIECE_PAWN;
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->capture = true;
            $this->promotedPiece = $matches[5] ?: null;
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Piece capture:
        if (preg_match('/^([KQBNR])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        // Piece capture from a specific column:
        if (preg_match('/^([KQBNR])([a-h])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece capture from a specific row:
        if (preg_match('/^([KQBNR])([0-9])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece capture from a specific column and row (long san):
        if (preg_match('/^([KQBNR])([a-h])([0-9])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->movedPieceDisambiguationRow = (int)$matches[3];
            $this->targetColumn = $matches[4];
            $this->targetRow = (int)$matches[5];
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Check for pawn promotion:
        if (preg_match('/^([a-h])([1-8])=?([KQBNR])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = self::PIECE_PAWN;
            $this->targetColumn = $matches[1];
            $this->targetRow = (int)$matches[2];
            $this->promotedPiece = $matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        throw new InvalidArgumentException(sprintf(
            'The value "%s" could not be parsed.',
            $value
        ));
    }
942828
private function getValue($value)
    {
        if (!is_string($value)) {
            return $value;
        }

        if ($value[0] != '%' || $value[strlen($value) - 1] != '%')  {
            return $value;
        }

        $parameter = trim($value, '%');
        if ($this->container->hasParameter($parameter)) {
            return $this->container->getParameter($parameter);
        }

        return $value;
    }
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;
	}
846813
function parseValue($value) {
        try {
            return \Plasma\Types\TypeExtensionsManager::getManager()->decodeType($this->type, $value)->getValue();
        } catch (\Plasma\Exception $e) {
            /* Continue regardless of error */
        }
        
        return $value;
    }
841441
public static function parseString($value) {
        try {
            return FloatHelper::parseString($value);
        } catch (FloatArgumentException $ex) {
            throw new DoubleArgumentException($value, $ex);
        }
    }
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;
    }
1002341
protected function parsevalue($value)
    {
        //make sure the whole value can be mapped
        if (!is_array($value) && !$value instanceof \ArrayAccess && !is_object($value)) {
            return false;
        }

        return $this->rParseValue($value);
    }
445553
public function parse($value, $row)
    {
        if ($this->parser != null) {
            return call_user_func($this->parser, $value, $row);
        }
        return $value;
    }
1140331
private function getAnnotationParameter($value)
    {
        $annotation = AnnotationParser::getAnnotation();


        return $annotation->directParse($value)
            ->execute()[$this->command][0];
    }
1357890
public function parseValue($fieldTypeIdentifier, $value)
    {
        if ($this->fieldTypeProcessorRegistry->hasProcessor($fieldTypeIdentifier)) {
            $fieldTypeProcessor = $this->fieldTypeProcessorRegistry->getProcessor($fieldTypeIdentifier);
            $value = $fieldTypeProcessor->preProcessValueHash($value);
        }

        $fieldType = $this->fieldTypeService->getFieldType($fieldTypeIdentifier);

        return $fieldType->fromHash($value);
    }
1233563
public function parse($value, $rule) {
        $this->formatEnumRule($rule);

        $this->formatEnumValue($value, $rule);

        return $value;
    }
688003
public static function parseString($value) {
        if (null === $value) {
            return null;
        }
        if (0 === preg_match("/^[0-9]{1,}(\.[0-9]{0,})?$/", $value)) {
            throw new FloatArgumentException($value);
        }
        return floatval($value);
    }
205326
protected function parseValue($value) {
        switch ($this->array_literals_behavior) {
            case self::PARSE_JSON:
                if (in_array(substr($value, 0, 1), array('[', '{')) && in_array(substr($value, -1), array(']', '}'))) {
                    if (defined('JSON_BIGINT_AS_STRING')) {
                        $output = json_decode($value, true, 512, JSON_BIGINT_AS_STRING);
                    } else {
                        $output = json_decode($value, true);
                    }

                    if ($output !== NULL) {
                        return $output;
                    }
                }
            // fallthrough
            // try regex parser for simple estructures not JSON-compatible (ex: colors = [blue, green, red])
            case self::PARSE_SIMPLE:
                // if the value looks like [a,b,c,...], interpret as array
                if (preg_match('/^\[\s*.*?(?:\s*,\s*.*?)*\s*\]$/', trim($value))) {
                    return array_map('trim', explode(',', trim(trim($value), '[]')));
                }
                break;
        }
        return $value;
    }
548714
public function parse_value($value) {
        global $COURSE;

        if (strpos($value, '$LineItems.url') !== false) {
            $this->params['context_id'] = $COURSE->id;
            $value = str_replace('$LineItems.url', parent::get_endpoint(), $value);
        }

        return $value;

    }
92288
protected function parseParameterType($value): int
    {

        if ($value === null) {
            return PDO::PARAM_NULL;
        }

        if (\is_int($value) === true || \is_bool($value) === true) {
            return PDO::PARAM_INT;
        }

        return PDO::PARAM_STR;
    }
820613
protected static function parseFieldValue($name, $value) {
		$field	= static::$validator->getField($name);
		if( $field ) {
			$field->getType()->parseValue($field, $value);
		}
		return parent::parseFieldValue($name, $value);
	}