src/Manager/PolicyRuleManager.php
public function processRuleAttributes(array $attributes, $user, $resource)
    {
        foreach ($attributes as $attributeName => $attribute) {
            $pra = (new PolicyRuleAttribute())
                ->setAttribute($this->attributeManager->getAttribute($attributeName))
                ->setComparison($attribute['comparison'])
                ->setComparisonType($attribute['comparison_type'])
                ->setValue((isset($attribute['value'])) ? $attribute['value'] : null)
                ->setGetterParams(isset($attribute[ 'getter_params' ]) ? $attribute[ 'getter_params' ] : []);
            $this->processRuleAttributeComparisonType($pra, $user, $resource);
            // In the case the user configured more keys than the basic ones
            // it will be stored as extra data
            foreach ($attribute as $key => $value) {
                if (!in_array($key, ['comparison', 'comparison_type', 'value','getter_params'])) {
                    $pra->addExtraData($key, $value);
                }
            }
            // This generator avoid useless memory consumption instead of returning a whole array
            yield $pra;
        }
    }
public function processRuleAttributes(array $attributes, $user, $resource)
    {
        foreach ($attributes as $attributeName => $attribute) {
            $pra = (new PolicyRuleAttribute())
                ->setAttribute($this->attributeManager->getAttribute($attributeName))
                ->setComparison($attribute['comparison'])
                ->setComparisonType($attribute['comparison_type'])
                ->setValue((isset($attribute['value'])) ? $attribute['value'] : null)
                ->setGetterParams(isset($attribute[ 'getter_params' ]) ? $attribute[ 'getter_params' ] : []);
            $this->processRuleAttributeComparisonType($pra, $user, $resource);
            // In the case the user configured more keys than the basic ones
            // it will be stored as extra data
            foreach ($attribute as $key => $value) {
                if (!in_array($key, ['comparison', 'comparison_type', 'value','getter_params'])) {
                    $pra->addExtraData($key, $value);
                }
            }
            // This generator avoid useless memory consumption instead of returning a whole array
            yield $pra;
        }
    }
public function processRuleAttributes ( array $ attributes , $ user , $ resource ) { foreach ( $ attributes as $ attributeName => $ attribute ) { $ pra = ( new PolicyRuleAttribute ( ) ) -> setAttribute ( $ this -> attributeManager -> getAttribute ( $ attributeName ) ) -> setComparison ( $ attribute [ 'comparison' ] ) -> setComparisonType ( $ attribute [ 'comparison_type' ] ) -> setValue ( ( isset ( $ attribute [ 'value' ] ) ) ? $ attribute [ 'value' ] : null ) -> setGetterParams ( isset ( $ attribute [ 'getter_params' ] ) ? $ attribute [ 'getter_params' ] : [ ] ) ; $ this -> processRuleAttributeComparisonType ( $ pra , $ user , $ resource ) ; // In the case the user configured more keys than the basic ones // it will be stored as extra data foreach ( $ attribute as $ key => $ value ) { if ( ! in_array ( $ key , [ 'comparison' , 'comparison_type' , 'value' , 'getter_params' ] ) ) { $ pra -> addExtraData ( $ key , $ value ) ; } } // This generator avoid useless memory consumption instead of returning a whole array yield $ pra ; } }
This method is meant to convert attribute data from array to formatted policy rule attribute
This method is meant to convert attribute data from array to formatted policy rule attribute