| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 59 | 
| Code Lines | 45 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| 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 | ||
| 47 | public function testSendEmail() | ||
| 48 |     { | ||
| 49 | $message = new Message(); | ||
| 50 | $message->setBody(array( | ||
| 51 | 'subject' => 'subject', | ||
| 52 | 'from' => array( | ||
| 53 | 'email' => '[email protected]', | ||
| 54 | 'name' => 'nameFrom', | ||
| 55 | ), | ||
| 56 | 'to' => array( | ||
| 57 | '[email protected]', | ||
| 58 | '[email protected]' => 'nameTo2', | ||
| 59 | ), | ||
| 60 | 'replyTo' => array( | ||
| 61 | '[email protected]', | ||
| 62 | '[email protected]' => 'nameReplyTo2', | ||
| 63 | ), | ||
| 64 | 'cc' => array( | ||
| 65 | '[email protected]', | ||
| 66 | '[email protected]' => 'nameCc2', | ||
| 67 | ), | ||
| 68 | 'bcc' => array( | ||
| 69 | '[email protected]', | ||
| 70 | '[email protected]' => 'nameBcc2', | ||
| 71 | ), | ||
| 72 | 'message' => array( | ||
| 73 | 'text' => 'message text', | ||
| 74 | 'html' => 'message html', | ||
| 75 | ), | ||
| 76 | )); | ||
| 77 | |||
| 78 |         $mail = $this->getMockBuilder('Swift_Message')->disableOriginalConstructor()->getMock(); | ||
| 79 |         $mail->expects($this->once())->method('setSubject')->with($this->equalTo('subject'))->willReturnSelf(); | ||
| 80 |         $mail->expects($this->once())->method('setFrom')->with($this->equalTo(array('[email protected]' => 'nameFrom')))->willReturnSelf(); | ||
| 81 |         $mail->expects($this->once())->method('setTo')->with($this->equalTo(array('[email protected]', '[email protected]' => 'nameTo2')))->willReturnSelf(); | ||
| 82 |         $mail->expects($this->once())->method('setReplyTo')->with($this->equalTo(array('[email protected]', '[email protected]' => 'nameReplyTo2')))->willReturnSelf(); | ||
| 83 | $mail->expects($this->once()) | ||
| 84 |             ->method('setCc') | ||
| 85 |             ->with($this->equalTo(array('[email protected]', '[email protected]' => 'nameCc2'))) | ||
| 86 | ->willReturnSelf(); | ||
| 87 | $mail->expects($this->once()) | ||
| 88 |             ->method('setBcc') | ||
| 89 |             ->with($this->equalTo(array('[email protected]', '[email protected]' => 'nameBcc2'))) | ||
| 90 | ->willReturnSelf(); | ||
| 91 | $mail->expects($this->exactly(2)) | ||
| 92 |             ->method('addPart') | ||
| 93 | ->withConsecutive( | ||
| 94 |                 array($this->equalTo('message text'), $this->equalTo('text/plain')), | ||
| 95 |                 array($this->equalTo('message html'), $this->equalTo('text/html')) | ||
| 96 | ) | ||
| 97 | ->willReturnSelf(); | ||
| 98 | |||
| 99 |         $this->mailer->expects($this->once())->method('createMessage')->will($this->returnValue($mail)); | ||
|  | |||
| 100 | |||
| 101 | $method = new \ReflectionMethod($this->consumer, 'sendEmail'); | ||
| 102 | $method->setAccessible(true); | ||
| 103 | |||
| 104 | $method->invoke($this->consumer, $message); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | 
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.