Conditions | 1 |
Paths | 1 |
Total Lines | 82 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 8 | ||
Bugs | 3 | Features | 1 |
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 |
||
53 | public function deployData() |
||
54 | { |
||
55 | $expectedUnstable = <<<"EOD" |
||
56 | Deploying application (graviton-unstable) to a Cloud Foundry instance. |
||
57 | Trying to login... done |
||
58 | Determining which application slice to be deployed |
||
59 | ... done |
||
60 | Trying to find deployment slice (blue)... found. Using slice graviton-unstable-green as deployment target. |
||
61 | Will deploy application: graviton-unstable-green. |
||
62 | Pushing graviton-unstable-green to Cloud Foundry. |
||
63 | ... done |
||
64 | |||
65 | Creating services... done |
||
66 | cs mongodb free graviton-unstable-mongodb |
||
67 | bind-service graviton-unstable-green graviton-unstable-mongodb |
||
68 | cs mongodb free graviton-unstable-test |
||
69 | bind-service graviton-unstable-green graviton-unstable-test |
||
70 | |||
71 | Defining environment variables... done |
||
72 | set-env graviton-unstable-green ERRBIT_API_KEY some_secret_key |
||
73 | |||
74 | Starting application (graviton-unstable). |
||
75 | ... done |
||
76 | |||
77 | Adding route (graviton-unstable) to application (graviton-unstable). |
||
78 | ... done |
||
79 | |||
80 | Removing graviton-unstable-blue from Cloud Foundry.... done |
||
81 | unmap-route graviton-unstable-blue DOMAIN -n graviton-unstable |
||
82 | stop graviton-unstable-blue |
||
83 | delete graviton-unstable-blue -f |
||
84 | |||
85 | Logging out... bye |
||
86 | |||
87 | EOD; |
||
88 | $expectedMaster = <<<"EOD" |
||
89 | Deploying application (graviton-master) to a Cloud Foundry instance. |
||
90 | Trying to login... done |
||
91 | Determining which application slice to be deployed |
||
92 | ... done |
||
93 | Trying to find deployment slice (blue)... found. Using slice graviton-master-green as deployment target. |
||
94 | Will deploy application: graviton-master-green. |
||
95 | Pushing graviton-master-green to Cloud Foundry. |
||
96 | ... done |
||
97 | |||
98 | Creating services... done |
||
99 | cs mongodb free graviton-master-mongodb |
||
100 | bind-service graviton-master-green graviton-master-mongodb |
||
101 | cs mongodb free graviton-master-test |
||
102 | bind-service graviton-master-green graviton-master-test |
||
103 | |||
104 | Defining environment variables... done |
||
105 | set-env graviton-master-green ERRBIT_API_KEY some_secret_key |
||
106 | |||
107 | Starting application (graviton-master). |
||
108 | ... done |
||
109 | |||
110 | Adding route (graviton) to application (graviton-master). |
||
111 | ... done |
||
112 | |||
113 | Removing graviton-master-blue from Cloud Foundry.... done |
||
114 | unmap-route graviton-master-blue DOMAIN -n graviton |
||
115 | stop graviton-master-blue |
||
116 | delete graviton-master-blue -f |
||
117 | |||
118 | Logging out... bye |
||
119 | |||
120 | EOD; |
||
121 | |||
122 | return [ |
||
123 | 'unstable deploy' => [ |
||
124 | 'graviton', |
||
125 | 'unstable', |
||
126 | $expectedUnstable, |
||
127 | ], |
||
128 | 'master deploy' => [ |
||
129 | 'graviton', |
||
130 | 'master', |
||
131 | $expectedMaster, |
||
132 | ], |
||
133 | ]; |
||
134 | } |
||
135 | } |
||
136 |