protected function reduceRelations(&$resource, array $relationNames)
    {
        $keep = [];
        $keepName = [];
        $totalReduced = 0;
        foreach ($resource->relations as $relation) {

            if (in_array($relation->getName(), $relationNames) || in_array($relation->getName(), $keepName)) {
                $totalReduced++;
                continue;
            }

            $keep[] = $relation;
            $keepName[] = $relation->getName();
        }

        $resource->relations = $keep;

        return $totalReduced;
    }
protected function reduceRelations(&$resource, array $relationNames)
    {
        $keep = [];
        $keepName = [];
        $totalReduced = 0;
        foreach ($resource->relations as $relation) {

            if (in_array($relation->getName(), $relationNames) || in_array($relation->getName(), $keepName)) {
                $totalReduced++;
                continue;
            }

            $keep[] = $relation;
            $keepName[] = $relation->getName();
        }

        $resource->relations = $keep;

        return $totalReduced;
    }
protected function reduceRelations ( & $ resource , array $ relationNames ) { $ keep = [ ] ; $ keepName = [ ] ; $ totalReduced = 0 ; foreach ( $ resource -> relations as $ relation ) { if ( in_array ( $ relation -> getName ( ) , $ relationNames ) || in_array ( $ relation -> getName ( ) , $ keepName ) ) { $ totalReduced ++ ; continue ; } $ keep [ ] = $ relation ; $ keepName [ ] = $ relation -> getName ( ) ; } $ resource -> relations = $ keep ; return $ totalReduced ; }
Reduces the relations from a given resource.

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

@return mixed
Reduces the relations from a given resource .