This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
The property $validateComponent is declared private in Itstructure\RbacModule\controllers\BaseController. Since you implemented __set(), maybe consider adding a @property or @property-write annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter _set, this function will be called for any write access on an
undefined variable. You can add the @property annotation to your class or interface to document
the existence of this variable.
<?php/** * @property int $x * @property int $y * @property string $text */classMyLabel{private$properties;private$allowedProperties=array('x','y','text');publicfunction__get($name){if(isset($properties[$name])&&in_array($name,$this->allowedProperties)){return$properties[$name];}else{returnnull;}}publicfunction__set($name,$value){if(in_array($name,$this->allowedProperties)){$properties[$name]=$value;}else{thrownew\LogicException("Property $name is not defined.");}}}
Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
The property $validateComponent is declared private in Itstructure\RbacModule\controllers\BaseController. Since you implemented __get(), maybe consider adding a @property or @property-read annotation. This makes it easier for IDEs to provide auto-completion.
Since your code implements the magic setter _set, this function will be called for any write access on an
undefined variable. You can add the @property annotation to your class or interface to document
the existence of this variable.
<?php/** * @property int $x * @property int $y * @property string $text */classMyLabel{private$properties;private$allowedProperties=array('x','y','text');publicfunction__get($name){if(isset($properties[$name])&&in_array($name,$this->allowedProperties)){return$properties[$name];}else{returnnull;}}publicfunction__set($name,$value){if(in_array($name,$this->allowedProperties)){$properties[$name]=$value;}else{thrownew\LogicException("Property $name is not defined.");}}}
Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.