| Conditions | 3 |
| Paths | 3 |
| Total Lines | 24 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | protected function setEditor($wysiwyg, array $arguments = []) |
||
| 31 | { |
||
| 32 | if (empty($wysiwyg)) { |
||
| 33 | throw new \InvalidArgumentException( |
||
| 34 | 'WYSIWYG name cannot be empty. You must mark your scenario with @wysiwyg' . |
||
| 35 | 'and @wysiwyg:<NAME> tags. For example: @wysiwyg @wysiwyg:CKEditor' |
||
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | try { |
||
| 40 | $this->wysiwyg = Wysiwyg::instantiate($wysiwyg, $arguments); |
||
| 41 | } catch (\Exception $e) { |
||
| 42 | new Message('comment', 4, [ |
||
| 43 | 'To describe a new editor you must create an object which will be extended', |
||
| 44 | 'by "%s" abstraction.', |
||
| 45 | ], [ |
||
| 46 | Wysiwyg::class, |
||
| 47 | ]); |
||
| 48 | |||
| 49 | new Message('error', 4, ['%s'], [$e->getMessage()]); |
||
| 50 | |||
| 51 | throw new \Exception(sprintf('The WYSIWYG editor "%s" does not exist.', $wysiwyg)); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 69 |