| Conditions | 1 |
| Paths | 1 |
| Total Lines | 60 |
| 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 |
||
| 53 | public function load() |
||
| 54 | { |
||
| 55 | $className = 'YoanmBehat3SymfonyKernelBridge'; |
||
| 56 | $originalKernelClassName = $this->originalKernelClassName; |
||
| 57 | $template = <<<TEMPLATE |
||
| 58 | <?php |
||
| 59 | /** |
||
| 60 | * Autogenerated by Behat3SymfonyExtension. |
||
| 61 | * Don't touch the content it will be erased ! |
||
| 62 | * See Yoanm\Behat3SymfonyExtension\Factory\KernelFactory::load() |
||
| 63 | * |
||
| 64 | * This file should be automatically deleted after kernel load. Except if kernel.kernelDebug === true |
||
| 65 | */ |
||
| 66 | use Yoanm\Behat3SymfonyExtension\Dispatcher\BehatKernelEventDispatcher; |
||
| 67 | use ${originalKernelClassName} as ${className}BaseKernel; |
||
| 68 | |||
| 69 | class $className extends ${className}BaseKernel |
||
| 70 | { |
||
| 71 | /** @var BehatKernelEventDispatcher */ |
||
| 72 | private \$behatKernelEventDispatcher; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @param BehatKernelEventDispatcher \$behatKernelEventDispatcher |
||
| 76 | */ |
||
| 77 | public function setBehatKernelEventDispatcher(BehatKernelEventDispatcher \$behatKernelEventDispatcher) |
||
| 78 | { |
||
| 79 | \$this->behatKernelEventDispatcher = \$behatKernelEventDispatcher; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Will dispatch events related to kernel boot action |
||
| 84 | * Rely on parent class method |
||
| 85 | * |
||
| 86 | * {@inheritdoc} |
||
| 87 | */ |
||
| 88 | public function boot() |
||
| 89 | { |
||
| 90 | \$this->behatKernelEventDispatcher->beforeBoot(\$this); |
||
| 91 | parent::boot(); |
||
| 92 | \$this->behatKernelEventDispatcher->afterBoot(\$this); |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Will dispatch events related to kernel shutdown action |
||
| 97 | * Rely on parent class method |
||
| 98 | * |
||
| 99 | * {@inheritdoc} |
||
| 100 | */ |
||
| 101 | public function shutdown() |
||
| 102 | { |
||
| 103 | \$this->behatKernelEventDispatcher->beforeShutdown(\$this); |
||
| 104 | parent::shutdown(); |
||
| 105 | \$this->behatKernelEventDispatcher->afterShutdown(\$this); |
||
| 106 | } |
||
| 107 | } |
||
| 108 | |||
| 109 | TEMPLATE; |
||
| 110 | |||
| 111 | return $this->createAndLoadCustomAppKernel($template, $className); |
||
| 112 | } |
||
| 113 | |||
| 149 |