Skip to content

Commit a2ad508

Browse files
committed
docs: update comments
1 parent fb102fb commit a2ad508

File tree

2 files changed

+45
-44
lines changed

2 files changed

+45
-44
lines changed

system/BaseModel.php

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ protected function initialize()
312312
}
313313

314314
/**
315-
* Fetches the row of database
316-
* This methods works only with dbCalls
315+
* Fetches the row of database.
316+
* This method works only with dbCalls.
317317
*
318318
* @param bool $singleton Single or multiple results
319319
* @param array|int|string|null $id One primary key or an array of primary keys
@@ -323,8 +323,8 @@ protected function initialize()
323323
abstract protected function doFind(bool $singleton, $id = null);
324324

325325
/**
326-
* Fetches the column of database
327-
* This methods works only with dbCalls
326+
* Fetches the column of database.
327+
* This method works only with dbCalls.
328328
*
329329
* @param string $columnName Column Name
330330
*
@@ -336,7 +336,7 @@ abstract protected function doFindColumn(string $columnName);
336336

337337
/**
338338
* Fetches all results, while optionally limiting them.
339-
* This methods works only with dbCalls
339+
* This method works only with dbCalls.
340340
*
341341
* @param int $limit Limit
342342
* @param int $offset Offset
@@ -347,15 +347,15 @@ abstract protected function doFindAll(int $limit = 0, int $offset = 0);
347347

348348
/**
349349
* Returns the first row of the result set.
350-
* This methods works only with dbCalls
350+
* This method works only with dbCalls.
351351
*
352352
* @return array|object|null
353353
*/
354354
abstract protected function doFirst();
355355

356356
/**
357-
* Inserts data into the current database
358-
* This method works only with dbCalls
357+
* Inserts data into the current database.
358+
* This method works only with dbCalls.
359359
*
360360
* @param array $data Data
361361
*
@@ -365,7 +365,7 @@ abstract protected function doInsert(array $data);
365365

366366
/**
367367
* Compiles batch insert and runs the queries, validating each row prior.
368-
* This methods works only with dbCalls
368+
* This method works only with dbCalls.
369369
*
370370
* @param array|null $set An associative array of insert values
371371
* @param bool|null $escape Whether to escape values
@@ -378,16 +378,16 @@ abstract protected function doInsertBatch(?array $set = null, ?bool $escape = nu
378378

379379
/**
380380
* Updates a single record in the database.
381-
* This methods works only with dbCalls
381+
* This method works only with dbCalls.
382382
*
383383
* @param array|int|string|null $id ID
384384
* @param array|null $data Data
385385
*/
386386
abstract protected function doUpdate($id = null, $data = null): bool;
387387

388388
/**
389-
* Compiles an update and runs the query
390-
* This methods works only with dbCalls
389+
* Compiles an update and runs the query.
390+
* This method works only with dbCalls.
391391
*
392392
* @param array|null $set An associative array of update values
393393
* @param string|null $index The where key
@@ -401,8 +401,8 @@ abstract protected function doUpdate($id = null, $data = null): bool;
401401
abstract protected function doUpdateBatch(?array $set = null, ?string $index = null, int $batchSize = 100, bool $returnSQL = false);
402402

403403
/**
404-
* Deletes a single record from the database where $id matches
405-
* This methods works only with dbCalls
404+
* Deletes a single record from the database where $id matches.
405+
* This method works only with dbCalls.
406406
*
407407
* @param array|int|string|null $id The rows primary key(s)
408408
* @param bool $purge Allows overriding the soft deletes setting.
@@ -414,9 +414,9 @@ abstract protected function doUpdateBatch(?array $set = null, ?string $index = n
414414
abstract protected function doDelete($id = null, bool $purge = false);
415415

416416
/**
417-
* Permanently deletes all rows that have been marked as deleted
418-
* through soft deletes (deleted = 1)
419-
* This methods works only with dbCalls
417+
* Permanently deletes all rows that have been marked as deleted.
418+
* through soft deletes (deleted = 1).
419+
* This method works only with dbCalls.
420420
*
421421
* @return bool|string Returns a string if in test mode.
422422
*/
@@ -425,13 +425,13 @@ abstract protected function doPurgeDeleted();
425425
/**
426426
* Works with the find* methods to return only the rows that
427427
* have been deleted.
428-
* This methods works only with dbCalls
428+
* This method works only with dbCalls.
429429
*/
430430
abstract protected function doOnlyDeleted();
431431

432432
/**
433-
* Compiles a replace and runs the query
434-
* This methods works only with dbCalls
433+
* Compiles a replace and runs the query.
434+
* This method works only with dbCalls.
435435
*
436436
* @param array|null $data Data
437437
* @param bool $returnSQL Set to true to return Query String
@@ -442,14 +442,14 @@ abstract protected function doReplace(?array $data = null, bool $returnSQL = fal
442442

443443
/**
444444
* Grabs the last error(s) that occurred from the Database connection.
445-
* This methods works only with dbCalls
445+
* This method works only with dbCalls.
446446
*
447447
* @return array|null
448448
*/
449449
abstract protected function doErrors();
450450

451451
/**
452-
* Returns the id value for the data array or object
452+
* Returns the id value for the data array or object.
453453
*
454454
* @param array|object $data Data
455455
*
@@ -460,8 +460,8 @@ abstract protected function doErrors();
460460
abstract protected function idValue($data);
461461

462462
/**
463-
* Public getter to return the id value using the idValue() method
464-
* For example with SQL this will return $data->$this->primaryKey
463+
* Public getter to return the id value using the idValue() method.
464+
* For example with SQL this will return $data->$this->primaryKey.
465465
*
466466
* @param array|object $data
467467
*
@@ -476,7 +476,7 @@ public function getIdValue($data)
476476

477477
/**
478478
* Override countAllResults to account for soft deleted accounts.
479-
* This methods works only with dbCalls
479+
* This method works only with dbCalls.
480480
*
481481
* @param bool $reset Reset
482482
* @param bool $test Test
@@ -487,7 +487,7 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
487487

488488
/**
489489
* Loops over records in batches, allowing you to operate on them.
490-
* This methods works only with dbCalls
490+
* This method works only with dbCalls.
491491
*
492492
* @param int $size Size
493493
* @param Closure $userFunc Callback Function
@@ -497,7 +497,7 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
497497
abstract public function chunk(int $size, Closure $userFunc);
498498

499499
/**
500-
* Fetches the row of database
500+
* Fetches the row of database.
501501
*
502502
* @param array|int|string|null $id One primary key or an array of primary keys
503503
*
@@ -539,7 +539,7 @@ public function find($id = null)
539539
}
540540

541541
/**
542-
* Fetches the column of database
542+
* Fetches the column of database.
543543
*
544544
* @param string $columnName Column Name
545545
*
@@ -668,8 +668,8 @@ public function save($data): bool
668668
}
669669

670670
/**
671-
* This method is called on save to determine if entry have to be updated
672-
* If this method return false insert operation will be executed
671+
* This method is called on save to determine if entry have to be updated.
672+
* If this method returns false insert operation will be executed
673673
*
674674
* @param array|object $data Data
675675
*/
@@ -720,7 +720,7 @@ public function insert($data = null, bool $returnID = true)
720720
// Restore $cleanValidationRules
721721
$this->cleanValidationRules = $cleanValidationRules;
722722

723-
// Must be called first so we don't
723+
// Must be called first, so we don't
724724
// strip out created_at values.
725725
$data = $this->doProtectFields($data);
726726

@@ -897,7 +897,7 @@ public function update($id = null, $data = null): bool
897897
}
898898

899899
/**
900-
* Compiles an update and runs the query
900+
* Compiles an update and runs the query.
901901
*
902902
* @param array|null $set An associative array of update values
903903
* @param string|null $index The where key
@@ -954,7 +954,7 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
954954
}
955955

956956
/**
957-
* Deletes a single record from the database where $id matches
957+
* Deletes a single record from the database where $id matches.
958958
*
959959
* @param array|int|string|null $id The rows primary key(s)
960960
* @param bool $purge Allows overriding the soft deletes setting.
@@ -996,7 +996,7 @@ public function delete($id = null, bool $purge = false)
996996

997997
/**
998998
* Permanently deletes all rows that have been marked as deleted
999-
* through soft deletes (deleted = 1)
999+
* through soft deletes (deleted = 1).
10001000
*
10011001
* @return bool|string Returns a string if in test mode.
10021002
*/
@@ -1039,7 +1039,7 @@ public function onlyDeleted()
10391039
}
10401040

10411041
/**
1042-
* Compiles a replace and runs the query
1042+
* Compiles a replace and runs the query.
10431043
*
10441044
* @param array|null $data Data
10451045
* @param bool $returnSQL Set to true to return Query String
@@ -1064,6 +1064,7 @@ public function replace(?array $data = null, bool $returnSQL = false)
10641064
* Grabs the last error(s) that occurred. If data was validated,
10651065
* it will first check for errors there, otherwise will try to
10661066
* grab the last error from the Database connection.
1067+
*
10671068
* The return array should be in the following format:
10681069
* ['source' => 'message']
10691070
*
@@ -1171,7 +1172,7 @@ protected function doProtectFields(array $data): array
11711172
}
11721173

11731174
/**
1174-
* Sets the date or current date if null value is passed
1175+
* Sets the date or current date if null value is passed.
11751176
*
11761177
* @param int|null $userData An optional PHP timestamp to be converted.
11771178
*
@@ -1221,7 +1222,7 @@ protected function intToDate(int $value)
12211222
}
12221223

12231224
/**
1224-
* Converts Time value to string using $this->dateFormat
1225+
* Converts Time value to string using $this->dateFormat.
12251226
*
12261227
* The available time formats are:
12271228
* - 'int' - Stores the date as an integer timestamp
@@ -1398,7 +1399,7 @@ public function getValidationRules(array $options = []): array
13981399
}
13991400

14001401
/**
1401-
* Returns the model's define validation messages so they
1402+
* Returns the model's define validation messages, so they
14021403
* can be used elsewhere, if needed.
14031404
*/
14041405
public function getValidationMessages(): array
@@ -1455,7 +1456,7 @@ public function allowCallbacks(bool $val = true)
14551456
*
14561457
* Each $eventData array MUST have a 'data' key with the relevant
14571458
* data for callback methods (like an array of key/value pairs to insert
1458-
* or update, an array of results, etc)
1459+
* or update, an array of results, etc.)
14591460
*
14601461
* If callbacks are not allowed then returns $eventData immediately.
14611462
*
@@ -1514,14 +1515,14 @@ public function asObject(string $class = 'object')
15141515
}
15151516

15161517
/**
1517-
* Takes a class and returns an array of it's public and protected
1518+
* Takes a class and returns an array of its public and protected
15181519
* properties as an array suitable for use in creates and updates.
15191520
* This method uses objectToRawArray() internally and does conversion
15201521
* to string on all Time instances
15211522
*
15221523
* @param object|string $data Data
15231524
* @param bool $onlyChanged Only Changed Property
1524-
* @param bool $recursive If true, inner entities will be casted as array as well
1525+
* @param bool $recursive If true, inner entities will be cast as array as well
15251526
*
15261527
* @return array Array
15271528
*
@@ -1580,7 +1581,7 @@ protected function objectToRawArray($data, bool $onlyChanged = true, bool $recur
15801581
}
15811582

15821583
/**
1583-
* Transform data to array
1584+
* Transform data to array.
15841585
*
15851586
* @param array|object|null $data Data
15861587
* @param string $type Type of data (insert|update)

system/Model.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ protected function doInsert(array $data)
263263
$escape = $this->escape;
264264
$this->escape = [];
265265

266-
// Require non empty primaryKey when
266+
// Require non-empty primaryKey when
267267
// not using auto-increment feature
268268
if (! $this->useAutoIncrement && empty($data[$this->primaryKey])) {
269269
throw DataException::forEmptyPrimaryKey('insert');
@@ -301,7 +301,7 @@ protected function doInsertBatch(?array $set = null, ?bool $escape = null, int $
301301
{
302302
if (is_array($set)) {
303303
foreach ($set as $row) {
304-
// Require non empty primaryKey when
304+
// Require non-empty primaryKey when
305305
// not using auto-increment feature
306306
if (! $this->useAutoIncrement && empty($row[$this->primaryKey])) {
307307
throw DataException::forEmptyPrimaryKey('insertBatch');

0 commit comments

Comments
 (0)