Passed
Push — master ( 5a733a...de3595 )
by dima
06:55
created
src/ISpecificationCriteria.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,43 +10,43 @@
 block discarded – undo
10 10
  */
11 11
 interface ISpecificationCriteria
12 12
 {
13
-    public function getCriteria();
13
+	public function getCriteria();
14 14
 	
15 15
 	public function getWhere();
16 16
 
17
-    public function getLimit();
17
+	public function getLimit();
18 18
 
19
-    public function getOfset();
19
+	public function getOfset();
20 20
 
21
-    public function getJoins();
21
+	public function getJoins();
22 22
 
23
-    public function getOrder();
23
+	public function getOrder();
24 24
 
25
-    public function getManualJoins();
25
+	public function getManualJoins();
26 26
 
27
-    public function getGroup();
27
+	public function getGroup();
28 28
 
29
-    public function getManualWheres();
29
+	public function getManualWheres();
30 30
 
31
-    public function getWhereType();    
31
+	public function getWhereType();    
32 32
 
33
-    public function setWhere($field,$value = false);    
33
+	public function setWhere($field,$value = false);    
34 34
 
35
-    public function setLimit($limit);
35
+	public function setLimit($limit);
36 36
 
37
-    public function setOfset($ofset);
37
+	public function setOfset($ofset);
38 38
 
39
-    public function setJoins($joins);    
39
+	public function setJoins($joins);    
40 40
 
41
-    public function setOrder($order);
41
+	public function setOrder($order);
42 42
 
43
-    public function setManualJoins($manualJoins);
43
+	public function setManualJoins($manualJoins);
44 44
 
45
-    public function setGroup($group);
45
+	public function setGroup($group);
46 46
 
47
-    public function setManualWheres($manualWheres);
47
+	public function setManualWheres($manualWheres);
48 48
 	
49
-    public function setWhereType($whereType);
49
+	public function setWhereType($whereType);
50 50
 	
51 51
 }
52 52
 
Please login to merge, or discard this patch.
src/AbstractEntity.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,29 +10,29 @@
 block discarded – undo
10 10
 abstract class AbstractEntity implements EntityInterface
11 11
 {
12 12
 
13
-    protected $id;
13
+	protected $id;
14 14
 	
15 15
 	protected $deleted;
16 16
 
17 17
 	public function getId()
18
-    {
19
-        return $this->id;
20
-    }
18
+	{
19
+		return $this->id;
20
+	}
21 21
 
22
-    public function setId($id)
23
-    {
24
-        if ($this->id !== null) {
25
-            throw new BadMethodCallException(
26
-                "Идентификатор у сущности уже установлен");
27
-        }
22
+	public function setId($id)
23
+	{
24
+		if ($this->id !== null) {
25
+			throw new BadMethodCallException(
26
+				"Идентификатор у сущности уже установлен");
27
+		}
28 28
  
29
-        if ($id < 1) {
30
-            throw new InvalidArgumentException("Неверный индентификатор");
31
-        }
29
+		if ($id < 1) {
30
+			throw new InvalidArgumentException("Неверный индентификатор");
31
+		}
32 32
  
33
-        $this->id = $id;
34
-        return $this;		
35
-    }
33
+		$this->id = $id;
34
+		return $this;		
35
+	}
36 36
 	
37 37
 	public function setDeleted($deleted){
38 38
 		$this->deleted = $deleted;
Please login to merge, or discard this patch.
src/Specification.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -10,134 +10,134 @@
 block discarded – undo
10 10
 class Specification implements ISpecificationCriteria
11 11
 {
12 12
 
13
-    protected $where = [];
13
+	protected $where = [];
14 14
 
15
-    protected $limit = 0;
15
+	protected $limit = 0;
16 16
 
17
-    protected $ofset = 0;
17
+	protected $ofset = 0;
18 18
 
19
-    protected $joins = [];
19
+	protected $joins = [];
20 20
 
21
-    protected $order = [];
21
+	protected $order = [];
22 22
 
23
-    protected $manualJoins = [];
23
+	protected $manualJoins = [];
24 24
 
25
-    protected $group = null;
25
+	protected $group = null;
26 26
 
27
-    protected $manualWheres = [];
27
+	protected $manualWheres = [];
28 28
 
29
-    protected $whereType = 'AND';
29
+	protected $whereType = 'AND';
30 30
     
31
-    function getWhere()
32
-    {
33
-        return $this->where;
34
-    }
35
-
36
-    function getLimit()
37
-    {
38
-        return $this->limit;
39
-    }
40
-
41
-    function getOfset()
42
-    {
43
-        return $this->ofset;
44
-    }
45
-
46
-    function getJoins()
47
-    {
48
-        return $this->joins;
49
-    }
50
-
51
-    function getOrder()
52
-    {
53
-        return $this->order;
54
-    }
55
-
56
-    function getManualJoins()
57
-    {
58
-        return $this->manualJoins;
59
-    }
60
-
61
-    function getGroup()
62
-    {
63
-        return $this->group;
64
-    }
65
-
66
-    function getManualWheres()
67
-    {
68
-        return $this->manualWheres;
69
-    }
70
-
71
-    function getWhereType()
72
-    {
73
-        return $this->whereType;
74
-    }
75
-
76
-    function setWhere($field,$value = false)
77
-    {
78
-        if($value!==false){
79
-            $this->where[$field] = $value;
80
-        }
81
-        else{
82
-            $this->where = $where;
83
-        }
31
+	function getWhere()
32
+	{
33
+		return $this->where;
34
+	}
35
+
36
+	function getLimit()
37
+	{
38
+		return $this->limit;
39
+	}
40
+
41
+	function getOfset()
42
+	{
43
+		return $this->ofset;
44
+	}
45
+
46
+	function getJoins()
47
+	{
48
+		return $this->joins;
49
+	}
50
+
51
+	function getOrder()
52
+	{
53
+		return $this->order;
54
+	}
55
+
56
+	function getManualJoins()
57
+	{
58
+		return $this->manualJoins;
59
+	}
60
+
61
+	function getGroup()
62
+	{
63
+		return $this->group;
64
+	}
65
+
66
+	function getManualWheres()
67
+	{
68
+		return $this->manualWheres;
69
+	}
70
+
71
+	function getWhereType()
72
+	{
73
+		return $this->whereType;
74
+	}
75
+
76
+	function setWhere($field,$value = false)
77
+	{
78
+		if($value!==false){
79
+			$this->where[$field] = $value;
80
+		}
81
+		else{
82
+			$this->where = $where;
83
+		}
84 84
         
85
-        return $this;
86
-    }
87
-
88
-    function setLimit($limit)
89
-    {
90
-        $this->limit = $limit;
91
-        return $this;
92
-    }
93
-
94
-    function setOfset($ofset)
95
-    {
96
-        $this->ofset = $ofset;
97
-        return $this;
98
-    }
99
-
100
-    function setJoins($joins)
101
-    {
102
-        $this->joins = $joins;
103
-        return $this;
104
-    }
105
-
106
-    function setOrder($order)
107
-    {
108
-        $this->order = $order;
109
-        return $this;
110
-    }
111
-
112
-    function setManualJoins($manualJoins)
113
-    {
114
-        $this->manualJoins = $manualJoins;
115
-        return $this;
116
-    }
117
-
118
-    function setGroup($group)
119
-    {
120
-        $this->group = $group;
121
-        return $this;
122
-    }
123
-
124
-    function setManualWheres($manualWheres)
125
-    {
126
-        $this->manualWheres = $manualWheres;
127
-        return $this;
128
-    }
129
-
130
-    function setWhereType($whereType)
131
-    {
132
-        $this->whereType = $whereType;
133
-        return $this;
134
-    }
135
-
136
-    /**
137
-     * Создание критериев
138
-     */
139
-    public function getCriteria()
140
-    {
85
+		return $this;
86
+	}
87
+
88
+	function setLimit($limit)
89
+	{
90
+		$this->limit = $limit;
91
+		return $this;
92
+	}
93
+
94
+	function setOfset($ofset)
95
+	{
96
+		$this->ofset = $ofset;
97
+		return $this;
98
+	}
99
+
100
+	function setJoins($joins)
101
+	{
102
+		$this->joins = $joins;
103
+		return $this;
104
+	}
105
+
106
+	function setOrder($order)
107
+	{
108
+		$this->order = $order;
109
+		return $this;
110
+	}
111
+
112
+	function setManualJoins($manualJoins)
113
+	{
114
+		$this->manualJoins = $manualJoins;
115
+		return $this;
116
+	}
117
+
118
+	function setGroup($group)
119
+	{
120
+		$this->group = $group;
121
+		return $this;
122
+	}
123
+
124
+	function setManualWheres($manualWheres)
125
+	{
126
+		$this->manualWheres = $manualWheres;
127
+		return $this;
128
+	}
129
+
130
+	function setWhereType($whereType)
131
+	{
132
+		$this->whereType = $whereType;
133
+		return $this;
134
+	}
135
+
136
+	/**
137
+	 * Создание критериев
138
+	 */
139
+	public function getCriteria()
140
+	{
141 141
         
142
-    }
142
+	}
143 143
 }
Please login to merge, or discard this patch.
src/RepositoryInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
 interface RepositoryInterface
11 11
 {
12 12
 
13
-    public function findById($id);
13
+	public function findById($id);
14 14
 
15
-    public function findBySpecification(ISpecificationCriteria $specification);
15
+	public function findBySpecification(ISpecificationCriteria $specification);
16 16
 
17
-    public function findAll();
17
+	public function findAll();
18 18
 
19
-    public function findAllBySpecification(ISpecificationCriteria $specification);
19
+	public function findAllBySpecification(ISpecificationCriteria $specification);
20 20
 
21
-    public function save(EntityInterface $Entity);
21
+	public function save(EntityInterface $Entity);
22 22
 
23
-    public function delete(EntityInterface $Entity);
23
+	public function delete(EntityInterface $Entity);
24 24
 }
Please login to merge, or discard this patch.
src/EntityInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
  */
9 9
 interface EntityInterface
10 10
 {
11
-    //put your code here
12
-    public function getId();
11
+	//put your code here
12
+	public function getId();
13 13
     
14
-    public function setId($id);
14
+	public function setId($id);
15 15
 	
16
-    public function getDeleted();
16
+	public function getDeleted();
17 17
     
18
-    public function setDeleted($delete);	
18
+	public function setDeleted($delete);	
19 19
 }
Please login to merge, or discard this patch.
tests/src/AbstractDataMapperTest.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		//-----------------
59 59
 		$mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields');
60 60
 
61
-        $this->assertEquals($mapping_fields, $correct);		
61
+		$this->assertEquals($mapping_fields, $correct);		
62 62
 	}		
63 63
 	
64 64
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		//-----------------
78 78
 		$mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields');
79 79
 
80
-        $this->assertEquals($mapping_fields, $correct);		
80
+		$this->assertEquals($mapping_fields, $correct);		
81 81
 	}		
82 82
 
83 83
 	/**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 		//-----------------
99 99
 		$mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields');
100 100
 
101
-        $this->assertEquals($mapping_fields, $correct);		
101
+		$this->assertEquals($mapping_fields, $correct);		
102 102
 	}	
103 103
 	
104 104
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		//-----------------
122 122
 		$mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields');
123 123
 
124
-        $this->assertEquals($mapping_fields, $correct);		
124
+		$this->assertEquals($mapping_fields, $correct);		
125 125
 		
126 126
 		$key_field = \TestHelper::getProtectedAttribute($this->object,'key');
127 127
 		$this->assertEquals($key_field, 'tb_mayfield');	
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		//-----------------
148 148
 		$mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields');
149 149
 
150
-        $this->assertEquals($mapping_fields, $correct);		
150
+		$this->assertEquals($mapping_fields, $correct);		
151 151
 		
152 152
 		$soft_delete_key = \TestHelper::getProtectedAttribute($this->object,'soft_delete_key');
153 153
 		$this->assertEquals($soft_delete_key, 'tb_mayfield');	
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,38 +3,38 @@
 block discarded – undo
3 3
 
4 4
 class TestHelper{
5 5
     
6
-    /**
7
-     * получение защищенного свойства
8
-     * @param type $o
9
-     * @param type $name
10
-     * @return type
11
-     */
12
-    static public function getProtectedAttribute($obj, $name)
13
-    {
14
-        $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass
15
-        $r = $reflectionClass->getProperty($name); //получаем свойство
16
-        $r->setAccessible(true); //делаем открытым
17
-        return $r->getValue($obj);
18
-    }
6
+	/**
7
+	 * получение защищенного свойства
8
+	 * @param type $o
9
+	 * @param type $name
10
+	 * @return type
11
+	 */
12
+	static public function getProtectedAttribute($obj, $name)
13
+	{
14
+		$reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass
15
+		$r = $reflectionClass->getProperty($name); //получаем свойство
16
+		$r->setAccessible(true); //делаем открытым
17
+		return $r->getValue($obj);
18
+	}
19 19
 
20
-    /**
21
-     * Добавление значения в защищенное свойтсво
22
-     * @param type $name
23
-     * @param type $valued 
24
-     */
25
-    private function setValueprotectedProperty($name, $value)
26
-    {
27
-        $reflectionClass = new \ReflectionClass($this->object); //создаем reflectionClass
28
-        $r = $reflectionClass->getProperty($name); //получаем свойство
29
-        $r->setAccessible(true); //делаем открытым
30
-        $r->setValue($this->object, $value); //изменяем значение
31
-    }    
20
+	/**
21
+	 * Добавление значения в защищенное свойтсво
22
+	 * @param type $name
23
+	 * @param type $valued 
24
+	 */
25
+	private function setValueprotectedProperty($name, $value)
26
+	{
27
+		$reflectionClass = new \ReflectionClass($this->object); //создаем reflectionClass
28
+		$r = $reflectionClass->getProperty($name); //получаем свойство
29
+		$r->setAccessible(true); //делаем открытым
30
+		$r->setValue($this->object, $value); //изменяем значение
31
+	}    
32 32
 	
33 33
 	static public function callMethod($obj, $name, array $args) {
34
-        $class = new \ReflectionClass($obj);
35
-        $method = $class->getMethod($name);
36
-        $method->setAccessible(true);
37
-        return $method->invokeArgs($obj, $args);
38
-    }	
34
+		$class = new \ReflectionClass($obj);
35
+		$method = $class->getMethod($name);
36
+		$method->setAccessible(true);
37
+		return $method->invokeArgs($obj, $args);
38
+	}	
39 39
     
40 40
 }
Please login to merge, or discard this patch.
src/AbstractDataMapper.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * таблица для сущности
20 20
 	 * @var type 
21 21
 	 */
22
-    protected $entityTable;	
22
+	protected $entityTable;	
23 23
 
24 24
 	/**
25 25
 	 * первичный ключ
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 
89 89
 	abstract protected function setMappingFields();	
90 90
 	
91
-    public function getAdapter() {
92
-        return $this->adapter;
93
-    }
91
+	public function getAdapter() {
92
+		return $this->adapter;
93
+	}
94 94
 
95 95
 	public function setAdapter(QueryBuilderInterface $adapter){
96 96
 		 $this->adapter = $adapter;
@@ -109,12 +109,12 @@  discard block
 block discarded – undo
109 109
 	}	
110 110
 
111 111
 
112
-    public function findById($id)
113
-    {
112
+	public function findById($id)
113
+	{
114 114
 		$Criteria = (new Specification())->setWhere($this->key , $id);
115 115
 		
116
-        return $this->findBySpecification($Criteria);
117
-    }	
116
+		return $this->findBySpecification($Criteria);
117
+	}	
118 118
 	
119 119
 	/**
120 120
 	 * Cохранение сущности
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	protected function buildEntity(EntityInterface $Entity, array $row){
212 212
 		
213
-        foreach ($this->mapping_fields as $alias => $cfg ) {
213
+		foreach ($this->mapping_fields as $alias => $cfg ) {
214 214
 			
215 215
 			$value = false;
216 216
 			
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 			if($value!==false)
248 248
 				$Entity->{$method_set}($value);
249 249
 			
250
-        }
250
+		}
251 251
 		
252
-        return $Entity;		
252
+		return $Entity;		
253 253
 	}	
254 254
 
255 255
 	
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		
264 264
 		$row = [];
265 265
 
266
-        foreach ($this->mapping_fields as $alias => $cfg ) {
266
+		foreach ($this->mapping_fields as $alias => $cfg ) {
267 267
 			
268 268
 			$field = $cfg['field'];
269 269
 			
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 						
294 294
 			$row[$field] = $value;
295 295
 
296
-        }
296
+		}
297 297
 
298
-        return $row;		
298
+		return $row;		
299 299
 	}	
300 300
 	
301 301
 	/**
@@ -367,10 +367,10 @@  discard block
 block discarded – undo
367 367
 		//получение записей
368 368
 		$res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);
369 369
 
370
-        if (!$row = $res->row_array()) {
371
-            return null;
372
-        }
373
-        return $this->createEntity($row);				
370
+		if (!$row = $res->row_array()) {
371
+			return null;
372
+		}
373
+		return $this->createEntity($row);				
374 374
 	}
375 375
 	
376 376
 	/**
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 		$res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);
413 413
 		
414 414
 		if (!$rows = $res->result_array()) {
415
-            return null;
416
-        }	
415
+			return null;
416
+		}	
417 417
 		
418 418
 		foreach($rows as $k =>  $row){
419 419
 			$rows[$k] = $this->createEntity($row);
Please login to merge, or discard this patch.