| Conditions | 10 |
| Paths | 8 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
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 namespace Distilleries\PermissionUtil\Helpers; |
||
| 44 | public function hasAccessArray($arrayKeys, $isAndRelation = false, $child = null) { |
||
| 45 | $hasAccess = null; |
||
| 46 | foreach ($arrayKeys as $key) { |
||
| 47 | if ($hasAccess == null) { |
||
| 48 | $hasAccess = $this->hasAccess(($child == null ? $key : $key[$child])); |
||
| 49 | } else { |
||
| 50 | if ($isAndRelation) { |
||
| 51 | $hasAccess = $hasAccess && $this->hasAccess(($child == null ? $key : $key[$child])); |
||
| 52 | if (!$hasAccess) break; |
||
| 53 | } else { |
||
| 54 | $hasAccess = $hasAccess || $this->hasAccess(($child == null ? $key : $key[$child])); |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | return $hasAccess; |
||
| 59 | } |
||
| 60 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.