Skip to content

Commit bcc435c

Browse files
committed
refactoring
1 parent af46b4a commit bcc435c

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

core/controller/Controller.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ public function __construct()
2121

2222
private function setClass()
2323
{
24-
$namespace = 'SimpleORM\app\controller\\';
25-
$class = str_replace($namespace, '', get_class($this));
26-
$this->class = str_replace('Controller', '', $class);
24+
$namespace = 'SimpleORM\app\controller\\';
25+
$class = str_replace($namespace, '', get_class($this));
26+
$this->class = str_replace('Controller', '', $class);
2727
}
2828

2929
/*
3030
* create instances of models with different names when set $this->use = []
3131
*/
3232
private function loadModels()
3333
{
34-
$this->use = !isset($this->use) ? [$this->class] : $this->use;
34+
$this->use = ( ! isset($this->use)) ? [$this->class] : $this->use;
3535

3636
if ($this->use) {
3737
foreach ($this->use as $model) {

core/model/Model.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ class Model extends Database
1010
private $stmt;
1111
private $dados;
1212
private $sql;
13-
public $count;
13+
public $count;
1414

1515
public function __construct()
1616
{
1717
parent::__construct();
1818
self::setTable();
19-
self::setPrivateKey();
19+
self::setPrimaryKey();
2020
}
2121

2222
private function setTable()
2323
{
24-
if (!isset($this->table)) {
24+
if ( ! isset($this->table)) {
2525
$this->table = strtolower(get_class($this));
2626
}
2727
}
2828

29-
private function setPrivateKey()
29+
private function setPrimaryKey()
3030
{
31-
if (!isset($this->pk)) {
31+
if ( ! isset($this->pk)) {
3232
$this->pk = 'id';
3333
}
3434
}
@@ -75,7 +75,7 @@ private function find()
7575
$sql = "SELECT {$fields} FROM {$this->table} {$where}";
7676
$this->stmt = $this->conn->prepare($sql);
7777

78-
if (!empty($where)) {
78+
if ( ! empty($where)) {
7979
self::param();
8080
}
8181

@@ -95,7 +95,7 @@ private function insert()
9595
{
9696
$fields = self::fields($this->dados);
9797
$values = self::values();
98-
$sql = "INSERT INTO {$this->table} ({$fields}) VALUES ({$values})";
98+
$sql = "INSERT INTO {$this->table} ({$fields}) VALUES ({$values})";
9999

100100
return $sql;
101101
}

0 commit comments

Comments
 (0)