Builds a LinkHeaderItem instance from a string.

@param string $itemValue value of a single link header

@return \Graviton\RestBundle\HttpFoundation\LinkHeaderItem
173990
public static function fromString($itemValue)
    {
        $bits = preg_split('/(".+?"|[^;]+)(?:;|$)/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $value = array_shift($bits);
        $attributes = [];

        foreach ($bits as $bit) {
            list($bitName, $bitValue) = explode('=', trim($bit));

            $bitValue = self::trimEdge($bitValue, '"');
            $bitValue = self::trimEdge($bitValue, '\'');

            $attributes[$bitName] = $bitValue;
        }

        $url = self::trimEdge($value, '<');

        return new self($url, $attributes);
    }
227074
public function setItem(Item $item = null)
    {
        if ($this->item !== $item) {
            // romove link on this item for old item
            if ($this->item instanceof Item) {
                $tmp = $this->item;
                $this->item = null;
                $tmp->removeSource($this);
            }
            $this->item = $item;
            // add link on this item
            if ($item instanceof Item) {
                $this->item->addSource($this);
            }
        }

        return $this;
    }
481678
public function addHeaderValue($header, $headerValue): Builder
    {
        if (!isset($this->headers[$header])) {
            $this->headers[$header] = $headerValue;
        } else {
            $this->headers[$header] = array_merge((array)$this->headers[$header], [$headerValue]);
        }
        $this->removePlugin(Plugin\HeaderAppendPlugin::class);
        $this->addPlugin(new Plugin\HeaderAppendPlugin($this->headers));

        return $this;
    }
750401
public function fromPersistenceValue(FieldValue $fieldValue)
    {
        if ($fieldValue->externalData === null) {
            return $this->getEmptyValue();
        }

        $result = parent::fromPersistenceValue($fieldValue);

        $result->hasController = (isset($fieldValue->externalData['hasController'])
            ? $fieldValue->externalData['hasController']
            : false);
        $result->autoplay = (isset($fieldValue->externalData['autoplay'])
            ? $fieldValue->externalData['autoplay']
            : false);
        $result->loop = (isset($fieldValue->externalData['loop'])
            ? $fieldValue->externalData['loop']
            : false);
        $result->height = (isset($fieldValue->externalData['height'])
            ? $fieldValue->externalData['height']
            : 0);
        $result->width = (isset($fieldValue->externalData['width'])
            ? $fieldValue->externalData['width']
            : 0);

        return $result;
    }
880935
public function getHeaderValue($name, $defaultValue = null)
    {
        $header = $this->getHeader($name);
        if ($header !== null) {
            return $header->getValue();
        }
        return $defaultValue;
    }
942657
public static function fromValue( $value )
	{
		if ( $value instanceof XPath2Item )
		{
			return $value;
		}

		$result = new XPath2Item();
		// $result->setRawValue( $value instanceof ValueProxy || $value instanceof IXmlSchemaType ? $value->getValue() : $value );
		$result->setRawValue( $value instanceof ValueProxy ? $value->getValue() : $value );

		if ( $value instanceof IXmlSchemaType )
		{
			// $result->setRawValue( $value->getValue() );
			// $result->_xmlType = DOMSchemaType::GetBuiltInSimpleTypeByTypecode( $value->GetTypeCode() );
			$result->_xmlType = $value->getSchemaType();
		}
		else
		{
			// $result->setRawValue( $value );
			$result->InferXmlType();
		}
		return $result;
	}
869149
public function asXml(Shopgate_Model_XmlResultObject $itemNode)
    {
        /**
         * @var Shopgate_Model_XmlResultObject $relationNode
         */
        $relationNode = $itemNode->addChild('relation');
        $relationNode->addAttribute('type', $this->getType());
        if ($this->getType() == self::DEFAULT_RELATION_TYPE_CUSTOM) {
            $relationNode->addChildWithCDATA('label', $this->getLabel());
        }
        foreach ($this->getValues() as $value) {
            $relationNode->addChild('uid', $value);
        }

        return $itemNode;
    }
515
public function asXml(Shopgate_Model_XmlResultObject $itemNode)
    {
        /**
         * @var Shopgate_Model_XmlResultObject $stockNode
         */
        $identifierNode = $itemNode->addChildWithCDATA('identifier', $this->getValue());
        $identifierNode->addAttribute('uid', $this->getUid());
        $identifierNode->addAttribute('type', $this->getType());

        return $itemNode;
    }
584146
protected function replaceAttributeTagsWithContent($htmlvalue)
    {
        $attributes = $htmlvalue->query('//@*[contains(.,"[")][contains(.,"]")]');
        $parser = $this;

        for ($i = 0; $i < $attributes->length; $i++) {
            $node = $attributes->item($i);
            $tags = $this->extractTags($node->nodeValue);
            $extra = array('node' => $node, 'element' => $node->ownerElement);

            if ($tags) {
                $node->nodeValue = $this->replaceTagsWithText(
                    htmlspecialchars($node->nodeValue),
                    $tags,
                    function ($idx, $tag) use ($parser, $extra) {
                        return $parser->getShortcodeReplacementText($tag, $extra, false);
                    }
                );
            }
        }
    }
1260638
protected function createValueFromInput( $inputValue )
    {
        if ( is_array( $inputValue ) )
        {
            foreach ( $inputValue as $index => $inputValueItem )
            {
                if ( !$inputValueItem instanceof Meta )
                {
                    throw new InvalidArgumentType(
                        '$inputValue[' . $index . ']',
                        "\\Novactive\\Bundle\\SEOBundle\\API\\Repository\\Values\\Metas\\Meta",
                        $inputValueItem
                    );
                }
            }
            $inputValue = new Value( $inputValue );
        }

        return $inputValue;
    }
1259572
public static function update($itemid, $newvalue) {
        global $DB;
        require_capability('moodle/tag:manage', context_system::instance());
        $tagarea = $DB->get_record('tag_area', array('id' => $itemid), '*', MUST_EXIST);
        $newvalue = $newvalue ? 1 : 0;
        $data = array('enabled' => $newvalue);
        \core_tag_area::update($tagarea, $data);
        $tagarea->enabled = $newvalue;
        $tmpl = new self($tagarea);
        return $tmpl;
    }
559409
public static function createRedirectFromPostValues($postValues)
    {
        if (isset($postValues['title'], $postValues['fromUrl'], $postValues['toUrl'])) {
            $redirectObject = new \stdClass();
            $redirectObject->title = $postValues['title'];
            $redirectObject->slug = StringUtil::slugify($postValues['title']);
            $redirectObject->fromUrl = $postValues['fromUrl'];
            $redirectObject->toUrl = $postValues['toUrl'];
            $redirectObject->type = $postValues['type'];

            return $redirectObject;
        } else {
            throw new \Exception('Trying to create valuelist with invalid data.');
        }
    }
744142
protected function _generateIdFromHeaderValue($headerValue) {		
		if (!is_callable($this->header_id_func)) {
			return "";
		}

		$idValue = call_user_func($this->header_id_func, $headerValue);
		if (!$idValue) {
			return "";
		}

		return ' id="' . $this->encodeAttribute($idValue) . '"';
	}
692228
public function widgetToValue($varValue, $itemId)
    {
        if (null === $varValue) {
            return null;
        }
        static $cache = [];
        $attributeId = $this->get('id');
        if (array_key_exists($attributeId, $cache) && array_key_exists($varValue, $cache[$attributeId])) {
            return $cache[$attributeId][$varValue];
        }

        $model = $this->getSelectMetaModel();
        $alias = $this->getIdColumn();

        if ($model->hasAttribute($alias)) {
            $attribute = $model->getAttribute($alias);
            // It is an attribute, we may search for it.
            $ids = $attribute->searchFor($varValue);
        } else {
            // Must be a system column then.
            $result = $this->connection->createQueryBuilder()
                ->select('v.id')
                ->from($this->getSelectSource(), 'v')
                ->where('v.' . $this->getIdColumn() . '=:value')
                ->setParameter('value', $varValue)
                ->execute();

            $ids = $result->fetchAll(\PDO::FETCH_COLUMN);
        }

        // Maybe deleted value?
        if ([] === $ids) {
            return $cache[$attributeId][$varValue] = null;
        }

        // Multiple results.
        if (null === $ids || \count($ids) > 1) {
            throw new \RuntimeException(
                \sprintf(
                    'Multiple values found for %s, are there obsolete values for %s.%s (att_id: %s)?',
                    \var_export($varValue, true),
                    $model->getTableName(),
                    $this->getColName(),
                    $this->get('id')
                )
            );
        }
        $valueId = \array_shift($ids);

        $value = $this->getValuesById(
            [$valueId],
            [$this->getAliasColumn(), $this->getValueColumn(), $this->getIdColumn(), $this->getSortingColumn()]
        );

        return $cache[$attributeId][$varValue] = $value[$valueId];
    }
109199
private static function getValueFromSymbol($stringValue): Suit
    {
        $values = array_values(static::$symbols);
        $key = array_search($stringValue, $values, true);

        return static::makeSuit($key + 100);
    }
859179
public static function parse(string $headerValue): self
    {
        $self = new self();
        foreach (explode(',', $headerValue) as $acceptable) {
            // seems to be impossible to parse acceptables with regular
            // expressions or even scanf(), so we do some string crunching here
            if (strstr($acceptable, 'q=') !== false) {
                list($acceptable, $priority) = explode('q=', trim($acceptable));
            } else {
                $priority = 1;
            }

            settype($priority, 'float');
            $acceptable = trim($acceptable);
            if (substr($acceptable, -1) === ';') {
                $acceptable = substr($acceptable, 0, -1);
            }

            $self->addAcceptable($acceptable, $priority);
        }

        return $self;
    }
1060210
public function deserialize($serializedValue)
    {
        if (null === $serializedValue && $this->isNullable()) {
            return null;
        }

        if (!is_string($serializedValue)) {
            throw InvalidArgumentException::expected('string', $serializedValue);
        }

        return new Association($this->schema, $this->typeSchema, ['id' => $serializedValue]);
    }