Dumps a value

@param string|int|bool|float|array|Datetime  $val The value

@return string
764608
protected function dumpValue($val) : string
    {
        switch (true) {
            case is_string($val):
                return $this->dumpString($val);
            case is_array($val):
                return $this->dumpArray($val);
            case is_int($val):
                return $this->dumpInteger($val);
            case is_float($val):
                return $this->dumpFloat($val);
            case is_bool($val):
                return $this->dumpBool($val);
            case $val instanceof \Datetime:
                return $this->dumpDatetime($val);
            default:
                throw new DumpException("Data type not supporter at the key: \"{$this->currentKey}\".");
        }
    }
118633
public function _dump($value)
    {
        $tests = array(
            'is_null' => '_dumpNull',
            'is_string' => '_dumpString',
            'is_bool' => '_dumpBoolean',
            'is_integer' => '_dumpInteger',
            'is_float' => '_dumpFloat',
            'is_array' => '_dumpArray',
            'is_object' => '_dumpObject'
        );
        
        foreach ($tests as $predicate => $outputMethod) {
            if (call_user_func($predicate, $value))
                return call_user_func(array(
                    $this,
                    $outputMethod
                ), $value);
        }
        
        return $this->_fallback->inspect($value);
    }
303656
public function dump($value) : string
    {
        if (! is_string($value))
            throw new DumpException($this, $value, self::ERROR);
        return $value;
    }
1107034
public function crudFormatValueDate($val, $args = [])
    {
        if (is_int($val)) {
            return date($args['format'] ?? 'd.m.Y', $val);
        } elseif ($val instanceof \Carbon\Carbon) {
            return $val->format($args['format'] ?? 'd.m.Y');
        }
    }
306643
public function parseOne($val)
    {
        if ($this->allowHtml() === false) {
            if (is_string($val)) {
                return strip_tags($val);
            }
        }

        return $val;
    }
24352
public static function dateEquals($val, $date): bool
    {
        if (!$val || (!$time = \strtotime($val))) {
            return false;
        }

        return $date ? $time === \strtotime((string)$date) : false;
    }
37152
public function storageVal($val)
    {
        if ($val === null) {
            // Do not json_encode NULL values
            return null;
        }

        if (!$this->l10n() && $val instanceof Translation) {
            $val = (string)$val;
        }

        if ($this->multiple()) {
            if (is_array($val)) {
                $val = implode($this->multipleSeparator(), $val);
            }
        }

        if (!is_scalar($val)) {
            return json_encode($val, JSON_UNESCAPED_UNICODE);
        }

        return $val;
    }
504928
public function setCreated($val)
	{
		if (($val instanceof \DateTime)) {
			$this->created = $val;
		}
		else if (is_string($val) && !empty($val)) {
			try {
				// There can be accidentaly exeption thrown whenever the given
				// string is not valid date.
				$this->created = new \DateTime($val);
			} catch(\Exception $e) {
				$this->created = null;
			}
		}
		else {
			$this->created = null;
		}

		return $this;
	}
79434
private function encodeValue($val, $base)
    {
        $this->preOpMethodParamsCheck(array($val, $base));

        $digits = $this->baseCheck($base);

        try {

            $new = '';

            while ($this->math->comp($val, '0') > 0) {
                $qq  = $this->math->div($val, $base);
                $rem = $this->math->mod($val, $base);
                $val = $qq;
                $new = $new . $digits[$rem];
            }

            return $new;

        } catch (\Exception $e) {
            throw $e;
        }
    }
471244
private function tobytes($val) {
		$val = trim($val);
		$last = fix_strtolower($val{strlen($val)-1});
		switch($last) {
			case 'g':
				$val *= 1024;
			case 'm':
				$val *= 1024;
			case 'k':
				$val *= 1024;
		}
		return $val;
	}
1048183
public static function raw2htmlname($val)
    {
        if (is_array($val)) {
            foreach ($val as $k => $v) {
                $val[$k] = self::raw2htmlname($v);
            }

            return $val;
        }

        return self::raw2att($val);
    }
671733
public static function isISODate($val)
    {
        if(!is_string($val)) {
            return false;
        }

        // Use DateTime support to check for valid dates.
        try
        {
            $date = new DateTime($val);
        }
        catch(Exception $e)
        {
            return false;
        }

        return true;
    }
779231
public function storageVal($val)
    {
        $mode = $this->storageMode();

        if ($mode === self::STORAGE_MODE_INT) {
            return $this->intVal($val);
        } else {
            return $this->stringVal($val);
        }
    }
752151
public static function getFormattedDateTime(\DateTime $val, string $format = \DateTime::ATOM): string
    {
        return StringHelper::dateFormat($val, $format);
    }
459862
public function _decode($val) {
		if (!is_string($val)) {
			return $val;
		}

		$decoded = json_decode($val, $this->_config['decodeParams']['assoc'], $this->_config['decodeParams']['depth'], $this->_config['decodeParams']['options']);

		if ($decoded === false) {
			return false;
		}
		if ($this->_config['decodeParams']['assoc']) {
			$decoded = (array)$decoded;
		}
		if ($this->_config['output'] === 'param') {
			$decoded = $this->_toParam($decoded);
		} elseif ($this->_config['output'] === 'list') {
			$decoded = $this->_toList($decoded);
		}
		return $decoded;
	}
1295009
public function convert($input)
    {
        if (!$input) {
            return;
        }

        if (!($input instanceof \DateTime)) {
            throw new UnexpectedValueException('Input must be DateTime object.');
        }

        return $input->format($this->outputFormat);
    }
1184205
public function inputVal($val, array $options = [])
    {
        $val = $this->dateTimeVal($val);

        if ($val instanceof DateTimeInterface) {
            return $val->format('Y-m-d H:i:s');
        } else {
            return '';
        }
    }