protected function reduceFields(&$resource, array $fieldNames)
    {
        $keep = [];
        $totalReduced = 0;
        foreach ($resource->fields as $field) {
            if (in_array($field->name, $fieldNames) || in_array($field->name, $keep)) {
                $totalReduced++;
                continue;
            }

            $keep[] = $field;
        }

        $resource->fields = $keep;

        return $totalReduced;
    }
protected function reduceFields(&$resource, array $fieldNames)
    {
        $keep = [];
        $totalReduced = 0;
        foreach ($resource->fields as $field) {
            if (in_array($field->name, $fieldNames) || in_array($field->name, $keep)) {
                $totalReduced++;
                continue;
            }

            $keep[] = $field;
        }

        $resource->fields = $keep;

        return $totalReduced;
    }
protected function reduceFields ( & $ resource , array $ fieldNames ) { $ keep = [ ] ; $ totalReduced = 0 ; foreach ( $ resource -> fields as $ field ) { if ( in_array ( $ field -> name , $ fieldNames ) || in_array ( $ field -> name , $ keep ) ) { $ totalReduced ++ ; continue ; } $ keep [ ] = $ field ; } $ resource -> fields = $ keep ; return $ totalReduced ; }
Reduces the fields from a given resource.

@param CrestApps\CodeGenerator\Models\Resource &$resource
@param array $$fieldNames

@return mixed
Reduces the fields from a given resource .