Conditions | 3 |
Paths | 3 |
Total Lines | 59 |
Code Lines | 40 |
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 |
||
81 | private function getRemotePlans(ProxyBonanza $proxyBonanza, SymfonyStyle $symfonyStyle) |
||
82 | { |
||
83 | |||
84 | $symfonyStyle->section(' Getting remote data from ProxyBonanza '); |
||
85 | |||
86 | $symfonyStyle->createProgressBar(100); |
||
87 | $symfonyStyle->progressStart(0); |
||
88 | |||
89 | $pbPlans = $proxyBonanza->getRemotePlans(); |
||
90 | if (!$pbPlans->count()) { |
||
91 | return $pbPlans; |
||
92 | } |
||
93 | |||
94 | $symfonyStyle->progressAdvance(50); |
||
95 | |||
96 | $pbPlans = $proxyBonanza->getRemotePacks($pbPlans); |
||
97 | |||
98 | $symfonyStyle->progressAdvance(50); |
||
99 | |||
100 | $symfonyStyle->progressFinish(); |
||
101 | |||
102 | $header = [ |
||
103 | 'id', |
||
104 | 'login', |
||
105 | 'password', |
||
106 | 'expires', |
||
107 | 'bandwidth', |
||
108 | 'last ip change', |
||
109 | 'name', |
||
110 | 'bandwidth', |
||
111 | 'price', |
||
112 | 'ip\'s count', |
||
113 | 'price per gig', |
||
114 | 'type' |
||
115 | ]; |
||
116 | |||
117 | $body = []; |
||
118 | |||
119 | /** @var Plan $pbPlan */ |
||
120 | foreach ($pbPlans as $pbPlan) { |
||
121 | $body[] = [ |
||
122 | $pbPlan->getId(), |
||
123 | $pbPlan->getLogin(), |
||
124 | $pbPlan->getPassword(), |
||
125 | $pbPlan->getExpires()->format('Y-m-d H:i'), |
||
126 | $this->formatSizeUnits($pbPlan->getBandwidth(), 2), |
||
127 | $pbPlan->getLastIpChange()->format('Y-m-d H:i'), |
||
128 | $pbPlan->getPackageName(), |
||
129 | $this->formatSizeUnits($pbPlan->getPackageBandwidth(), 2), |
||
130 | $pbPlan->getPackagePrice(), |
||
131 | $pbPlan->getPackageHowmanyIps(), |
||
132 | $pbPlan->getPackagePricePerGig(), |
||
133 | $pbPlan->getPackageType() |
||
134 | ]; |
||
135 | } |
||
136 | |||
137 | $symfonyStyle->table($header, $body); |
||
138 | |||
139 | return $pbPlans; |
||
140 | } |
||
201 |