Get the IP value in the suitable format for storage.

@param mixed $val The value to convert to string.
@see StorablePropertyTrait::storageVal()
@return string
779231
public function storageVal($val)
    {
        $mode = $this->storageMode();

        if ($mode === self::STORAGE_MODE_INT) {
            return $this->intVal($val);
        } else {
            return $this->stringVal($val);
        }
    }
93878
private static function contextValueToString($val)
    {

        if (is_bool($val)) {
            return var_export($val, true);

        } elseif (is_scalar($val)) {
            return (string)$val;

        } elseif (is_null($val)) {
            return 'NULL';

        } elseif (is_object($val)) {
            if (is_callable(array($val, '__toString'))) {
                return (string)$val;
            }
            return get_class($val);
        }
        return gettype($val);
    }
252967
private function _wrap($val) {
    if(isset($this) && isset($this->_chained) && $this->_chained) {
      $this->_wrapped = $val;
      return $this;
    }
    return $val;
  }
1061973
protected function Promote( $val )
	{
		if ( ! $val instanceof ValueProxy ) throw new \InvalidArgumentException();
		return new IntProxy( Convert::ToInt32( $val->getValue() ) );
	}
308796
protected function Sub( $val )
	{
		if ( ! $val instanceof ByteProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value - $val->_value );
	}
561953
public function val($val = null) {
		$val = (int) $val;
		if ($val) {
			if (is_numeric($val) && is_int($val*1)) {
				if (in_array($this->sources[$val],$this->sources)) {
					$this->val = $val;
					return $this->val;
				}
			} else {
				throw new \SimplOn\DataValidationException($this->valudationNaN);
			}
		} else {
			return $this->val;
		}
	}
306643
public function parseOne($val)
    {
        if ($this->allowHtml() === false) {
            if (is_string($val)) {
                return strip_tags($val);
            }
        }

        return $val;
    }
291697
protected function booleanValue($val)
    {
        if (is_numeric($val)) {
            return (bool) $val;
        } else {
            return (in_array(strtolower($val), array('true', 't', 'y', 'yes'), true) ? true : false);
        }
    }
947836
public static function integer($val)
    {
        if (\is_array($val)) {
            return \array_map(self::class . '::integer', $val);
        }

        return (int)\filter_var($val, \FILTER_SANITIZE_NUMBER_INT);
    }
5944
public static function fromCode($val)
    {
        $val = strtoupper($val);
        if (array_key_exists($val, self::$_languages)) {
            return self::$_languages[$val];
        }
        return null;
    }
1288875
private function getBytes(string $val) : int
    {
        $val = trim($val);
        $last = strtolower($val[strlen($val) - 1]);
        $val = (int) substr($val, 0, -1);

        switch ($last) {
            // The 'G' modifier is available since PHP 5.1.0
            case 'g':
                $val *= 1024 * 1024 * 1024;
                break;
            case 'm':
                $val *= 1024 * 1024;
                break;
            case 'k':
                $val *= 1024;
                break;
        }

        return $val;
    }
1370936
public function crudFormatValueTruncate($val, $args = [])
    {
        $val = strip_tags($val);
        if (! empty($args['length'])) {
            if (mb_strlen($val) > $args['length']) {
                $val = mb_substr($val, 0, $args['length']).'...';
            }
        }

        return $val;
    }
846478
protected function validateCastValue($val)
    {
        try {
            $val = (string) $val;
        } catch (\Exception $e) {
            $val = json_encode($val);
        }
        switch ($this->format()) {
            case 'email':
                if (strpos($val, '@') === false) {
                    throw $this->getValidationException('value is not a valid email', $val);
                }
                break;
            case 'uri':
                if (filter_var($val, FILTER_VALIDATE_URL) === false) {
                    throw $this->getValidationException(null, $val);
                }
                break;
            case 'binary':
                $decoded = base64_decode($val, true);
                if ($decoded === false) {
                    throw $this->getValidationException(null, $val);
                }
                break;
        }

        return $val;
    }
1157770
protected function Sub( $val )
	{
		if ( ! $val instanceof ValueProxy ) throw new \InvalidArgumentException();
		return new IntProxy( $this->_value - $val->getValue() );
	}
690518
function getValueCount( $val )
    {
        $val_cnt = false;

        if ( $val === null )
        {
            $val_cnt = 0;
        }
        else if ( $val === true || $val === false )
        {
            $val_cnt = (int)$val;
        }
        else if ( is_array( $val ) )
        {
            $val_cnt = count( $val );
        }
        else if ( is_object( $val ) and
                  method_exists( $val, "attributes" ) )
        {
            $val_cnt = count( $val->attributes() );
        }
        else if ( is_numeric( $val ) )
        {
            $val_cnt = $val;
        }
        else if ( is_string( $val ) )
        {
            $val_cnt = strlen( $val );
        }
        return $val_cnt;
    }
639601
public function setQuotedPrintableValue($val)
    {
        $val = quoted_printable_decode($val);

        // Quoted printable only appears in vCard 2.1, and the only character
        // that may be escaped there is ;. So we are simply splitting on just
        // that.
        //
        // We also don't have to unescape \\, so all we need to look for is a ;
        // that's not preceeded with a \.
        $regex = '# (?<!\\\\) ; #x';
        $matches = preg_split($regex, $val);
        $this->setValue($matches);
    }
885975
public function getUserValue($val)
    {
        if ('' == $val) {
            return '';
        }

        if ($val instanceof PhpDateTime) {
            $date = $val;
            $date->setTimezone(new DateTimeZone($this->getSourceTimezone()));
            $date->setTimezone(new DateTimeZone($this->getOutputTimezone()));
        } else {
            $date = PhpDateTime::createFromFormat(
                $this->getSourceDateTimeFormat(),
                $val,
                new DateTimeZone($this->getSourceTimezone())
            );
            if (false === $date) {
                return '';
            }
            $date->setTimezone(new DateTimeZone($this->getOutputTimezone()));
        }
        $formatter = new IntlDateFormatter(
            $this->getLocale(),
            $this->getOutputDateType(),
            $this->getOutputTimeType(),
            $this->getOutputTimezone(),
            IntlDateFormatter::GREGORIAN,
            $this->getOutputPattern()
        );

        return $formatter->format($date->getTimestamp());
    }