| Conditions | 11 | 
| Paths | 18 | 
| Total Lines | 29 | 
| Code Lines | 22 | 
| 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  | 
            ||
| 25 | public function __invoke($attribute, $value, $fail)  | 
            ||
| 26 |     { | 
            ||
| 27 | $causationFieldValue = data_get($this->data, $this->conditional['field']);  | 
            ||
| 28 | |||
| 29 | $condition = $this->conditional['condition'];  | 
            ||
| 30 | $operator = $this->conditional['operator'];  | 
            ||
| 31 | |||
| 32 | $fieldIsRequired = false;  | 
            ||
| 33 | |||
| 34 | 	    if ($operator === '>') { | 
            ||
| 35 | $fieldIsRequired = $causationFieldValue > $condition;  | 
            ||
| 36 | 	    } else if ($operator === '<') { | 
            ||
| 37 | $fieldIsRequired = $causationFieldValue < $condition;  | 
            ||
| 38 | 	    } else if ($operator === '==') { | 
            ||
| 39 | $fieldIsRequired = $causationFieldValue == $condition;  | 
            ||
| 40 | 	    }  else if ($operator === '===') { | 
            ||
| 41 | $fieldIsRequired = $causationFieldValue === $condition;  | 
            ||
| 42 | 	    } else if ($operator === '!=') { | 
            ||
| 43 | $fieldIsRequired = $causationFieldValue != $condition;  | 
            ||
| 44 | 	    }  else if ($operator === '!==') { | 
            ||
| 45 | $fieldIsRequired = $causationFieldValue !== $condition;  | 
            ||
| 46 | 	    } else if ($operator === '>=') { | 
            ||
| 47 | $fieldIsRequired = $causationFieldValue >= $condition;  | 
            ||
| 48 | 	    } else if ($operator === '<=') { | 
            ||
| 49 | $fieldIsRequired = $causationFieldValue <= $condition;  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 52 | 	    if ($fieldIsRequired && !$value) { | 
            ||
| 53 | 		    $fail('This field is required.'); | 
            ||
| 54 | }  | 
            ||
| 80 |