Neomerx\JsonApi\Http\Query\RestrictiveQueryChecker::isFieldsAllowed PHP Method

isFieldsAllowed() private method

Check input fields against allowed.
private isFieldsAllowed ( array $fields = null ) : boolean
$fields array
return boolean
    private function isFieldsAllowed(array $fields = null)
    {
        if ($this->fieldSetTypes === null || $fields === null) {
            return true;
        }
        foreach ($fields as $type => $requestedFields) {
            if (array_key_exists($type, $this->fieldSetTypes) === false) {
                return false;
            }
            $allowedFields = $this->fieldSetTypes[$type];
            // if not all fields are allowed and requested more fields than allowed
            if ($allowedFields !== null && empty(array_diff($requestedFields, $allowedFields)) === false) {
                return false;
            }
        }
        return true;
    }