Passed
Push — master ( 800a7c...2f3156 )
by dima
03:06
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/AbstractDataMapper.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 {
12 12
 	protected $db;
13 13
 	
14
-    protected $entityTable;	
14
+	protected $entityTable;	
15 15
 	
16 16
 	protected $key;
17 17
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	protected $use_joins = false;
24 24
 
25 25
 	public function __construct( QueryBuilderInterface $adapter, $db_name = null) {// \CI_DB_mysqli_driver //DatabaseAdapterInterface
26
-        $this->db = $adapter;
26
+		$this->db = $adapter;
27 27
 		
28 28
 		$this->entityTable = !empty($db_name)? "$db_name.".$this->setEntityTable() : $this->setEntityTable();
29 29
 		
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		if($this->getEntityTable()=='' || $this->getPrimaryKey()==''){
33 33
 			throw new InvalidEntityPropertyException('Свойства entityTable или key не заданы');
34 34
 		}
35
-    }
35
+	}
36 36
 	
37 37
 	
38 38
 	
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 		return $this->entityTable;
41 41
 	}
42 42
 
43
-    public function getAdapter() {
44
-        return $this->db;
45
-    }
43
+	public function getAdapter() {
44
+		return $this->db;
45
+	}
46 46
 
47
-    public function findById($id)
48
-    {
47
+	public function findById($id)
48
+	{
49 49
 		$Criteria = (new Specification())->setWhere($this->key , $id);
50 50
 		
51
-        return $this->findBySpecification($Criteria);
52
-    }	
51
+		return $this->findBySpecification($Criteria);
52
+	}	
53 53
 	
54 54
 	/**
55 55
 	 * Cохранение сущности
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 		$row = [];
104 104
 		
105
-        foreach ($mapfileds as $propery => $field ) {
105
+		foreach ($mapfileds as $propery => $field ) {
106 106
 			
107 107
 			$method_get = 'get' . ucfirst($propery);
108 108
 			
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 			}			
119 119
 			$row[$field] = $value;
120 120
 
121
-        }
121
+		}
122 122
 
123
-        return $row;		
123
+		return $row;		
124 124
 	}		
125 125
 	
126 126
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		
136 136
 		$mapfields = array_merge([ 'id' => $this->key], $this->setMappingFields());
137 137
 
138
-        foreach ($mapfields as $propery => $field ) {
138
+		foreach ($mapfields as $propery => $field ) {
139 139
 			
140 140
 			$value = false;
141 141
 			
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 			if($value!==false)
157 157
 				$Entity->{$method_set}($value);
158 158
 			
159
-        }
159
+		}
160 160
 		
161
-        return $Entity;		
161
+		return $Entity;		
162 162
 	}	
163 163
 	
164 164
 	
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 		//получение записей
188 188
 		$res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);
189 189
 
190
-        if (!$row = $res->row_array()) {
191
-            return null;
192
-        }
193
-        return $this->createEntity($row);				
190
+		if (!$row = $res->row_array()) {
191
+			return null;
192
+		}
193
+		return $this->createEntity($row);				
194 194
 	}
195 195
 	
196 196
 	/**
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 		$res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification);
233 233
 		
234 234
 		if (!$rows = $res->result_array()) {
235
-            return null;
236
-        }	
235
+			return null;
236
+		}	
237 237
 		
238 238
 		foreach($rows as $k =>  $row){
239 239
 			$rows[$k] = $this->createEntity($row);
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/AbstractOptDataMapper.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	protected function buildEntity(EntityInterface $Entity, array $row){
97 97
 		
98
-        foreach ($this->mapping_fields as $alias => $cfg ) {
98
+		foreach ($this->mapping_fields as $alias => $cfg ) {
99 99
 			
100 100
 			$value = false;
101 101
 			
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			if($value!==false)
133 133
 				$Entity->{$method_set}($value);
134 134
 			
135
-        }
135
+		}
136 136
 		
137
-        return $Entity;		
137
+		return $Entity;		
138 138
 	}	
139 139
 
140 140
 	
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		
149 149
 		$row = [];
150 150
 
151
-        foreach ($this->mapping_fields as $alias => $cfg ) {
151
+		foreach ($this->mapping_fields as $alias => $cfg ) {
152 152
 			
153 153
 			$field = $cfg['field'];
154 154
 			
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 						
179 179
 			$row[$field] = $value;
180 180
 
181
-        }
181
+		}
182 182
 
183
-        return $row;		
183
+		return $row;		
184 184
 	}	
185 185
 	
186 186
 	
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 		/**
194
-	 * Построение join-ов
195
-	 */
194
+		 * Построение join-ов
195
+		 */
196 196
 	protected function setRelations(ISpecificationCriteria $Specification){
197 197
 
198 198
 		$joins = [];
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.