Completed
Push — develop ( 2e41bf...bd9eae )
by Michael
04:29
created
src/AbstractActiveRecord.php 2 patches
Doc Comments   +12 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param array $orderBy = []
217 217
 	 * @param int $limit = -1
218 218
 	 * @param int $offset = 0
219
-	 * @return Query the search query result with the given where, order by, limit and offset clauses.
219
+	 * @return \miBadger\Query\QueryResult the search query result with the given where, order by, limit and offset clauses.
220 220
 	 */
221 221
 	private function getSearchQueryResult(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
222 222
 	{
@@ -230,6 +230,9 @@  discard block
 block discarded – undo
230 230
 		return $query->execute();
231 231
 	}
232 232
 
233
+	/**
234
+	 * @param Query $query
235
+	 */
233 236
 	private function getSearchQueryWhere($query, $where)
234 237
 	{
235 238
 		foreach ($where as $key => $value) {
@@ -239,6 +242,9 @@  discard block
 block discarded – undo
239 242
 		return $query;
240 243
 	}
241 244
 
245
+	/**
246
+	 * @param Query $query
247
+	 */
242 248
 	private function getSearchQueryOrderBy($query, $orderBy)
243 249
 	{
244 250
 		foreach ($orderBy as $key => $value) {
@@ -248,6 +254,11 @@  discard block
 block discarded – undo
248 254
 		return $query;
249 255
 	}
250 256
 
257
+	/**
258
+	 * @param Query $query
259
+	 * @param integer $limit
260
+	 * @param integer $offset
261
+	 */
251 262
 	private function getSearchQueryLimit($query, $limit, $offset)
252 263
 	{
253 264
 		if ($limit > -1) {
Please login to merge, or discard this patch.
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -19,302 +19,302 @@
 block discarded – undo
19 19
  */
20 20
 abstract class AbstractActiveRecord implements ActiveRecordInterface
21 21
 {
22
-	/** @var \PDO The PDO object. */
23
-	private $pdo;
24
-
25
-	/** @var null|int The ID. */
26
-	private $id;
27
-
28
-	/**
29
-	 * Construct an abstract pdo active record with the given pdo.
30
-	 *
31
-	 * @param \PDO $pdo
32
-	 */
33
-	public function __construct(\PDO $pdo)
34
-	{
35
-		$pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
36
-		$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
37
-
38
-		$this->setPdo($pdo);
39
-	}
40
-
41
-	/**
42
-	 * {@inheritdoc}
43
-	 */
44
-	public function create()
45
-	{
46
-		try {
47
-			$queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
48
-				->insert($this->getActiveRecordColumns())
49
-				->execute();
50
-
51
-			$this->setId(intval($this->getPdo()->lastInsertId()));
52
-		} catch (\PDOException $e) {
53
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
54
-		}
55
-
56
-		return $this;
57
-	}
58
-
59
-	/**
60
-	 * {@inheritdoc}
61
-	 */
62
-	public function read($id)
63
-	{
64
-		try {
65
-			$result = (new Query($this->getPdo(), $this->getActiveRecordTable()))
66
-				->select()
67
-				->where('id', '=', $id)
68
-				->execute()
69
-				->fetch();
70
-
71
-			if ($result === false) {
72
-				throw new ActiveRecordException(sprintf('Can not read the non-existent active record entry %d from the `%s` table.', $id, $this->getActiveRecordTable()));
73
-			}
74
-
75
-			$this->fill($result);
76
-			$this->setId($id);
77
-		} catch (\PDOException $e) {
78
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
79
-		}
80
-
81
-		return $this;
82
-	}
83
-
84
-	/**
85
-	 * {@inheritdoc}
86
-	 */
87
-	public function update()
88
-	{
89
-		if (!$this->exists()) {
90
-			throw new ActiveRecordException(sprintf('Can not update a non-existent active record entry to the `%s` table.', $this->getActiveRecordTable()));
91
-		}
92
-
93
-		try {
94
-			$queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
95
-				->update($this->getActiveRecordColumns())
96
-				->where('id', '=', $this->getId())
97
-				->execute();
98
-		} catch (\PDOException $e) {
99
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
100
-		}
101
-
102
-		return $this;
103
-	}
104
-
105
-	/**
106
-	 * {@inheritdoc}
107
-	 */
108
-	public function delete()
109
-	{
110
-		if (!$this->exists()) {
111
-			throw new ActiveRecordException(sprintf('Can not delete a non-existent active record entry from the `%s` table.', $this->getActiveRecordTable()));
112
-		}
113
-
114
-		try {
115
-			$queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
116
-				->delete()
117
-				->where('id', '=', $this->getId())
118
-				->execute();
119
-
120
-			$this->setId(null);
121
-		} catch (\PDOException $e) {
122
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
123
-		}
124
-
125
-		return $this;
126
-	}
127
-
128
-	/**
129
-	 * {@inheritdoc}
130
-	 */
131
-	public function sync()
132
-	{
133
-		if (!$this->exists()) {
134
-			return $this->create();
135
-		}
136
-
137
-		return $this->update();
138
-	}
139
-
140
-	/**
141
-	 * {@inheritdoc}
142
-	 */
143
-	public function exists()
144
-	{
145
-		return $this->getId() !== null;
146
-	}
147
-
148
-	/**
149
-	 * Fill the active record
150
-	 *
151
-	 * @param array $fetch
152
-	 * @return null
153
-	 */
154
-	public function fill(array $fetch)
155
-	{
156
-		$data = $this->getActiveRecordColumns();
157
-
158
-		foreach ($data as $key => &$value) {
159
-			if (!array_key_exists($key, $fetch)) {
160
-				throw new ActiveRecordException(sprintf('Can not read the expected column `%s`. It\'s not returnd by the `%s` table', $key, $this->getActiveRecordTable()));
161
-			}
162
-
163
-			$value = $fetch[$key];
164
-		}
165
-	}
166
-
167
-	/**
168
-	 * {@inheritdoc}
169
-	 */
170
-	public function searchOne(array $where = [], array $orderBy = [])
171
-	{
172
-		try {
173
-			$result = $this->getSearchQueryResult($where, $orderBy, 1)->fetch();
174
-
175
-			if ($result === false) {
176
-				throw new ActiveRecordException(sprintf('Can not search one non-existent entry from the `%s` table.', $this->getActiveRecordTable()));
177
-			}
178
-
179
-			$this->fill($result);
180
-			$this->setId(intval($result['id']));
181
-
182
-			return $this;
183
-		} catch (\PDOException $e) {
184
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
185
-		}
186
-	}
187
-
188
-	/**
189
-	 * {@inheritdoc}
190
-	 */
191
-	public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
192
-	{
193
-		try {
194
-			$queryResult = $this->getSearchQueryResult($where, $orderBy, $limit, $offset);
195
-			$result = [];
196
-
197
-			foreach ($queryResult as $fetch) {
198
-				$new = new static($this->getPdo());
199
-
200
-				$new->setId(intval($fetch['id']));
201
-				$new->fill($fetch);
202
-
203
-				$result[] = $new;
204
-			}
205
-
206
-			return $result;
207
-		} catch (\PDOException $e) {
208
-			throw new ActiveRecordException($e->getMessage(), 0, $e);
209
-		}
210
-	}
211
-
212
-	/**
213
-	 * Returns the search query result with the given where, order by, limit and offset clauses.
214
-	 *
215
-	 * @param array $where = []
216
-	 * @param array $orderBy = []
217
-	 * @param int $limit = -1
218
-	 * @param int $offset = 0
219
-	 * @return Query the search query result with the given where, order by, limit and offset clauses.
220
-	 */
221
-	private function getSearchQueryResult(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
222
-	{
223
-		$query = (new Query($this->getPdo(), $this->getActiveRecordTable()))
224
-			->select();
225
-
226
-		$this->getSearchQueryWhere($query, $where);
227
-		$this->getSearchQueryOrderBy($query, $orderBy);
228
-		$this->getSearchQueryLimit($query, $limit, $offset);
229
-
230
-		return $query->execute();
231
-	}
232
-
233
-	private function getSearchQueryWhere($query, $where)
234
-	{
235
-		foreach ($where as $key => $value) {
236
-			$query->where($value[0], $value[1], $value[2]);
237
-		}
238
-
239
-		return $query;
240
-	}
241
-
242
-	private function getSearchQueryOrderBy($query, $orderBy)
243
-	{
244
-		foreach ($orderBy as $key => $value) {
245
-			$query->orderBy($key, $value);
246
-		}
247
-
248
-		return $query;
249
-	}
250
-
251
-	private function getSearchQueryLimit($query, $limit, $offset)
252
-	{
253
-		if ($limit > -1) {
254
-			$query->limit($limit);
255
-			$query->offset($offset);
256
-		}
257
-
258
-		return $query;
259
-	}
260
-
261
-	/**
262
-	 * Returns the PDO.
263
-	 *
264
-	 * @return \PDO the PDO.
265
-	 */
266
-	public function getPdo()
267
-	{
268
-		return $this->pdo;
269
-	}
270
-
271
-	/**
272
-	 * Set the PDO.
273
-	 *
274
-	 * @param \PDO $pdo
275
-	 * @return $this
276
-	 */
277
-	protected function setPdo($pdo)
278
-	{
279
-		$this->pdo = $pdo;
280
-
281
-		return $this;
282
-	}
283
-
284
-	/**
285
-	 * Returns the ID.
286
-	 *
287
-	 * @return null|int The ID.
288
-	 */
289
-	public function getId()
290
-	{
291
-		return $this->id;
292
-	}
293
-
294
-	/**
295
-	 * Set the ID.
296
-	 *
297
-	 * @param int $id
298
-	 * @return $this
299
-	 */
300
-	protected function setId($id)
301
-	{
302
-		$this->id = $id;
303
-
304
-		return $this;
305
-	}
306
-
307
-	/**
308
-	 * Returns the active record table.
309
-	 *
310
-	 * @return string the active record table.
311
-	 */
312
-	abstract protected function getActiveRecordTable();
313
-
314
-	/**
315
-	 * Returns the active record columns.
316
-	 *
317
-	 * @return array the active record columns.
318
-	 */
319
-	abstract protected function getActiveRecordColumns();
22
+    /** @var \PDO The PDO object. */
23
+    private $pdo;
24
+
25
+    /** @var null|int The ID. */
26
+    private $id;
27
+
28
+    /**
29
+     * Construct an abstract pdo active record with the given pdo.
30
+     *
31
+     * @param \PDO $pdo
32
+     */
33
+    public function __construct(\PDO $pdo)
34
+    {
35
+        $pdo->setAttribute(\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC);
36
+        $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
37
+
38
+        $this->setPdo($pdo);
39
+    }
40
+
41
+    /**
42
+     * {@inheritdoc}
43
+     */
44
+    public function create()
45
+    {
46
+        try {
47
+            $queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
48
+                ->insert($this->getActiveRecordColumns())
49
+                ->execute();
50
+
51
+            $this->setId(intval($this->getPdo()->lastInsertId()));
52
+        } catch (\PDOException $e) {
53
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
54
+        }
55
+
56
+        return $this;
57
+    }
58
+
59
+    /**
60
+     * {@inheritdoc}
61
+     */
62
+    public function read($id)
63
+    {
64
+        try {
65
+            $result = (new Query($this->getPdo(), $this->getActiveRecordTable()))
66
+                ->select()
67
+                ->where('id', '=', $id)
68
+                ->execute()
69
+                ->fetch();
70
+
71
+            if ($result === false) {
72
+                throw new ActiveRecordException(sprintf('Can not read the non-existent active record entry %d from the `%s` table.', $id, $this->getActiveRecordTable()));
73
+            }
74
+
75
+            $this->fill($result);
76
+            $this->setId($id);
77
+        } catch (\PDOException $e) {
78
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
79
+        }
80
+
81
+        return $this;
82
+    }
83
+
84
+    /**
85
+     * {@inheritdoc}
86
+     */
87
+    public function update()
88
+    {
89
+        if (!$this->exists()) {
90
+            throw new ActiveRecordException(sprintf('Can not update a non-existent active record entry to the `%s` table.', $this->getActiveRecordTable()));
91
+        }
92
+
93
+        try {
94
+            $queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
95
+                ->update($this->getActiveRecordColumns())
96
+                ->where('id', '=', $this->getId())
97
+                ->execute();
98
+        } catch (\PDOException $e) {
99
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
100
+        }
101
+
102
+        return $this;
103
+    }
104
+
105
+    /**
106
+     * {@inheritdoc}
107
+     */
108
+    public function delete()
109
+    {
110
+        if (!$this->exists()) {
111
+            throw new ActiveRecordException(sprintf('Can not delete a non-existent active record entry from the `%s` table.', $this->getActiveRecordTable()));
112
+        }
113
+
114
+        try {
115
+            $queryResult = (new Query($this->getPdo(), $this->getActiveRecordTable()))
116
+                ->delete()
117
+                ->where('id', '=', $this->getId())
118
+                ->execute();
119
+
120
+            $this->setId(null);
121
+        } catch (\PDOException $e) {
122
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
123
+        }
124
+
125
+        return $this;
126
+    }
127
+
128
+    /**
129
+     * {@inheritdoc}
130
+     */
131
+    public function sync()
132
+    {
133
+        if (!$this->exists()) {
134
+            return $this->create();
135
+        }
136
+
137
+        return $this->update();
138
+    }
139
+
140
+    /**
141
+     * {@inheritdoc}
142
+     */
143
+    public function exists()
144
+    {
145
+        return $this->getId() !== null;
146
+    }
147
+
148
+    /**
149
+     * Fill the active record
150
+     *
151
+     * @param array $fetch
152
+     * @return null
153
+     */
154
+    public function fill(array $fetch)
155
+    {
156
+        $data = $this->getActiveRecordColumns();
157
+
158
+        foreach ($data as $key => &$value) {
159
+            if (!array_key_exists($key, $fetch)) {
160
+                throw new ActiveRecordException(sprintf('Can not read the expected column `%s`. It\'s not returnd by the `%s` table', $key, $this->getActiveRecordTable()));
161
+            }
162
+
163
+            $value = $fetch[$key];
164
+        }
165
+    }
166
+
167
+    /**
168
+     * {@inheritdoc}
169
+     */
170
+    public function searchOne(array $where = [], array $orderBy = [])
171
+    {
172
+        try {
173
+            $result = $this->getSearchQueryResult($where, $orderBy, 1)->fetch();
174
+
175
+            if ($result === false) {
176
+                throw new ActiveRecordException(sprintf('Can not search one non-existent entry from the `%s` table.', $this->getActiveRecordTable()));
177
+            }
178
+
179
+            $this->fill($result);
180
+            $this->setId(intval($result['id']));
181
+
182
+            return $this;
183
+        } catch (\PDOException $e) {
184
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
185
+        }
186
+    }
187
+
188
+    /**
189
+     * {@inheritdoc}
190
+     */
191
+    public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
192
+    {
193
+        try {
194
+            $queryResult = $this->getSearchQueryResult($where, $orderBy, $limit, $offset);
195
+            $result = [];
196
+
197
+            foreach ($queryResult as $fetch) {
198
+                $new = new static($this->getPdo());
199
+
200
+                $new->setId(intval($fetch['id']));
201
+                $new->fill($fetch);
202
+
203
+                $result[] = $new;
204
+            }
205
+
206
+            return $result;
207
+        } catch (\PDOException $e) {
208
+            throw new ActiveRecordException($e->getMessage(), 0, $e);
209
+        }
210
+    }
211
+
212
+    /**
213
+     * Returns the search query result with the given where, order by, limit and offset clauses.
214
+     *
215
+     * @param array $where = []
216
+     * @param array $orderBy = []
217
+     * @param int $limit = -1
218
+     * @param int $offset = 0
219
+     * @return Query the search query result with the given where, order by, limit and offset clauses.
220
+     */
221
+    private function getSearchQueryResult(array $where = [], array $orderBy = [], $limit = -1, $offset = 0)
222
+    {
223
+        $query = (new Query($this->getPdo(), $this->getActiveRecordTable()))
224
+            ->select();
225
+
226
+        $this->getSearchQueryWhere($query, $where);
227
+        $this->getSearchQueryOrderBy($query, $orderBy);
228
+        $this->getSearchQueryLimit($query, $limit, $offset);
229
+
230
+        return $query->execute();
231
+    }
232
+
233
+    private function getSearchQueryWhere($query, $where)
234
+    {
235
+        foreach ($where as $key => $value) {
236
+            $query->where($value[0], $value[1], $value[2]);
237
+        }
238
+
239
+        return $query;
240
+    }
241
+
242
+    private function getSearchQueryOrderBy($query, $orderBy)
243
+    {
244
+        foreach ($orderBy as $key => $value) {
245
+            $query->orderBy($key, $value);
246
+        }
247
+
248
+        return $query;
249
+    }
250
+
251
+    private function getSearchQueryLimit($query, $limit, $offset)
252
+    {
253
+        if ($limit > -1) {
254
+            $query->limit($limit);
255
+            $query->offset($offset);
256
+        }
257
+
258
+        return $query;
259
+    }
260
+
261
+    /**
262
+     * Returns the PDO.
263
+     *
264
+     * @return \PDO the PDO.
265
+     */
266
+    public function getPdo()
267
+    {
268
+        return $this->pdo;
269
+    }
270
+
271
+    /**
272
+     * Set the PDO.
273
+     *
274
+     * @param \PDO $pdo
275
+     * @return $this
276
+     */
277
+    protected function setPdo($pdo)
278
+    {
279
+        $this->pdo = $pdo;
280
+
281
+        return $this;
282
+    }
283
+
284
+    /**
285
+     * Returns the ID.
286
+     *
287
+     * @return null|int The ID.
288
+     */
289
+    public function getId()
290
+    {
291
+        return $this->id;
292
+    }
293
+
294
+    /**
295
+     * Set the ID.
296
+     *
297
+     * @param int $id
298
+     * @return $this
299
+     */
300
+    protected function setId($id)
301
+    {
302
+        $this->id = $id;
303
+
304
+        return $this;
305
+    }
306
+
307
+    /**
308
+     * Returns the active record table.
309
+     *
310
+     * @return string the active record table.
311
+     */
312
+    abstract protected function getActiveRecordTable();
313
+
314
+    /**
315
+     * Returns the active record columns.
316
+     *
317
+     * @return array the active record columns.
318
+     */
319
+    abstract protected function getActiveRecordColumns();
320 320
 }
Please login to merge, or discard this patch.
src/ActiveRecordInterface.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -19,83 +19,83 @@
 block discarded – undo
19 19
  */
20 20
 interface ActiveRecordInterface
21 21
 {
22
-	/**
23
-	 * Returns this active record after creating an entry with the records attributes.
24
-	 *
25
-	 * @return $this
26
-	 * @throws ActiveRecordException on failure.
27
-	 */
28
-	public function create();
22
+    /**
23
+     * Returns this active record after creating an entry with the records attributes.
24
+     *
25
+     * @return $this
26
+     * @throws ActiveRecordException on failure.
27
+     */
28
+    public function create();
29 29
 
30
-	/**
31
-	 * Returns this active record after reading the attributes from the entry with the given identifier.
32
-	 *
33
-	 * @param mixed $id
34
-	 * @return $this
35
-	 * @throws ActiveRecordException on failure.
36
-	 */
37
-	public function read($id);
30
+    /**
31
+     * Returns this active record after reading the attributes from the entry with the given identifier.
32
+     *
33
+     * @param mixed $id
34
+     * @return $this
35
+     * @throws ActiveRecordException on failure.
36
+     */
37
+    public function read($id);
38 38
 
39
-	/**
40
-	 * Returns this active record after updating the attributes to the corresponding entry.
41
-	 *
42
-	 * @return $this
43
-	 * @throws ActiveRecordException on failure.
44
-	 */
45
-	public function update();
39
+    /**
40
+     * Returns this active record after updating the attributes to the corresponding entry.
41
+     *
42
+     * @return $this
43
+     * @throws ActiveRecordException on failure.
44
+     */
45
+    public function update();
46 46
 
47
-	/**
48
-	 * Returns this record after deleting the corresponding entry.
49
-	 *
50
-	 * @return $this
51
-	 * @throws ActiveRecordException on failure.
52
-	 */
53
-	public function delete();
47
+    /**
48
+     * Returns this record after deleting the corresponding entry.
49
+     *
50
+     * @return $this
51
+     * @throws ActiveRecordException on failure.
52
+     */
53
+    public function delete();
54 54
 
55
-	/**
56
-	 * Returns this record after synchronizing it with the corresponding entry.
57
-	 * A new entry is created if this active record does not have a corresponding entry.
58
-	 *
59
-	 * @return $this
60
-	 * @throws ActiveRecordException on failure.
61
-	 */
62
-	public function sync();
55
+    /**
56
+     * Returns this record after synchronizing it with the corresponding entry.
57
+     * A new entry is created if this active record does not have a corresponding entry.
58
+     *
59
+     * @return $this
60
+     * @throws ActiveRecordException on failure.
61
+     */
62
+    public function sync();
63 63
 
64
-	/**
65
-	 * Returns true if this active record has a corresponding entry.
66
-	 *
67
-	 * @return bool true if this active record has a corresponding entry.
68
-	 */
69
-	public function exists();
64
+    /**
65
+     * Returns true if this active record has a corresponding entry.
66
+     *
67
+     * @return bool true if this active record has a corresponding entry.
68
+     */
69
+    public function exists();
70 70
 
71
-	/**
72
-	 * Returns this record after filling it with the given attributes.
73
-	 *
74
-	 * @param array $attributes = []
75
-	 * @return $this
76
-	 * @throws ActiveRecordException on failure.
77
-	 */
78
-	public function fill(array $attributes);
71
+    /**
72
+     * Returns this record after filling it with the given attributes.
73
+     *
74
+     * @param array $attributes = []
75
+     * @return $this
76
+     * @throws ActiveRecordException on failure.
77
+     */
78
+    public function fill(array $attributes);
79 79
 
80
-	/**
81
-	 * Returns this record after filling it with the attributes of the first entry with the given where and order by clauses.
82
-	 *
83
-	 * @param array $where = []
84
-	 * @param array $orderBy = []
85
-	 * @return $this
86
-	 * @throws ActiveRecordException on failure.
87
-	 */
88
-	public function searchOne(array $where = [], array $orderBy = []);
80
+    /**
81
+     * Returns this record after filling it with the attributes of the first entry with the given where and order by clauses.
82
+     *
83
+     * @param array $where = []
84
+     * @param array $orderBy = []
85
+     * @return $this
86
+     * @throws ActiveRecordException on failure.
87
+     */
88
+    public function searchOne(array $where = [], array $orderBy = []);
89 89
 
90
-	/**
91
-	 * Returns the records with the given where, order by, limit and offset clauses.
92
-	 *
93
-	 * @param array $where = []
94
-	 * @param array $orderBy = []
95
-	 * @param int $limit = -1
96
-	 * @param int $offset = 0
97
-	 * @return static[] the records with the given where, order by, limit and offset clauses.
98
-	 * @throws ActiveRecordException on failure.
99
-	 */
100
-	public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0);
90
+    /**
91
+     * Returns the records with the given where, order by, limit and offset clauses.
92
+     *
93
+     * @param array $where = []
94
+     * @param array $orderBy = []
95
+     * @param int $limit = -1
96
+     * @param int $offset = 0
97
+     * @return static[] the records with the given where, order by, limit and offset clauses.
98
+     * @throws ActiveRecordException on failure.
99
+     */
100
+    public function search(array $where = [], array $orderBy = [], $limit = -1, $offset = 0);
101 101
 }
Please login to merge, or discard this patch.