Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Celema\Boiler\Contract;
6
7use Celema\Boiler\Proxy\ArrayProxy;
8use Celema\Boiler\Proxy\IteratorProxy;
9use Celema\Boiler\Proxy\ObjectProxy;
10use Celema\Boiler\Proxy\Proxy;
11use Celema\Boiler\Proxy\StringProxy;
12use Traversable;
13
14/** @api */
15interface Wrapper
16{
17    /**
18     * A wrapper that treats the string conversion of instances of the given
19     * classes as safe HTML and prints it unescaped. It wraps the instances
20     * and what their properties, methods, and items return like other values.
21     *
22     * @param list<class-string> $trusted
23     */
24    public function withTrusted(array $trusted): static;
25
26    /**
27     * @template T
28     *
29     * @param T $value
30     *
31     * @return (T is string ? StringProxy : (T is array ? ArrayProxy : (T is Proxy<mixed> ? T : (T is Traversable ? IteratorProxy : (T is object ? ObjectProxy : T)))))
32     */
33    public function wrap(mixed $value): mixed;
34
35    /**
36     * @template T
37     *
38     * @param T $value
39     *
40     * @return (T is StringProxy ? string : (T is ArrayProxy ? array<array-key, mixed> : (T is IteratorProxy ? Traversable<mixed, mixed> : (T is ObjectProxy ? object : (T is array ? array<key-of<T>, mixed> : T)))))
41     */
42    public function unwrap(mixed $value): mixed;
43
44    public function escape(
45        string $value,
46        ?string $escaper = null,
47    ): string;
48
49    public function filter(string $name): Filter;
50}