| Conditions | 5 |
| Paths | 1 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 5 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 28 | 7 | protected function setDefaultOptions(OptionsResolver $resolver) |
|
| 29 | { |
||
| 30 | 7 | parent::setDefaultOptions($resolver); |
|
| 31 | |||
| 32 | 7 | $resolver->setDefaults([ |
|
| 33 | 'command' => function (Options $options) { |
||
| 34 | 6 | $text = $options['text']; |
|
| 35 | 6 | $delimiterPos = strpos($text, self::COMMAND_DELIMITER); |
|
| 36 | 6 | $delimiterPos = false === $delimiterPos ? strpos($text, ' ') : $delimiterPos; |
|
| 37 | |||
| 38 | 6 | return false === $delimiterPos ? $text : substr($text, 0, $delimiterPos); |
|
| 39 | 7 | }, |
|
| 40 | ]); |
||
| 41 | |||
| 42 | 7 | $resolver->setNormalizers([ |
|
| 43 | 7 | 'command' => function (Options $options, $value) { |
|
| 44 | 6 | if (null !== $value) { |
|
| 45 | 6 | $value = preg_replace('/[^a-z0-9\-]/', '', strtolower($value)); |
|
| 46 | 6 | if (false === strpos($value, self::COMMAND_DELIMITER)) { |
|
| 47 | 6 | $value .= self::COMMAND_DELIMITER; |
|
| 48 | } |
||
| 49 | } |
||
| 50 | |||
| 51 | 6 | return $value; |
|
| 52 | 7 | }, |
|
| 53 | ]); |
||
| 54 | 7 | } |
|
| 55 | } |
||
| 56 |