Skip to content

Commit

Permalink
style: Format code with php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
deepsource-autofix[bot] authored and tchalvak committed Sep 13, 2023
1 parent c9b586a commit 197d8d5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions deploy/lib/data/NWQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@
use PDOStatement;

/**
* Acts as a mini model and query builder with an ActiveRecord pattern
* Acts as a mini model and query builder with an ActiveRecord pattern
* (e.g. Message::find(id) $message->save(), whatever nw needs)
*/
abstract class NWQuery
{
protected $date;
// Inheriting classes need to set primaryKey and table as:
// protected $primaryKey;
// protected $table = 'messages';

public function __construct()
{
$this->date = static::freshTimestamp();
}

public static function freshTimestamp()
{
Expand Down Expand Up @@ -79,7 +77,6 @@ public static function find(int|null|string $id)
{
$model = new static();
$found_data = reset(self::query(['select * from messages where ' . $model->primaryKey . ' = :id', [':id' => $id]]));
$model = new static();
foreach ($found_data as $key => $value) {
$model->$key = $value;
}
Expand All @@ -88,5 +85,4 @@ public static function find(int|null|string $id)

abstract protected function save();
abstract protected function delete();

}

0 comments on commit 197d8d5

Please sign in to comment.