| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 90 | public function testManyMailers($type) |
||
| 91 | { |
||
| 92 | $container = $this->loadContainerFromFile('many_mailers', $type); |
||
| 93 | |||
| 94 | // first mailer |
||
| 95 | self::assertSame( |
||
| 96 | ['swiftmailer.first_mailer.plugin' => [[]]], |
||
| 97 | $container->getDefinition('pixelart_swiftmailer_manipulator.mailer.first_mailer.plugin')->getTags() |
||
| 98 | ); |
||
| 99 | |||
| 100 | self::assertSame( |
||
| 101 | '[TESTSYSTEM 1!]', |
||
| 102 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.first_mailer.prepend_subject') |
||
| 103 | ); |
||
| 104 | |||
| 105 | self::assertSame( |
||
| 106 | 'swiftmailer/prepend_body_1.txt.twig', |
||
| 107 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.first_mailer.prepend_body') |
||
| 108 | ); |
||
| 109 | |||
| 110 | // second mailer |
||
| 111 | self::assertSame( |
||
| 112 | ['swiftmailer.secondary_mailer.plugin' => [[]]], |
||
| 113 | $container->getDefinition('pixelart_swiftmailer_manipulator.mailer.secondary_mailer.plugin')->getTags() |
||
| 114 | ); |
||
| 115 | |||
| 116 | self::assertSame( |
||
| 117 | '[TESTSYSTEM 2!]', |
||
| 118 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.secondary_mailer.prepend_subject') |
||
| 119 | ); |
||
| 120 | |||
| 121 | self::assertSame( |
||
| 122 | 'swiftmailer/prepend_body_2.txt.twig', |
||
| 123 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.secondary_mailer.prepend_body') |
||
| 124 | ); |
||
| 125 | |||
| 126 | // third mailer |
||
| 127 | self::assertSame( |
||
| 128 | ['swiftmailer.third_mailer.plugin' => [[]]], |
||
| 129 | $container->getDefinition('pixelart_swiftmailer_manipulator.mailer.third_mailer.plugin')->getTags() |
||
| 130 | ); |
||
| 131 | |||
| 132 | self::assertSame( |
||
| 133 | '[TESTSYSTEM 3!]', |
||
| 134 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.third_mailer.prepend_subject') |
||
| 135 | ); |
||
| 136 | |||
| 137 | self::assertSame( |
||
| 138 | 'swiftmailer/prepend_body_3.txt.twig', |
||
| 139 | $container->getParameter('pixelart_swiftmailer_manipulator.mailer.third_mailer.prepend_body') |
||
| 140 | ); |
||
| 141 | } |
||
| 142 | |||
| 181 |