AbstractCondition::setKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * @company MTE Telecom, Ltd.
4
 * @author Roman Malashin <[email protected]>
5
 */
6
7
namespace Nnx\DataGrid\Condition;
8
9
/**
10
 * Class AbstractCondition
11
 * @package Nnx\DataGrid\Condition
12
 */
13
abstract class AbstractCondition implements ConditionInterface
14
{
15
    /**
16
     * @var int
17
     */
18
    protected $criteria;
19
20
    /**
21
     * @var string
22
     */
23
    protected $key;
24
25
    /**
26
     * @var mixed
27
     */
28
    protected $value;
29
30
    /**
31
     * @param string $key
32
     * @param String $criteria
33
     * @param null | string | array | \Traversable $value
34
     * @throws Exception\InvalidArgumentException
35
     */
36
    public function __construct($key, $criteria, $value=null)
37
    {
38
        if (!$key) {
39
            throw new Exception\InvalidArgumentException('Не задан ключ для создания Condition');
40
        }
41
        $this->setKey($key);
42
43
        if (!$criteria) {
44
            throw new Exception\InvalidArgumentException('Не задан критерий для Condition');
45
        }
46
        $this->setCriteria($criteria);
47
        $this->setValue($value);
48
    }
49
50
    /**
51
     * @return int
52
     */
53
    public function getCriteria()
54
    {
55
        return $this->criteria;
56
    }
57
58
    /**
59
     *
60
     * @param int $criteria
61
     * @return mixed
62
     */
63
    public function setCriteria($criteria)
64
    {
65
        $this->criteria = $criteria;
66
        return $this;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getKey()
73
    {
74
        return $this->key;
75
    }
76
77
    /**
78
     * @param string $key
79
     * @return $this
80
     */
81
    public function setKey($key)
82
    {
83
        $this->key = $key;
84
        return $this;
85
    }
86
87
    /**
88
     * @return mixed
89
     */
90
    public function getValue()
91
    {
92
        return $this->value;
93
    }
94
95
    /**
96
     * @param mixed $value
97
     * @return $this
98
     */
99
    public function setValue($value)
100
    {
101
        $this->value = $value;
102
        return $this;
103
    }
104
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
105