Conditions | 8 |
Paths | 29 |
Total Lines | 51 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 4 | ||
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 namespace Comodojo\RpcClient; |
||
114 | public function send() { |
||
115 | |||
116 | $requests = $this->getRequest(); |
||
117 | |||
118 | if ( empty($requests) ) throw new Exception("No request to send"); |
||
119 | |||
120 | if ( $this->getProtocol() == self::XMLRPC ) { |
||
121 | |||
122 | $processor = new XmlProcessor($this->getEncoding(), $this->logger()); |
||
123 | |||
124 | $content_type = "text/xml"; |
||
125 | |||
126 | } else { |
||
127 | |||
128 | $processor = new JsonProcessor($this->getEncoding(), $this->logger()); |
||
129 | |||
130 | $content_type = "application/json"; |
||
131 | |||
132 | } |
||
133 | |||
134 | try { |
||
135 | |||
136 | $payload = $processor->encode($requests); |
||
137 | |||
138 | $response = $this->sender()->setContentType($content_type)->performCall($payload, $this->getEncryption()); |
||
|
|||
139 | |||
140 | $result = $processor->decode($response); |
||
141 | |||
142 | } catch (HttpException $he) { |
||
143 | |||
144 | throw $he; |
||
145 | |||
146 | } catch (RpcException $re) { |
||
147 | |||
148 | throw $re; |
||
149 | |||
150 | } catch (XmlrpcException $xe) { |
||
151 | |||
152 | throw $xe; |
||
153 | |||
154 | } catch (Exception $e) { |
||
155 | |||
156 | throw $e; |
||
157 | |||
158 | } |
||
159 | |||
160 | if ( $this->autoclean ) $this->clean(); |
||
161 | |||
162 | return $result; |
||
163 | |||
164 | } |
||
165 | |||
167 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.