Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| RichText | |
66.67% |
2 / 3 |
|
66.67% |
2 / 3 |
3.33 | |
0.00% |
0 / 1 |
| __toString | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| clean | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| excerpt | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Value; |
| 6 | |
| 7 | use Cosray\Util\Html as HtmlUtil; |
| 8 | use Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig; |
| 9 | |
| 10 | class RichText extends Text |
| 11 | { |
| 12 | public function __toString(): string |
| 13 | { |
| 14 | return $this->clean(); |
| 15 | } |
| 16 | |
| 17 | public function clean( |
| 18 | ?HtmlSanitizerConfig $config = null, |
| 19 | bool $removeEmptyLines = true, |
| 20 | ): string { |
| 21 | return HtmlUtil::sanitize($this->unwrap(), $config, $removeEmptyLines); |
| 22 | } |
| 23 | |
| 24 | public function excerpt( |
| 25 | int $words = 30, |
| 26 | string $allowedTags = '', |
| 27 | ): string { |
| 28 | return HtmlUtil::excerpt($this->unwrap(), $words, $allowedTags); |
| 29 | } |
| 30 | } |