Separate text filter decorators.
This commit is contained in:
23
app/Decorators/HideLinesDecorator.php
Normal file
23
app/Decorators/HideLinesDecorator.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: k
|
||||
* Date: 28.02.2019
|
||||
* Time: 20:47
|
||||
*/
|
||||
|
||||
namespace App\Decorators;
|
||||
|
||||
|
||||
class HideLinesDecorator extends TextConverterDecorator
|
||||
{
|
||||
|
||||
/**
|
||||
* usuwa linijki z tekstu które zaczynają zię od znaku #
|
||||
* @return string
|
||||
*/
|
||||
public function getText(): string
|
||||
{
|
||||
return preg_replace('/^\s*[!#].*?$[\r\n]?/m', '', $this->text->getText());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user