| Conditions | 1 |
| Paths | 1 |
| Total Lines | 53 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 42 | public function load() |
||
| 43 | { |
||
| 44 | $className = 'YoanmBehat3SymfonyKernelBridge'; |
||
| 45 | $originalKernelClassName = $this->originalKernelClassName; |
||
| 46 | $template = <<<TEMPLATE |
||
| 47 | <?php |
||
| 48 | /** |
||
| 49 | * Autogenerated by Behat3SymfonyExtension. |
||
| 50 | * Don't touch the content it will be erased ! |
||
| 51 | * See Yoanm\Behat3SymfonyExtension\Factory\KernelFactory::load() |
||
| 52 | */ |
||
| 53 | use Yoanm\Behat3SymfonyExtension\Dispatcher\BehatKernelEventDispatcher; |
||
| 54 | use ${originalKernelClassName} as ${className}BaseKernel; |
||
| 55 | |||
| 56 | class $className extends ${className}BaseKernel |
||
| 57 | { |
||
| 58 | /** @var BehatKernelEventDispatcher */ |
||
| 59 | private \$behatKernelEventDispatcher; |
||
| 60 | |||
| 61 | public function setBehatKernelEventDispatcher(BehatKernelEventDispatcher \$behatKernelEventDispatcher) |
||
| 62 | { |
||
| 63 | \$this->behatKernelEventDispatcher = \$behatKernelEventDispatcher; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * {@inheritdoc} |
||
| 68 | */ |
||
| 69 | public function boot() |
||
| 70 | { |
||
| 71 | \$this->behatKernelEventDispatcher->beforeBoot(\$this); |
||
| 72 | |||
| 73 | parent::boot(); |
||
| 74 | |||
| 75 | \$this->behatKernelEventDispatcher->afterBoot(\$this); |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | */ |
||
| 81 | public function shutdown() |
||
| 82 | { |
||
| 83 | \$this->behatKernelEventDispatcher->beforeShutdown(\$this); |
||
| 84 | |||
| 85 | parent::shutdown(); |
||
| 86 | |||
| 87 | \$this->behatKernelEventDispatcher->afterShutdown(\$this); |
||
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | TEMPLATE; |
||
| 92 | |||
| 93 | return $this->createAndLoadCustomAppKernel($template, $className); |
||
| 94 | } |
||
| 95 | |||
| 123 |