Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
20 / 20
CRAP
100.00% covered (success)
100.00%
1 / 1
ExprAdapter
100.00% covered (success)
100.00%
20 / 20
100.00% covered (success)
100.00%
20 / 20
21
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSupportedTokenType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 parameter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
 string
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 isNull
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 eq
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 neq
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 gt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 gte
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 lt
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 lte
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 in
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 notIn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 contains
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 notContains
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 andX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 nandX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 orX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 norX
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 xorX
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 Symftony\Xpression\Bridge\Doctrine\ORM;
6
7use Doctrine\ORM\Query\Expr;
8use Symftony\Xpression\Exception\Expr\UnsupportedExpressionTypeException;
9use Symftony\Xpression\Expr\ExpressionBuilderInterface;
10use Symftony\Xpression\Lexer;
11
12class ExprAdapter implements ExpressionBuilderInterface
13{
14    private Expr $expr;
15
16    public function __construct(Expr $expr)
17    {
18        $this->expr = $expr;
19    }
20
21    public function getSupportedTokenType(): int
22    {
23        return Lexer::T_ALL - Lexer::T_NOT_AND - Lexer::T_NOT_OR - Lexer::T_XOR;
24    }
25
26    public function parameter(mixed $value, bool $isValue = false): mixed
27    {
28        return $isValue ? $this->expr->literal($value) : $value;
29    }
30
31    public function string(mixed $value): mixed
32    {
33        return $this->expr->literal($value);
34    }
35
36    public function isNull(string $field): mixed
37    {
38        return $this->expr->isNull($field);
39    }
40
41    public function eq(string $field, mixed $value): mixed
42    {
43        return $this->expr->eq($field, $value);
44    }
45
46    public function neq(string $field, mixed $value): mixed
47    {
48        return $this->expr->neq($field, $value);
49    }
50
51    public function gt(string $field, mixed $value): mixed
52    {
53        return $this->expr->gt($field, $value);
54    }
55
56    public function gte(string $field, mixed $value): mixed
57    {
58        return $this->expr->gte($field, $value);
59    }
60
61    public function lt(string $field, mixed $value): mixed
62    {
63        return $this->expr->lt($field, $value);
64    }
65
66    public function lte(string $field, mixed $value): mixed
67    {
68        return $this->expr->lte($field, $value);
69    }
70
71    public function in(string $field, array $values): mixed
72    {
73        return $this->expr->in($field, $values);
74    }
75
76    public function notIn(string $field, array $values): mixed
77    {
78        return $this->expr->notIn($field, $values);
79    }
80
81    public function contains(string $field, mixed $value): mixed
82    {
83        return $this->expr->like($field, $value);
84    }
85
86    public function notContains(string $field, mixed $value): mixed
87    {
88        return $this->expr->notLike($field, $value);
89    }
90
91    public function andX(array $expressions): mixed
92    {
93        return $this->expr->andX(...$expressions);
94    }
95
96    public function nandX(array $expressions): mixed
97    {
98        throw new UnsupportedExpressionTypeException('nandX');
99    }
100
101    public function orX(array $expressions): mixed
102    {
103        return $this->expr->orX(...$expressions);
104    }
105
106    public function norX(array $expressions): mixed
107    {
108        throw new UnsupportedExpressionTypeException('norX');
109    }
110
111    public function xorX(array $expressions): mixed
112    {
113        throw new UnsupportedExpressionTypeException('xorX');
114    }
115}