Conditions | 1 |
Paths | 1 |
Total Lines | 55 |
Code Lines | 41 |
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 |
||
22 | protected function setUp(): void |
||
23 | { |
||
24 | $this->quote = (new Quote())->fromArray([ |
||
25 | 'symbol' => 'AMZN', |
||
26 | 'companyName' => [ |
||
27 | 'shortName' => 'Short Company name, Inc.', |
||
28 | 'longName' => 'Long Company name, Inc.', |
||
29 | ], |
||
30 | 'currency' => [ |
||
31 | 'currency' => 'USD', |
||
32 | 'symbol' => '$', |
||
33 | ], |
||
34 | 'url' => 'https://example.url.com', |
||
35 | 'regularMarketPrice' => [ |
||
36 | 'raw' => 629.999, |
||
37 | 'fmt' => '629.99', |
||
38 | ], |
||
39 | 'regularMarketChange' => [ |
||
40 | 'raw' => -3.2900085, |
||
41 | 'fmt' => '-3.29', |
||
42 | ], |
||
43 | 'regularMarketChangePercent' => [ |
||
44 | 'raw' => -1.8199171, |
||
45 | 'fmt' => '-1.82%', |
||
46 | ], |
||
47 | 'marketCap' => [ |
||
48 | 'raw' => 797834477568, |
||
49 | 'fmt' => '797.834B', |
||
50 | 'longFmt' => '797,834,477,568', |
||
51 | ], |
||
52 | 'lastTrend' => [ |
||
53 | [ |
||
54 | 'period' => '0m', |
||
55 | 'strongBuy' => 11, |
||
56 | 'buy' => 12, |
||
57 | 'hold' => 13, |
||
58 | 'sell' => 14, |
||
59 | 'strongSell' => 15, |
||
60 | ], |
||
61 | [ |
||
62 | 'period' => '-1m', |
||
63 | 'strongBuy' => 21, |
||
64 | 'buy' => 22, |
||
65 | 'hold' => 23, |
||
66 | 'sell' => 24, |
||
67 | 'strongSell' => 25, |
||
68 | ], |
||
69 | ], |
||
70 | 'latestNews' => [ |
||
71 | [ |
||
72 | 'datetime' => 'example datetime', |
||
73 | 'timezone' => 'example timezone', |
||
74 | 'url' => 'example url', |
||
75 | 'title' => 'example title', |
||
76 | 'summary' => 'example summary', |
||
77 | ], |
||
185 |