@@ -12,44 +12,44 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('active', false, function (bool $active) { |
|
15 | + $this->config->add('active', false, function(bool $active) { |
|
16 | 16 | |
17 | - return ($active ? ("ent.visibility = " . VISIBILITY_PUBLISHED . " AND ent.locked = 0") : ''); |
|
17 | + return ($active ? ("ent.visibility = ".VISIBILITY_PUBLISHED." AND ent.locked = 0") : ''); |
|
18 | 18 | }); |
19 | 19 | |
20 | - $this->config->add('rank', null, function (int $rank = null) { |
|
20 | + $this->config->add('rank', null, function(int $rank = null) { |
|
21 | 21 | |
22 | - return ((null !== $rank) ? ("ent.access <= " . $rank) : ''); |
|
22 | + return ((null !== $rank) ? ("ent.access <= ".$rank) : ''); |
|
23 | 23 | }); |
24 | 24 | |
25 | - $this->config->add('slug', '', function (string $slug) { |
|
25 | + $this->config->add('slug', '', function(string $slug) { |
|
26 | 26 | |
27 | - return (('' !== $slug) ? ("ent.slug = '" . addslashes($slug) . "'") : ''); |
|
27 | + return (('' !== $slug) ? ("ent.slug = '".addslashes($slug)."'") : ''); |
|
28 | 28 | }); |
29 | 29 | |
30 | - $this->config->add('name', '', function (string $name) { |
|
30 | + $this->config->add('name', '', function(string $name) { |
|
31 | 31 | |
32 | - return (('' !== $name) ? ("ent.name = '" . addslashes($name) . "'") : ''); |
|
32 | + return (('' !== $name) ? ("ent.name = '".addslashes($name)."'") : ''); |
|
33 | 33 | }); |
34 | 34 | |
35 | - $this->config->add('time_created >=', 0, function (int $time) { |
|
35 | + $this->config->add('time_created >=', 0, function(int $time) { |
|
36 | 36 | |
37 | - return ((0 < $time) ? ("ent.time_created >= " . $time) : ''); |
|
37 | + return ((0 < $time) ? ("ent.time_created >= ".$time) : ''); |
|
38 | 38 | }); |
39 | 39 | |
40 | - $this->config->add('time_created <=', 0, function (int $time) { |
|
40 | + $this->config->add('time_created <=', 0, function(int $time) { |
|
41 | 41 | |
42 | - return ((0 < $time) ? ("ent.time_created <= " . $time) : ''); |
|
42 | + return ((0 < $time) ? ("ent.time_created <= ".$time) : ''); |
|
43 | 43 | }); |
44 | 44 | |
45 | - $this->config->add('time_modified >=', 0, function (int $time) { |
|
45 | + $this->config->add('time_modified >=', 0, function(int $time) { |
|
46 | 46 | |
47 | - return ((0 < $time) ? ("ent.time_modified >= " . $time) : ''); |
|
47 | + return ((0 < $time) ? ("ent.time_modified >= ".$time) : ''); |
|
48 | 48 | }); |
49 | 49 | |
50 | - $this->config->add('time_modified <=', 0, function (int $time) { |
|
50 | + $this->config->add('time_modified <=', 0, function(int $time) { |
|
51 | 51 | |
52 | - return ((0 < $time) ? ("ent.time_modified <= " . $time) : ''); |
|
52 | + return ((0 < $time) ? ("ent.time_modified <= ".$time) : ''); |
|
53 | 53 | }); |
54 | 54 | } |
55 | 55 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('active', false, function (bool $active) { |
|
15 | + $this->config->add('active', false, function(bool $active) { |
|
16 | 16 | |
17 | 17 | return ($active ? "ent.active = 1" : ''); |
18 | 18 | }); |
@@ -12,29 +12,29 @@ |
||
12 | 12 | |
13 | 13 | protected function init() { |
14 | 14 | |
15 | - $this->config->add('rank', null, function (int $rank = null) { |
|
15 | + $this->config->add('rank', null, function(int $rank = null) { |
|
16 | 16 | |
17 | - return ((null !== $rank) ? ("ent.rank >= " . $rank) : ''); |
|
17 | + return ((null !== $rank) ? ("ent.rank >= ".$rank) : ''); |
|
18 | 18 | }); |
19 | 19 | |
20 | - $this->config->add('time_registered >=', 0, function (int $time) { |
|
20 | + $this->config->add('time_registered >=', 0, function(int $time) { |
|
21 | 21 | |
22 | - return ((0 < $time) ? ("ent.time_registered >= " . $time) : ''); |
|
22 | + return ((0 < $time) ? ("ent.time_registered >= ".$time) : ''); |
|
23 | 23 | }); |
24 | 24 | |
25 | - $this->config->add('time_registered <=', 0, function (int $time) { |
|
25 | + $this->config->add('time_registered <=', 0, function(int $time) { |
|
26 | 26 | |
27 | - return ((0 < $time) ? ("ent.time_registered <= " . $time) : ''); |
|
27 | + return ((0 < $time) ? ("ent.time_registered <= ".$time) : ''); |
|
28 | 28 | }); |
29 | 29 | |
30 | - $this->config->add('time_logged >=', 0, function (int $time) { |
|
30 | + $this->config->add('time_logged >=', 0, function(int $time) { |
|
31 | 31 | |
32 | - return ((0 < $time) ? ("ent.time_logged >= " . $time) : ''); |
|
32 | + return ((0 < $time) ? ("ent.time_logged >= ".$time) : ''); |
|
33 | 33 | }); |
34 | 34 | |
35 | - $this->config->add('time_logged <=', 0, function (int $time) { |
|
35 | + $this->config->add('time_logged <=', 0, function(int $time) { |
|
36 | 36 | |
37 | - return ((0 < $time) ? ("ent.time_logged <= " . $time) : ''); |
|
37 | + return ((0 < $time) ? ("ent.time_logged <= ".$time) : ''); |
|
38 | 38 | }); |
39 | 39 | } |
40 | 40 | } |
@@ -25,9 +25,13 @@ |
||
25 | 25 | |
26 | 26 | public static function get(string $table, int $id = 0) { |
27 | 27 | |
28 | - if (!isset(self::$classes[$table])) throw new Exception\General(self::$error_message); |
|
28 | + if (!isset(self::$classes[$table])) { |
|
29 | + throw new Exception\General(self::$error_message); |
|
30 | + } |
|
29 | 31 | |
30 | - if (isset(self::$cache[$table][$id])) return self::$cache[$table][$id]; |
|
32 | + if (isset(self::$cache[$table][$id])) { |
|
33 | + return self::$cache[$table][$id]; |
|
34 | + } |
|
31 | 35 | |
32 | 36 | $entity = new self::$classes[$table]; $entity->init($id); |
33 | 37 |
@@ -10,7 +10,9 @@ |
||
10 | 10 | |
11 | 11 | public function add(string $name, string $table, string $field, string $delete = null, string $update = null) { |
12 | 12 | |
13 | - if ((false === $this->definition->param($name)) || isset($this->list[$name])) return; |
|
13 | + if ((false === $this->definition->param($name)) || isset($this->list[$name])) { |
|
14 | + return; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | $this->list[$name] = new Definition\Item\Foreign($name, $table, $field, $delete, $update); |
16 | 18 | } |