| Conditions | 10 |
| Paths | 8 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 83 | public function removeAcl(string $roleName = null, string $resourceName = null, string $permissionName = null) { |
||
| 84 | $toRemove = []; |
||
| 85 | foreach ($this->acls as $index => $acl) { |
||
| 86 | if (($resourceName == null || $acl->getResource()->getName() === $resourceName) && ($roleName == null || $acl->getRole()->getName() === $roleName) && ($permissionName == null || $acl->getPermission()->getName() === $permissionName)) { |
||
|
3 ignored issues
–
show
|
|||
| 87 | foreach ($this->providers as $provider) { |
||
| 88 | $provider->removeAcl($acl); |
||
| 89 | } |
||
| 90 | $toRemove[] = $index; |
||
| 91 | } |
||
| 92 | } |
||
| 93 | foreach ($toRemove as $remove) { |
||
| 94 | unset($this->acls[$remove]); |
||
| 95 | } |
||
| 107 |