Airship\Engine\Security\Filter\WhiteList::process PHP Method

process() public method

Process data using the filter rules.
public process ( mixed $data = null ) : mixed
$data mixed
return mixed
    public function process($data = null)
    {
        if (!empty($this->allowedValues)) {
            if (!\in_array($data, $this->allowedValues)) {
                $data = null;
            }
        }
        $data = $this->applyCallbacks($data, 0);
        if ($data === null) {
            $data = $this->default;
        }
        // For type strictness:
        switch ($this->type) {
            case 'bool':
                return (bool) $data;
            case 'float':
                return (double) $data;
            case 'int':
                return (int) $data;
            case 'string':
                return (string) $data;
            default:
                return $data;
        }
    }