| Conditions | 1 |
| Paths | 1 |
| Total Lines | 118 |
| Code Lines | 100 |
| 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 |
||
| 43 | public function getData(): array |
||
| 44 | { |
||
| 45 | return [ |
||
| 46 | 'untilEventLogUuid' => (string) Uuid::uuid1(), |
||
| 47 | 'fromEventLogUuid' => (string) Uuid::uuid1(), |
||
| 48 | 'products' => [ |
||
| 49 | 1 => [ |
||
| 50 | 'uuid' => (string) Uuid::uuid1(), |
||
| 51 | 'categories' => [], |
||
| 52 | 'name' => 'product1', |
||
| 53 | 'description' => null, |
||
| 54 | 'imageLookupKeys' => [], |
||
| 55 | 'variants' => [ |
||
| 56 | 0 => [ |
||
| 57 | 'uuid' => (string) Uuid::uuid1(), |
||
| 58 | 'name' => 'variant1', |
||
| 59 | 'description' => null, |
||
| 60 | 'sku' => null, |
||
| 61 | 'barcode' => null, |
||
| 62 | 'defaultQuantity' => '1', |
||
| 63 | 'unitName' => null, |
||
| 64 | 'price' => [ |
||
| 65 | 'amount' => 6500, |
||
| 66 | 'currencyId' => 'EUR', |
||
| 67 | ], |
||
| 68 | 'costPrice' => null, |
||
| 69 | 'vatPercentage' => '6.0', |
||
| 70 | ], |
||
| 71 | ], |
||
| 72 | 'externalReference' => null, |
||
| 73 | 'etag' => 'CB7F0ABBF719F6A834727BF5FC59323C', |
||
| 74 | 'updated' => '2017-04-21T13:16:36.166+0000', |
||
| 75 | 'updatedBy' => (string) Uuid::uuid1(), |
||
| 76 | 'created' => '2017-04-21T13:16:36.166+0000', |
||
| 77 | 'unitName' => null, |
||
| 78 | 'vatPercentage' => '6.0', |
||
| 79 | ], |
||
| 80 | 4 => [ |
||
| 81 | 'uuid' => (string) Uuid::uuid1(), |
||
| 82 | 'categories' => [], |
||
| 83 | 'name' => 'product2', |
||
| 84 | 'description' => null, |
||
| 85 | 'imageLookupKeys' => [], |
||
| 86 | 'variants' => [ |
||
| 87 | 0 => [ |
||
| 88 | 'uuid' => (string) Uuid::uuid1(), |
||
| 89 | 'name' => 'variant2', |
||
| 90 | 'description' => null, |
||
| 91 | 'sku' => null, |
||
| 92 | 'barcode' => null, |
||
| 93 | 'defaultQuantity' => '1', |
||
| 94 | 'unitName' => null, |
||
| 95 | 'price' => [ |
||
| 96 | 'amount' => 12500, |
||
| 97 | 'currencyId' => 'EUR', |
||
| 98 | ], |
||
| 99 | 'costPrice' => null, |
||
| 100 | 'vatPercentage' => '6.0', |
||
| 101 | ], |
||
| 102 | 1 => [ |
||
| 103 | 'uuid' => (string) Uuid::uuid1(), |
||
| 104 | 'name' => 'variant3', |
||
| 105 | 'description' => null, |
||
| 106 | 'sku' => null, |
||
| 107 | 'barcode' => null, |
||
| 108 | 'defaultQuantity' => '1', |
||
| 109 | 'unitName' => null, |
||
| 110 | 'price' => [ |
||
| 111 | 'amount' => 8000, |
||
| 112 | 'currencyId' => 'EUR', |
||
| 113 | ], |
||
| 114 | 'costPrice' => null, |
||
| 115 | 'vatPercentage' => '6.0', |
||
| 116 | ], |
||
| 117 | ], |
||
| 118 | 'externalReference' => null, |
||
| 119 | 'etag' => 'FE0F62AD758BDAF477BDD86ECDA56E07', |
||
| 120 | 'updated' => '2017-04-21T13:16:46.078+0000', |
||
| 121 | 'updatedBy' => (string) Uuid::uuid1(), |
||
| 122 | 'created' => '2017-04-21T13:16:00.273+0000', |
||
| 123 | 'unitName' => null, |
||
| 124 | 'vatPercentage' => '6.0', |
||
| 125 | ], |
||
| 126 | ], |
||
| 127 | 'discounts' => [ |
||
| 128 | 0 => [ |
||
| 129 | 'uuid' => (string) Uuid::uuid1(), |
||
| 130 | 'name' => 'discount1', |
||
| 131 | 'description' => 'description1', |
||
| 132 | 'imageLookupKeys' => [ |
||
| 133 | 0 => 'tomQNcudigYT0a_7MbxCIvMqoPM.jpeg' |
||
| 134 | ], |
||
| 135 | 'amount' => null, |
||
| 136 | 'percentage' => '80.5', |
||
| 137 | 'externalReference' => 'none', |
||
| 138 | 'etag' => '291231A318099EF63621193E8C4197F3', |
||
| 139 | 'updated' => '2017-10-19T19:24:32.832+0000', |
||
| 140 | 'updatedBy' => (string) Uuid::uuid1(), |
||
| 141 | 'created' => '2017-10-19T19:24:32.832+0000', |
||
| 142 | ], |
||
| 143 | 1 => [ |
||
| 144 | 'uuid' => (string) Uuid::uuid1(), |
||
| 145 | 'name' => 'discount2', |
||
| 146 | 'description' => 'description2', |
||
| 147 | 'imageLookupKeys' => [], |
||
| 148 | 'amount' => null, |
||
| 149 | 'percentage' => '80.5', |
||
| 150 | 'externalReference' => 'none', |
||
| 151 | 'etag' => 'C4247311FFB2A873379358F95FAD10FD', |
||
| 152 | 'updated' => '2017-10-19T19:16:40.773+0000', |
||
| 153 | 'updatedBy' => (string) Uuid::uuid1(), |
||
| 154 | 'created' => '2017-10-19T19:16:40.773+0000', |
||
| 155 | ], |
||
| 156 | ], |
||
| 157 | 'deletedProducts' => [], |
||
| 158 | 'deletedDiscounts' => [], |
||
| 159 | ]; |
||
| 160 | } |
||
| 161 | } |
||
| 162 |