blob: e7e5cc24c7e280a643ac7441d5eecc3fc3280c98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<?php
namespace r7r\cms\sys\textprocessors;
/**
* LegacyTextprocessor is used to wrap an old-style textprocessor into an Textprocessor object.
*/
class LegacyTextprocessor implements Textprocessor
{
/** @var callable */
private $fx;
/** @var bool */
private $visible_in_backend;
public function __construct(callable $fx, $visible_in_backend)
{
$this->fx = $fx;
$this->visible_in_backend = (bool)$visible_in_backend;
}
public function apply(string $input): string
{
return (string)call_user_func($this->fx, $input);
}
public function showInBackend(): bool
{
return $this->visible_in_backend;
}
}
|