Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Trim
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 apply
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
3
 safe
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celemas\Boiler\Filter;
6
7use Celemas\Boiler\Contract;
8use Override;
9
10/** @api */
11final class Trim implements Contract\Filter, Contract\PreservesSafety
12{
13    #[Override]
14    public function apply(string $value, mixed ...$args): string
15    {
16        if (!array_key_exists(0, $args) || $args[0] === null) {
17            return trim($value);
18        }
19
20        return trim($value, (string) $args[0]);
21    }
22
23    #[Override]
24    public function safe(): bool
25    {
26        return false;
27    }
28}