| Total Complexity | 5 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Coverage | 63.64% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | trait HasRichTextName |
||
| 14 | { |
||
| 15 | #[ORM\Column(type: 'string', length: 191)] |
||
| 16 | private string $name = ''; |
||
| 17 | |||
| 18 | #[ORM\Column(type: 'string', length: 191, options: ['default' => ''])] |
||
| 19 | private string $plainName = ''; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param string $name |
||
| 23 | */ |
||
| 24 | public function __construct($name = '') |
||
| 25 | { |
||
| 26 | $this->setName($name); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Set name. |
||
| 31 | */ |
||
| 32 | 49 | public function setName(string $name): void |
|
| 33 | { |
||
| 34 | 49 | $this->name = Utility::sanitizeSingleLineRichText($name); |
|
| 35 | 49 | $this->plainName = Utility::richTextToPlainText($this->name); |
|
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Set plain name. |
||
| 40 | */ |
||
| 41 | 7 | public function setPlainName(string $plainName): void |
|
|
|
|||
| 42 | { |
||
| 43 | // Do nothing, plain name is automatically generated from name. |
||
| 44 | 7 | } |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Get name. |
||
| 48 | */ |
||
| 49 | 16 | public function getName(): string |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get plain name. |
||
| 56 | */ |
||
| 57 | public function getPlainName(): string |
||
| 62 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.