| Conditions | 10 |
| Paths | 144 |
| Total Lines | 43 |
| Code Lines | 34 |
| 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 |
||
| 48 | $this->loadCacheList(); |
||
| 49 | $key = array_search($apiValue, $this->cacheList); |
||
| 50 | return $key ?? ''; |
||
| 51 | } |
||
| 52 | |||
| 53 | /** {@inheritdoc} */ |
||
| 54 | public function getApiValue($yfValue, array $field) |
||
| 55 | { |
||
| 56 | $this->loadCacheList(); |
||
| 57 | if ($value = $this->cacheList[$yfValue] ?? null) { |
||
| 58 | return $value; |
||
| 59 | } |
||
| 60 | if ($value = $this->cacheList[\App\Language::translate($yfValue, 'Accounts', 'pl-PL')] ?? null) { |
||
| 61 | return $value; |
||
| 62 | } |
||
| 63 | return null; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * Get picklist values. |
||
| 68 | * |
||
| 69 | * @return array |
||
| 70 | */ |
||
| 71 | private function getPicklistValues(): array |
||
|
|
|||
| 72 | { |
||
| 73 | $picklistValues = \App\Fields\Picklist::getValues($this->fieldModel->getName()); |
||
| 74 | $values = []; |
||
| 75 | foreach ($picklistValues as $value) { |
||
| 76 | $values[mb_strtolower($value['picklistValue'])] = $value['picklistValue']; |
||
| 77 | $values[mb_strtolower(\App\Language::translate( |
||
| 78 | $value['picklistValue'], |
||
| 79 | 'Accounts', |
||
| 80 | 'pl-PL' |
||
| 81 | ))] = $value['picklistValue']; |
||
| 82 | } |
||
| 83 | if (\in_array('Przelew', array_column($this->cache, 'kon_Wartosc')) && isset($values['pll_transfer'])) { |
||
| 84 | $values['przelew'] = $values['pll_transfer']; |
||
| 85 | } |
||
| 86 | return $values; |
||
| 87 | } |
||
| 88 | |||
| 89 | /** |
||
| 90 | * Get all account type from API. |
||
| 91 | * |
||
| 124 |
This check looks for private methods that have been defined, but are not used inside the class.