Returns a (de)serializable representation of the internal value. The
returned format MUST be acceptable as a new value on the valueholder
to reconstitute it.

@return mixed value that can be used for serializing/deserializing
543441
public function toNative()
    {
        if ($this->valueEquals($this->getAttribute()->getNullValue())) {
            return [];
        }

        $entities = [];

        foreach ($this->getValue() as $entity) {
            $entities[] = $entity->toNative();
        }

        return $entities;
    }
265231
public function toValue() {
    $ret = array();
    foreach ($this->elements->getItems() as $element) {
      if ($element instanceof ArrayNode) {
        $ref[] = $element->toValue();
      }
      elseif ($element instanceof ArrayPairNode) {
        $key = $element->getKey();
        $value = $element->getValue();
        $value_convertable = $value instanceof ScalarNode || $value instanceof ArrayNode;
        if (!($key instanceof ScalarNode && $value_convertable)) {
          throw new \BadMethodCallException('Can only convert scalar arrays.');
        }
        $ret[$key->toValue()] = $value->toValue();
      }
      elseif ($element instanceof ScalarNode || $element instanceof ArrayNode) {
        /** @var ScalarNode|ArrayNode $element */
        $ret[] = $element->toValue();
      }
      else {
        throw new \BadMethodCallException('Can only convert scalar arrays.');
      }
    }
    return $ret;
  }
680007
public function serialize($value)
    {
        $this->reset();

        return $this->serializationStrategy->serialize($this->serializeData($value));
    }
1219407
public function deserialize(): object
    {
        $this->buffer->position($this->assetOffset / 2);

        $this->transaction->amount = $this->buffer->readUInt64();
        $this->transaction->expiration = $this->buffer->readUInt32();
        $this->transaction->recipientId = Base58::encodeCheck(new Buffer(hex2bin($this->buffer->readHex(21))));

        return $this->parseSignatures($this->assetOffset + (8 + 4 + 21) * 2);
    }
419922
public function toBinary()
    {
        $bytes = '';

        foreach (str_split($this->value, 8) as $piece) {
            $bytes .= chr(bindec($piece));
        }

        return $bytes;
    }
246024
public function serialize()
    {
        try {
            $this->data = $this->data ?: Serializer::getData($this->closure, true);

            return Serialize::encode($this->data, Serializer::getSerializeType());
        } catch (\Exception $e) {
            \trigger_error('Serialization of closure failed: ' . $e->getMessage());
            // Note: The serialize() method of Serializable must return a string
            // or null and cannot throw exceptions.
            return null;
        }
    }
702298
public function deserialize(): object
    {
        $this->buffer->position($this->assetOffset / 2);

        $voteLength = $this->buffer->readUInt8() & 0xff;

        $this->transaction->asset = ['votes' => []];

        $vote = null;
        for ($i = 0; $i < $voteLength; $i++) {
            $this->buffer->position($this->assetOffset + 2 + $i * 2 * 34);

            $vote = $this->buffer->readHexRaw(34 * 2);
            $vote = ('1' === $vote[1] ? '+' : '-').substr($vote, 2);
            $this->transaction->asset['votes'][] = $vote;
        }

        return $this->parseSignatures($this->assetOffset + 2 + $voteLength * 34 * 2);
    }
1232059
public function value()
    {
        $escape = isset($this->default["escape-values"])
            ? $this->default["escape-values"]
            : true;

        return $escape
            ? $this->getEscapedValue()
            : $this->getRawValue();
    }
337131
public function serialize()
    {
        $tz = $this->getTimezone();
        if ($tz && in_array($tz->getName(), timezone_identifiers_list())) {
            $strTz = $tz->getName();
            $strDate = parent::format('Y-m-d H:i:s');
        } else {
            $strTz = null;
            $strDate = parent::format(QDateTime::ISO8601);
        }
        return serialize([
            1, // version number of serialized data, in case format changes
            $this->blnDateNull,
            $this->blnTimeNull,
            $strDate,
            $strTz
        ]);
    }
875109
public function toBinary()
    {
        $name = bin2hex($this->name);

        $binValue = $this->getEncodedValueForProp($this->name, $this->value);

        $valueLen = strlen(bin2hex($binValue)) / 3;

        $binary = hex2bin(
            $this->dec2hex(strlen($name))
            .$this->dec2hex($valueLen)
            .$this->dec2hex($this->valueType)
            .$name
        );

        return $binary.$binValue;
    }
797411
public function getValue(): string
    {
        if (!$this->validated && $this->defaultValue !== null) {
            return $this->defaultValue;
        }

        if ($this->value === null) {
            return '';
        }

        return $this->value;
    }
940823
public function decodeString()
    {
        $len = $this->decodeUint32();
        if ($len === null) {
            return null;
        }
        $value = $this->decodeBytes($len);
        if ($value === null) {
            $this->buffer->unget(pack('N', $len));
            return null;
        }
        return $value;
    }
120865
protected function serializeValue($value)
    {
        if (is_string($value)) {
            return $value;
        }
        if (is_object($value) || is_array($value)) {
            return json_encode($value);
        }
    }
429761
public function raw()
	{
		// unpack
		$raw = [];
		foreach ($this->info as $key => $info)
		{
			if (is_array($info))
			{
				$info = $this->unpack($info);
			}
			// check if it's just a single object
			if ($info instanceof AbstractDto)
			{
				$info = $info->raw();
			}
			// set the raw value
			$raw[$key] = $info;
		}

		return $raw;
	}
1065767
public function getFilteredValue()
    {

        $value = parent::getFilteredValue();
        if (!empty($value)) {
            try {
                $date = substr($value, 0, strlen(date($this->getFormatDisplay())));
                $value = \Carbon\Carbon::createFromFormat($this->getFormatDisplay(), $date);
            } catch (\InvalidArgumentException $e) {

                try {
                    $date = substr($value, 0, strlen(date($this->getFormatStore())));
                    $value = \Carbon\Carbon::createFromFormat($this->getFormatStore(), $date);
                } catch (\InvalidArgumentException $e) {
                    throw $e;
                }

            } finally {
                $value = $value instanceof \Carbon\Carbon ? $value->format($this->getFormatStore()) : '';
            }
        }

       return $value;
    }
76741
public function value()
    {
        $value = lego_default($this->getOriginalValue(), $this->default);
        foreach ($this->pipes as $pipe) {
            $value = $pipe->handle($value, $this->data, $this);
        }

        return new HtmlString((string) $value);
    }
44732
public function toHeaderValue()
    {
        $value = $this->value;
        if ($this->isExpanded) {
            $value = $this->_flatten($this->value);
        }
        $headerValue[] = sprintf('%s=%s', $this->name, rawurlencode($value));

        if ($this->expiresAt) {
            $headerValue[] = sprintf('expires=%s', $this->getFormattedExpires());
        }
        if ($this->path !== '') {
            $headerValue[] = sprintf('path=%s', $this->path);
        }
        if ($this->domain !== '') {
            $headerValue[] = sprintf('domain=%s', $this->domain);
        }
        if ($this->secure) {
            $headerValue[] = 'secure';
        }
        if ($this->httpOnly) {
            $headerValue[] = 'httponly';
        }

        return implode('; ', $headerValue);
    }