Completed
Push — master ( 68be21...073c54 )
by Kévin
02:41
created

PommOperators   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
wmc 1
lcom 0
cbo 2
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 16 1
1
<?php
2
3
namespace RulerZ\Target\Pomm;
4
5
use RulerZ\Target\Operators;
6
7
class PommOperators
8
{
9
    /**
10
     * @return Operators\Definitions
11
     */
12
    public static function create(Operators\Definitions $customOperators)
13
    {
14
        $definitions = Operators\GenericSqlDefinitions::create($customOperators);
15
16
        $definitions->defineInlineOperator('and', function ($a, $b) {
17
            return sprintf('%s->andWhere(%s)', $a, $b);
18
        });
19
        $definitions->defineInlineOperator('or', function ($a, $b) {
20
            return sprintf('%s->orWhere(%s)', $a, $b);
21
        });
22
        $definitions->defineInlineOperator('not', function ($a) {
23
            return sprintf('(new \PommProject\Foundation\Where("NOT(".%s->getElement() .")", %s->getValues()))', $a, $a);
24
        });
25
26
        return $definitions;
27
    }
28
}
29