Separate text filter decorators.
This commit is contained in:
20
app/Decorators/NewLineDecorator.php
Normal file
20
app/Decorators/NewLineDecorator.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: k
|
||||
* Date: 28.02.2019
|
||||
* Time: 20:23
|
||||
*/
|
||||
|
||||
namespace App\Decorators;
|
||||
|
||||
|
||||
class NewLineDecorator extends TextConverterDecorator
|
||||
{
|
||||
private $replaceElements = ['<br>', '<br />', '<br/>'];
|
||||
|
||||
public function getText(): string
|
||||
{
|
||||
return str_replace($this->replaceElements, "\n", $this->text->getText());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user