| Conditions | 1 |
| Paths | 1 |
| Total Lines | 110 |
| Code Lines | 83 |
| 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 |
||
| 29 | public function getSaveAttributes() : array |
||
| 30 | { |
||
| 31 | $prefix = $this->prefix(); |
||
| 32 | |||
| 33 | return array_replace( parent::getSaveAttributes(), $this->createAttributes( [ |
||
| 34 | $prefix . 'parentid' => [ |
||
| 35 | 'label' => 'Address parent ID', |
||
| 36 | 'internalcode' => 'parentid', |
||
| 37 | 'type' => 'int', |
||
| 38 | 'public' => false, |
||
| 39 | ], |
||
| 40 | $prefix . 'type' => [ |
||
| 41 | 'label' => 'Address type', |
||
| 42 | 'internalcode' => 'type', |
||
| 43 | ], |
||
| 44 | $prefix . 'company' => [ |
||
| 45 | 'label' => 'Address company', |
||
| 46 | 'internalcode' => 'company', |
||
| 47 | ], |
||
| 48 | $prefix . 'vatid' => [ |
||
| 49 | 'label' => 'Address Vat ID', |
||
| 50 | 'internalcode' => 'vatid', |
||
| 51 | ], |
||
| 52 | $prefix . 'salutation' => [ |
||
| 53 | 'label' => 'Address salutation', |
||
| 54 | 'internalcode' => 'salutation', |
||
| 55 | ], |
||
| 56 | $prefix . 'title' => [ |
||
| 57 | 'label' => 'Address title', |
||
| 58 | 'internalcode' => 'title', |
||
| 59 | ], |
||
| 60 | $prefix . 'firstname' => [ |
||
| 61 | 'label' => 'Address firstname', |
||
| 62 | 'internalcode' => 'firstname', |
||
| 63 | ], |
||
| 64 | $prefix . 'lastname' => [ |
||
| 65 | 'label' => 'Address lastname', |
||
| 66 | 'internalcode' => 'lastname', |
||
| 67 | ], |
||
| 68 | $prefix . 'address1' => [ |
||
| 69 | 'label' => 'Address address part one', |
||
| 70 | 'internalcode' => 'address1', |
||
| 71 | ], |
||
| 72 | $prefix . 'address2' => [ |
||
| 73 | 'label' => 'Address address part two', |
||
| 74 | 'internalcode' => 'address2', |
||
| 75 | ], |
||
| 76 | $prefix . 'address3' => [ |
||
| 77 | 'label' => 'Address address part three', |
||
| 78 | 'internalcode' => 'address3', |
||
| 79 | ], |
||
| 80 | $prefix . 'postal' => [ |
||
| 81 | 'label' => 'Address postal', |
||
| 82 | 'internalcode' => 'postal', |
||
| 83 | ], |
||
| 84 | $prefix . 'city' => [ |
||
| 85 | 'label' => 'Address city', |
||
| 86 | 'internalcode' => 'city', |
||
| 87 | ], |
||
| 88 | $prefix . 'state' => [ |
||
| 89 | 'label' => 'Address state', |
||
| 90 | 'internalcode' => 'state', |
||
| 91 | ], |
||
| 92 | $prefix . 'languageid' => [ |
||
| 93 | 'label' => 'Address language', |
||
| 94 | 'internalcode' => 'langid', |
||
| 95 | ], |
||
| 96 | $prefix . 'countryid' => [ |
||
| 97 | 'label' => 'Address country', |
||
| 98 | 'internalcode' => 'countryid', |
||
| 99 | ], |
||
| 100 | $prefix . 'telephone' => [ |
||
| 101 | 'label' => 'Address telephone', |
||
| 102 | 'internalcode' => 'telephone', |
||
| 103 | ], |
||
| 104 | $prefix . 'telefax' => [ |
||
| 105 | 'label' => 'Address telefax', |
||
| 106 | 'internalcode' => 'telefax', |
||
| 107 | ], |
||
| 108 | $prefix . 'mobile' => [ |
||
| 109 | 'label' => 'Address mobile number', |
||
| 110 | 'internalcode' => 'mobile', |
||
| 111 | ], |
||
| 112 | $prefix . 'email' => [ |
||
| 113 | 'label' => 'Address email', |
||
| 114 | 'internalcode' => 'email', |
||
| 115 | ], |
||
| 116 | $prefix . 'website' => [ |
||
| 117 | 'label' => 'Address website', |
||
| 118 | 'internalcode' => 'website', |
||
| 119 | ], |
||
| 120 | $prefix . 'birthday' => [ |
||
| 121 | 'label' => 'Address birthday', |
||
| 122 | 'internalcode' => 'birthday', |
||
| 123 | 'type' => 'date', |
||
| 124 | ], |
||
| 125 | $prefix . 'longitude' => [ |
||
| 126 | 'label' => 'Address longitude', |
||
| 127 | 'internalcode' => 'longitude', |
||
| 128 | 'type' => 'float', |
||
| 129 | ], |
||
| 130 | $prefix . 'latitude' => [ |
||
| 131 | 'label' => 'Address latitude', |
||
| 132 | 'internalcode' => 'latitude', |
||
| 133 | 'type' => 'float', |
||
| 134 | ], |
||
| 135 | $prefix . 'position' => [ |
||
| 136 | 'label' => 'Address position', |
||
| 137 | 'internalcode' => 'pos', |
||
| 138 | 'type' => 'int', |
||
| 139 | ], |
||
| 143 |