| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | trait CommonTrait |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Returns a new instance having set the parameter |
||
| 27 | * |
||
| 28 | * @param mixed $element |
||
| 29 | * @param string $property |
||
| 30 | * |
||
| 31 | * @return mixed |
||
| 32 | */ |
||
| 33 | protected function cloneInstance($element, string $property) |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Checks the element passed if it is a string |
||
| 43 | * |
||
| 44 | * @param mixed $element |
||
| 45 | */ |
||
| 46 | private function checkStringParameter($element): void |
||
| 47 | { |
||
| 48 | if (!is_string($element)) { |
||
| 49 | throw new InvalidArgumentException( |
||
| 50 | 'Method requires a string argument' |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Checks the element passed; assigns it to the property and returns a |
||
| 57 | * clone of the object back |
||
| 58 | * |
||
| 59 | * @param mixed $element |
||
| 60 | * @param string $property |
||
| 61 | * |
||
| 62 | * @return mixed |
||
| 63 | */ |
||
| 64 | private function processWith($element, string $property) |
||
| 69 | } |
||
| 70 | } |
||
| 71 |