Drest\Query\ExposeFields::filterRequestedExpose PHP Method

filterRequestedExpose() protected method

Filter out requested expose fields against what's allowed
protected filterRequestedExpose ( array &$requested, array &$actual )
$requested array - The requested expose definition - invalid / not allowed data is stripped off
$actual array - current allowed expose definition
    protected function filterRequestedExpose(&$requested, &$actual)
    {
        $actual = (array) $actual;
        foreach ($requested as $requestedKey => $requestedValue) {
            if (in_array($requestedValue, $actual)) {
                continue;
            }
            if (is_array($requestedValue)) {
                if (isset($actual[$requestedKey])) {
                    $this->filterRequestedExpose($requested[$requestedKey], $actual[$requestedKey]);
                    continue;
                }
            } else {
                if (isset($actual[$requestedValue]) && is_array($actual[$requestedValue]) && array_key_exists($requestedValue, $actual)) {
                    continue;
                }
            }
            unset($requested[$requestedKey]);
        }
    }