| Conditions | 1 |
| Paths | 1 |
| Total Lines | 117 |
| 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 |
||
| 44 | public function dataProvider() { |
||
| 45 | return [ |
||
| 46 | // Test default text field provided as simple text. |
||
| 47 | [ |
||
| 48 | 'DefaultHandler', |
||
| 49 | (object) ['field_text' => 'Text'], |
||
| 50 | 'node', |
||
| 51 | ['field_name' => 'field_text'], |
||
| 52 | ['en' => [['value' => 'Text']]], |
||
| 53 | ], |
||
| 54 | |||
| 55 | // Test default text field provided as array. |
||
| 56 | [ |
||
| 57 | 'DefaultHandler', |
||
| 58 | (object) ['field_text' => ['Text']], |
||
| 59 | 'node', |
||
| 60 | ['field_name' => 'field_text'], |
||
| 61 | ['en' => [['value' => 'Text']]], |
||
| 62 | ], |
||
| 63 | |||
| 64 | // Test default field handler using custom field columns. |
||
| 65 | [ |
||
| 66 | 'DefaultHandler', |
||
| 67 | (object) [ |
||
| 68 | 'field_addressfield' => [ |
||
| 69 | [ |
||
| 70 | 'country' => 'BE', |
||
| 71 | 'locality' => 'Brussels', |
||
| 72 | 'thoroughfare' => 'Grote Markt 1', |
||
| 73 | 'postal_code' => '1000', |
||
| 74 | ], |
||
| 75 | ], |
||
| 76 | ], |
||
| 77 | 'node', |
||
| 78 | ['field_name' => 'field_addressfield'], |
||
| 79 | [ |
||
| 80 | 'en' => [ |
||
| 81 | [ |
||
| 82 | 'country' => 'BE', |
||
| 83 | 'locality' => 'Brussels', |
||
| 84 | 'thoroughfare' => 'Grote Markt 1', |
||
| 85 | 'postal_code' => '1000', |
||
| 86 | ], |
||
| 87 | ], |
||
| 88 | ], |
||
| 89 | ], |
||
| 90 | |||
| 91 | // Test single-value date field provided as simple text. |
||
| 92 | [ |
||
| 93 | 'DatetimeHandler', |
||
| 94 | (object) ['field_date' => '2015-01-01 00:00:00'], |
||
| 95 | 'node', |
||
| 96 | ['field_name' => 'field_date'], |
||
| 97 | ['en' => [['value' => '2015-01-01 00:00:00']]], |
||
| 98 | ], |
||
| 99 | |||
| 100 | // Test single-value date field provided as an array. |
||
| 101 | [ |
||
| 102 | 'DatetimeHandler', |
||
| 103 | (object) ['field_date' => ['2015-01-01 00:00:00']], |
||
| 104 | 'node', |
||
| 105 | ['field_name' => 'field_date'], |
||
| 106 | ['en' => [['value' => '2015-01-01 00:00:00']]], |
||
| 107 | ], |
||
| 108 | |||
| 109 | // Test double-value date field. Can only be provided as an array |
||
| 110 | // due to array type casting we perform in |
||
| 111 | // \Drupal\Driver\Fields\Drupal7\AbstractFieldHandler::__call() |
||
| 112 | [ |
||
| 113 | 'DatetimeHandler', |
||
| 114 | (object) [ |
||
| 115 | 'field_date' => [ |
||
| 116 | [ |
||
| 117 | '2015-01-01 00:00:00', |
||
| 118 | '2015-01-02 00:00:00', |
||
| 119 | ], |
||
| 120 | ], |
||
| 121 | ], |
||
| 122 | 'node', |
||
| 123 | [ |
||
| 124 | 'field_name' => 'field_date', |
||
| 125 | 'columns' => ['value' => '', 'value2' => ''], |
||
| 126 | ], |
||
| 127 | [ |
||
| 128 | 'en' => [ |
||
| 129 | [ |
||
| 130 | 'value' => '2015-01-01 00:00:00', |
||
| 131 | 'value2' => '2015-01-02 00:00:00', |
||
| 132 | ], |
||
| 133 | ], |
||
| 134 | ], |
||
| 135 | ], |
||
| 136 | |||
| 137 | // Test list boolean field with blank 'On' and 'Off' values. |
||
| 138 | [ |
||
| 139 | 'ListBooleanHandler', |
||
| 140 | (object) ['field_list_boolean' => [0]], |
||
| 141 | 'node', |
||
| 142 | [ |
||
| 143 | 'field_name' => 'field_list_boolean', |
||
| 144 | 'settings' => [ |
||
| 145 | 'allowed_values' => [ |
||
| 146 | 0 => '', |
||
| 147 | 1 => '', |
||
| 148 | ], |
||
| 149 | ], |
||
| 150 | ], |
||
| 151 | [ |
||
| 152 | 'en' => [ |
||
| 153 | [ |
||
| 154 | 'value' => 0, |
||
| 155 | ], |
||
| 156 | ], |
||
| 157 | ], |
||
| 158 | ], |
||
| 159 | ]; |
||
| 160 | } |
||
| 161 | |||
| 163 |
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.