| Total Lines | 69 |
| Code Lines | 40 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 declare(strict_types=1); |
||
| 73 | public function testValue($column, $value) |
||
| 74 | { |
||
| 75 | $object = $this->valueTraitClass->value($column, $value); |
||
| 76 | $this->assertObjectUsesTrait(ValueTrait::class, $object); |
||
| 77 | |||
| 78 | $this->assertEquals( |
||
| 79 | \array_merge( |
||
| 80 | static::VALUE_DEFAULT, |
||
| 81 | \array_reduce( |
||
| 82 | \array_map( |
||
| 83 | function ($column) { |
||
| 84 | return [ |
||
| 85 | $column => \sprintf( |
||
| 86 | ':%s_Value', |
||
| 87 | \implode( |
||
| 88 | '_', |
||
| 89 | \array_map( |
||
| 90 | function ($columnPart) { |
||
| 91 | return \mb_convert_case($columnPart, MB_CASE_TITLE); |
||
| 92 | }, |
||
| 93 | \explode('.', $column) |
||
| 94 | ) |
||
| 95 | ) |
||
| 96 | ), |
||
| 97 | ]; |
||
| 98 | }, |
||
| 99 | [ |
||
| 100 | $column |
||
| 101 | ] |
||
| 102 | ), |
||
| 103 | 'array_merge', |
||
| 104 | [] |
||
| 105 | ) |
||
| 106 | ), |
||
| 107 | $this->valueTraitClass->valueData() |
||
|
|
|||
| 108 | ); |
||
| 109 | $this->assertEquals( |
||
| 110 | \array_merge( |
||
| 111 | static::VALUE_BIND_DEFAULT, |
||
| 112 | \array_reduce( |
||
| 113 | \array_map( |
||
| 114 | function ($column, $value) { |
||
| 115 | return [ |
||
| 116 | \sprintf( |
||
| 117 | '%s_Value', |
||
| 118 | \implode( |
||
| 119 | '_', |
||
| 120 | \array_map( |
||
| 121 | function ($columnPart) { |
||
| 122 | return \mb_convert_case($columnPart, MB_CASE_TITLE); |
||
| 123 | }, |
||
| 124 | \explode('.', $column) |
||
| 125 | ) |
||
| 126 | ) |
||
| 127 | ) => $value, |
||
| 128 | ]; |
||
| 129 | }, |
||
| 130 | [ |
||
| 131 | $column |
||
| 132 | ], |
||
| 133 | [ |
||
| 134 | $value |
||
| 135 | ] |
||
| 136 | ), |
||
| 137 | 'array_merge', |
||
| 138 | [] |
||
| 139 | ) |
||
| 140 | ), |
||
| 141 | $this->valueTraitClass->bindValueData() |
||
| 142 | ); |
||
| 239 |
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.