Parses option value for getChain method

@param mixed $value
@return mixed
198825
private function parseOptionValue($value = null)
    {
        if (\is_bool($value)) {
            $value = $value === true ? 'true' : 'false';
        } elseif (\is_null($value)) {
            $value = 'null';
        } elseif (\is_string($value)) {
            $value = '\''.$value.'\'';
        }
        return $value;
    }
252503
public function parse($value)
    {
        $this->load($value);
        $xml = $this->reader;
        $root = $this->rootNode;

        $id = explode('-', $xml->getValue('cbc:ID', $root));
        $summary = new Summary();
        $summary->setCorrelativo($id[2])
            ->setFecGeneracion(new \DateTime($xml->getValue('cbc:ReferenceDate', $root)))
            ->setFecResumen(new \DateTime($xml->getValue('cbc:IssueDate', $root)))
            ->setCompany($this->getCompany())
            ->setDetails(iterator_to_array($this->getDetails()));

        return $summary;
    }
109729
public static function getTypeValueFromObject( $value )
	{
		if ( $value instanceof XPath2Item )
		{
			return $value->getValueType();
		}

		if ( is_null( $value ) )
		{
			return Types::$NullType;
		}

		if ( is_array( $value ) )
		{
			return Types::$ArrayType;
		}

		if ( $value instanceof \DateTime )
		{
			return Types::$DateTimeValueType;
		}

		if ( is_bool( $value ) || $value instanceof FalseValue || $value instanceof TrueValue )
		{
			return Types::$BooleanType;
		}

		if ( is_string( $value ) )
		{
			return Types::$StringType;
		}

		if ( is_object( $value ) )
		{
			// if ( $value instanceof DateTimeInterval )
			// {
			// 	return Types::$DateTimeIntervalType;
			// }

			if ( $value instanceof DecimalValue )
			{
				return Types::$DecimalType;
			}

			if ( $value instanceof Long )
			{
				return Types::$LongType;
			}

			if ( $value instanceof DayTimeDurationValue )
			{
				return Types::$DayTimeDurationValueType;
			}

			if ( $value instanceof YearMonthDurationValue )
			{
				return Types::$YearMonthDurationValueType;
			}

			if ( $value instanceof UntypedAtomic )
			{
				return Types::$UntypedAtomicType;
			}

			if ( $value instanceof DurationValue )
			{
				return Types::$DurationValueType;
			}

			if ( $value instanceof GYearMonthValue )
			{
				return Types::$GYearMonthValueType;
			}

			if ( $value instanceof GYearValue )
			{
				return Types::$GYearValueType;
			}

			if ( $value instanceof GMonthValue )
			{
				return Types::$GMonthValueType;
			}

			if ( $value instanceof GMonthDayValue )
			{
				return Types::$GMonthDayValueType;
			}

			if ( $value instanceof GDayValue )
			{
				return Types::$GDayValueType;
			}

			if ( $value instanceof QNameValue )
			{
				return Types::$QNameValueType;
			}

			if ( $value instanceof HexBinaryValue )
			{
				return Types::$HexBinaryValueType;
			}

			if ( $value instanceof Base64BinaryValue )
			{
				return Types::$Base64BinaryValueType;
			}

			if ( $value instanceof IDREFSValue )
			{
				return Types::$IDREFSValueType;
			}

			if ( $value instanceof NMTOKENSValue )
			{
				return Types::$NMTOKENSValueType;
			}

			if ( $value instanceof ENTITIESValue )
			{
				return Types::$ENTITIESValueType;
			}

			$className = get_class( $value );

			if ( $className == Types::$NullType->getFullName() )
			{
				return Types::$NullType;
			}

			if ( $className == Types::$AnyUriValueType->getFullName() )
			{
				return Types::$AnyUriValueType;
			}

			if ( $className == Types::$UNION->getFullName() )
			{
				return Types::$UNION;
			}

			else if ( $className == Types::$BoolType->getFullName() )
				return Types::$BooType;
			else if ( $className == Types::$BooleanType->getFullName() )
				return Types::$BooleanType;
			else if ( $className == Types::$CharType->getFullName() )
				return Types::$CharType;
			else if ( $className == Types::$SByteType->getFullName() )
				return Types::$SByteType;
			else if ( $className == Types::$ByteType->getFullName() )
				return Types::$ByteType;
			else if ( $className == Types::$Int16Type->getFullName() )
				return Types::$Int16Type;
			else if ( $className == Types::$ShortType->getFullName() )
				return Types::$ShortType;
			else if ( $className == Types::$UInt16Type->getFullName() )
				return Types::$UInt16Type;
			else if ( $className == Types::$Int32Type->getFullName() )
				return Types::$Int32Type;
			else if ( $className == Types::$IntType->getFullName() )
				return Types::$IntType;
			else if ( $className == Types::$UInt32Type->getFullName() )
				return Types::$UInt32Type;
			else if ( $className == Types::$Int64Type->getFullName() )
				return Types::$Int64Type;
			else if ( $className == Types::$LongType->getFullName() )
				return Types::$LongType;
			else if ( $className == Types::$UInt64Type->getFullName() )
				return Types::$UInt64Type;
			else if ( $className == Types::$FloatType->getFullName() )
				return Types::$FloatType;
			else if ( $className == Types::$DoubleType->getFullName() )
				return Types::$DoubleType;
			else if ( $className == Types::$DateTimeIntervalType->getFullName() )
				return Types::$DateTimeIntervalType;
			else if ( $className == Types::$DecimalType->getFullName() )
				return Types::$DecimalType;
			else if ( $className == Types::$TimeValueType->getFullName() )
				return Types::$TimeValueType;
			else if ( $className == Types::$DateValueType->getFullName() )
				return Types::$DateValueType;
			else if ( $className == Types::$DateTimeValueType->getFullName() )
				return Types::$DateTimeValueType;
			else if ( $className == Types::$StringType->getFullName() )
				return Types::$StringType;
			else if ( $className == Types::$ArrayType->getFullName() )
				return Types::$ArrayType;
			else if ( $className == Types::$ObjectType->getFullName() )
				return Types::$ObjectType;
			else if ( $className == Types::$ArrayType->getFullName() )
				return Types::$ArrayType;
			else if ( $className == Types::$IntegerType->getFullName() )
				return Types::$IntegerType;

			return Type::FromNameAndTypeCode( $className, TypeCode::Object );
		}

		if ( is_double( $value ) || NAN . "" == strtoupper( $value ) )
		{
			return Types::$DoubleType;
		}

		if ( is_int( $value ) )
		{
			return Types::$IntType;
		}

	}
454720
protected function getIdFromValue(string $value)
    {
        try {
            if (null !== $item = $this->getIriConverter()->getItemFromIri($value, ['fetch_data' => false])) {
                return $this->getPropertyAccessor()->getValue($item, 'id');
            }
        } catch (InvalidArgumentException $e) {
            // Do nothing, return the raw value
        }

        return $value;
    }
179619
public static function parse($value, $options = [])
    {
        $unserializeHandler = ini_set('unserialize_callback_func', self::class . '::handleUnserializeCallback');
        try {
            if (\PHP_VERSION_ID < 70000) {
                return Thrower::call('unserialize', $value);
            }

            return Thrower::call('unserialize', $value, $options);
        } catch (ParseException $e) {
            throw $e;
        } catch (\Throwable $e) {
        } finally {
            ini_set('unserialize_callback_func', $unserializeHandler);
        }

        throw new ParseException('Error parsing serialized value.', -1, null, 0, $e);
    }
391452
protected static function parseValue($value)
    {
        if ($value instanceof \DateTime) {
            return 'new \\DateTime(' . \var_export($value->format('c'), true) . ')';
        }

        if (!\is_string($value)) {
            return \var_export($value, true);
        }

        if (\preg_match('/%([a-zA-Z0-9_:\\\]+)(?::(.*))?%/', $value, $matches)) {
            $function = $matches[1];

            if (!\function_exists($function)) {
                return $value;
            }

            if (!isset($matches[2])) {
                return $function . '()';
            }

            $args = \explode(',', $matches[2]);
            foreach ($args as &$a) {
                $a = static::parseConstant(\trim($a));
            }

            return $function . '(' . \implode(', ', $args) . ')';
        }

        return static::parseConstant($value);
    }
628975
public static function getValueAsList($value) {
		$tokens = token_get_all('<?php '.$value);

		$resultArray = array();
		
		// Le's find all the strings, and let's put each string in the table.
		foreach ($tokens as $token) {
			if ($token[0] == T_CONSTANT_ENCAPSED_STRING) {
				$resultArray[] = substr($token[1], 1, strlen($token[1])-2) ;
			}
		}

		return  $resultArray;
	}
780035
public function getKey($value): Option
	{
		if ($this->containsValue($value))
		{
			return new Option(array_search($value, $this->data, true), true);
		}
		else
		{
			return new Option(null, false);
		}
	}
1023578
private static function getChoices(Options $options, $value)
    {
        return $value instanceof ChoiceLoaderInterface && empty($options['choices'])
            ? $value->loadChoiceList()->getStructuredValues()
            : $options['choices'];
    }
16787
public function parse($value)
    {
        if ($value === null) {
            return null;
        }

        if ($value == '()') {
            return [null];
        }

        return $this->parseComposite($value);
    }
443579
public function extract($value)
    {
        if (!$value instanceof Money) {
            throw new \InvalidArgumentException(sprintf(
                '$value expected type SCL\Currency\Money, got "%s"',
                is_object($value) ? get_class($value) : gettype($value)
            ));
        }

        return $value->getValue();
    }
855428
public function parse_value($value) {
        global $COURSE, $DB;

        if (strpos($value, '$ToolProxyBinding.memberships.url') !== false) {
            if ($COURSE->id === SITEID) {
                $this->params['context_type'] = 'Group';
            } else {
                $this->params['context_type'] = 'CourseSection';
            }
            $this->params['context_id'] = $COURSE->id;

            $id = optional_param('id', 0, PARAM_INT); // Course Module ID.
            if (!empty($id)) {
                $cm = get_coursemodule_from_id('lti', $id, 0, false, IGNORE_MISSING);
                $lti = $DB->get_record('lti', array('id' => $cm->instance), 'typeid', IGNORE_MISSING);
                if ($lti && !empty($lti->typeid)) {
                    $this->params['tool_code'] = $lti->typeid;
                }
            }
            $value = str_replace('$ToolProxyBinding.memberships.url', parent::get_endpoint(), $value);
        }
        return $value;

    }
974526
public function get(string $key, $value = null)
    {
        if ($this->__isset($key)) {
            $value = $this->options[$key];
        }

        return $value;
    }
302861
public function option($option, $value = null)
    {
        if (func_num_args() == 1) {
            return Arr::get($this->options, $option);
        }

        $this->options[$option] = $value;

        return $this;
    }
1246256
public function parseValue($value)
    {
        if (is_array($value)) {
            array_walk_recursive($value, [$this, 'doHtmlspecialchars']);
        } else {
            $value = $this->doHtmlspecialchars($value);
        }

        return parent::parseValue($value);
    }
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;
    }
891343
public static function tryGetTypeForValue($value)
    {
        if (!is_object($value)) {
            return null;
        }

        // maybe it's a ValueObject

        // try get type name from types map
        $className = get_class($value);
        if (isset(self::$typesMap[$className])) {
            return Type::getType(self::$typesMap[$className]);
        }

        // use class name as type name
        $classNameParts = explode('\\', $className);
        $typeName = array_pop($classNameParts);

        if (array_key_exists($typeName, Type::getTypesMap())) {
            return Type::getType($typeName);
        }

        return null;
    }