Conditions | 1 |
Paths | 1 |
Total Lines | 76 |
Code Lines | 51 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | 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 |
||
89 | public function testGetGraphUrl() |
||
90 | { |
||
91 | $entityManager = $this->createMock("Doctrine\\ORM\\EntityManagerInterface"); |
||
92 | |||
93 | $client = new YumlClient($entityManager); |
||
94 | |||
95 | $this->assertSame( |
||
96 | 'https://yuml.me/15a98c92.png', |
||
97 | $client->getGraphUrl( |
||
98 | '[Simple.Entity|+a;b;c]', |
||
99 | 'plain', |
||
100 | 'png', |
||
101 | 'TB', |
||
102 | 'normal' |
||
103 | ) |
||
104 | ); |
||
105 | |||
106 | $this->assertSame( |
||
107 | 'https://yuml.me/15a98c92.jpg', |
||
108 | $client->getGraphUrl( |
||
109 | '[Simple.Entity|+a;b;c]', |
||
110 | 'plain', |
||
111 | 'jpg', |
||
112 | 'TB', |
||
113 | 'normal' |
||
114 | ) |
||
115 | ); |
||
116 | |||
117 | $this->assertSame( |
||
118 | 'https://yuml.me/d6ba9ce1.png', |
||
119 | $client->getGraphUrl( |
||
120 | '[Simple.Entity|+a;b;c]', |
||
121 | 'plain', |
||
122 | 'png', |
||
123 | 'LR', |
||
124 | 'huge' |
||
125 | ) |
||
126 | ); |
||
127 | |||
128 | $this->assertSame( |
||
129 | 'https://yuml.me/4f52303c.png', |
||
130 | $client->getGraphUrl( |
||
131 | '[Simple.Entity|+a;b;c]', |
||
132 | 'scruffy', |
||
133 | 'png', |
||
134 | 'LR', |
||
135 | 'big' |
||
136 | ) |
||
137 | ); |
||
138 | |||
139 | $this->assertSame( |
||
140 | 'https://yuml.me/0df97f73.png', |
||
141 | $client->getGraphUrl( |
||
142 | '[Simple.Entity|+a;b;c]', |
||
143 | 'plain', |
||
144 | 'png', |
||
145 | 'RL', |
||
146 | 'small' |
||
147 | ) |
||
148 | ); |
||
149 | |||
150 | $this->assertSame( |
||
151 | 'https://yuml.me/c066b235.svg', |
||
152 | $client->getGraphUrl( |
||
153 | '[Simple.Entity|+a;b;c]', |
||
154 | 'plain', |
||
155 | 'svg', |
||
156 | 'TB', |
||
157 | 'tiny' |
||
158 | ) |
||
159 | ); |
||
160 | |||
161 | |||
162 | |||
163 | |||
164 | } |
||
165 | |||
190 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: