src/Ease/Page.php
public static function sanitizeAsType($value, $sanitizeAs)
    {
        $sanitized = null;
        switch ($sanitizeAs) {
            case 'string':
                $sanitized = (string) $value;
                break;
            case 'int':
                $sanitized = strlen($value) ? (int) $value : null;
                break;
            case 'float':
                $sanitized = (float) $value;
                break;
            case 'bool':
            case 'boolean':
                switch ($value) {
                    case 'FALSE':
                    case 'false':
                        $sanitized = false;
                        break;
                    case 'true':
                    case 'TRUE':
                        $sanitized = true;
                        break;
                    default:
                        $sanitized = boolval($value);
                        break;
                }
                break;
            case 'null':
            default:
                $sanitized = $value;
                break;
        }

        return $sanitized;
    }
public static function sanitizeAsType($value, $sanitizeAs)
    {
        $sanitized = null;
        switch ($sanitizeAs) {
            case 'string':
                $sanitized = (string) $value;
                break;
            case 'int':
                $sanitized = strlen($value) ? (int) $value : null;
                break;
            case 'float':
                $sanitized = (float) $value;
                break;
            case 'bool':
            case 'boolean':
                switch ($value) {
                    case 'FALSE':
                    case 'false':
                        $sanitized = false;
                        break;
                    case 'true':
                    case 'TRUE':
                        $sanitized = true;
                        break;
                    default:
                        $sanitized = boolval($value);
                        break;
                }
                break;
            case 'null':
            default:
                $sanitized = $value;
                break;
        }

        return $sanitized;
    }
Ošetří proměnou podle jejího očekávaného typu.

@param mixed  $value      hodnota
@param string $sanitizeAs typ hodnoty int|string|float|null

@return mixed