@@ -2,78 +2,86 @@ discard block |
||
2 | 2 | |
3 | 3 | Loader::load('utility', 'Request'); |
4 | 4 | |
5 | -class Validate |
|
6 | -{ |
|
5 | +class Validate |
|
6 | +{ |
|
7 | 7 | |
8 | 8 | private static $NAME_REGEX = '@[a-z\s\'-]+@i'; |
9 | 9 | private static $EMAIL_REGEX = '@(?:[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")\@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])@i'; |
10 | 10 | private static $URL_REGEX = '@((https?|ftp)\:\/\/)?([a-z0-9-.]*)\.([a-z]{2,3})(\/([a-z0-9+\$_-]\.?)+)*\/?(\?[a-z+&\$_.-][a-z0-9;:\@&%=+\/\$_.-]*)?(#[a-z_.-][a-z0-9+\$_.-]*)?@i'; |
11 | 11 | |
12 | - public static function isBoolean($value, $strict = false) |
|
13 | - { |
|
14 | - if($strict && ($value === true || $value === false)) |
|
15 | - return true; |
|
16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
17 | - return true; |
|
12 | + public static function isBoolean($value, $strict = false) |
|
13 | + { |
|
14 | + if($strict && ($value === true || $value === false)) { |
|
15 | + return true; |
|
16 | + } |
|
17 | + if(!$strict && ((bool) $value === true || (bool) $value === false)) { |
|
18 | + return true; |
|
19 | + } |
|
18 | 20 | return false; |
19 | 21 | } |
20 | 22 | |
21 | - public static function isDate($value) |
|
22 | - { |
|
23 | - if(strtotime($value) !== -1) |
|
24 | - return true; |
|
25 | - if(date('y', $value) !== false) |
|
26 | - return true; |
|
23 | + public static function isDate($value) |
|
24 | + { |
|
25 | + if(strtotime($value) !== -1) { |
|
26 | + return true; |
|
27 | + } |
|
28 | + if(date('y', $value) !== false) { |
|
29 | + return true; |
|
30 | + } |
|
27 | 31 | return false; |
28 | 32 | } |
29 | 33 | |
30 | - public static function isInteger($value, $strict = false) |
|
31 | - { |
|
32 | - if($strict) |
|
33 | - return is_int($value); |
|
34 | + public static function isInteger($value, $strict = false) |
|
35 | + { |
|
36 | + if($strict) { |
|
37 | + return is_int($value); |
|
38 | + } |
|
34 | 39 | return (int) $value == $value; |
35 | 40 | } |
36 | 41 | |
37 | - public static function isIP($value) |
|
38 | - { |
|
39 | - if(self::isInteger(ip2long($value))) |
|
40 | - return true; |
|
42 | + public static function isIP($value) |
|
43 | + { |
|
44 | + if(self::isInteger(ip2long($value))) { |
|
45 | + return true; |
|
46 | + } |
|
41 | 47 | return false; |
42 | 48 | } |
43 | 49 | |
44 | - public static function isString($value, $strict = false) |
|
45 | - { |
|
46 | - if($strict) |
|
47 | - return is_string($value); |
|
50 | + public static function isString($value, $strict = false) |
|
51 | + { |
|
52 | + if($strict) { |
|
53 | + return is_string($value); |
|
54 | + } |
|
48 | 55 | return (string) $value == $value; |
49 | 56 | } |
50 | 57 | |
51 | - public static function isURL($value) |
|
52 | - { |
|
58 | + public static function isURL($value) |
|
59 | + { |
|
53 | 60 | return true; |
54 | 61 | return self::check_value(self::$URL_REGEX, $value); |
55 | 62 | } |
56 | 63 | |
57 | - public static function isName($value) |
|
58 | - { |
|
64 | + public static function isName($value) |
|
65 | + { |
|
59 | 66 | return self::check_value(self::$NAME_REGEX, $value); |
60 | 67 | } |
61 | 68 | |
62 | - public static function isEmail($value) |
|
63 | - { |
|
69 | + public static function isEmail($value) |
|
70 | + { |
|
64 | 71 | return self::check_value(self::$EMAIL_REGEX, $value); |
65 | 72 | } |
66 | 73 | |
67 | - private static function check_value($pattern, $string) |
|
68 | - { |
|
74 | + private static function check_value($pattern, $string) |
|
75 | + { |
|
69 | 76 | preg_match($pattern, $string, $matches); |
70 | - if(empty($matches)) |
|
71 | - return false; |
|
77 | + if(empty($matches)) { |
|
78 | + return false; |
|
79 | + } |
|
72 | 80 | return $matches[0] == $string; |
73 | 81 | } |
74 | 82 | |
75 | - public static function checkRequest($type, $key, $validation, $strict = false) |
|
76 | - { |
|
83 | + public static function checkRequest($type, $key, $validation, $strict = false) |
|
84 | + { |
|
77 | 85 | switch($type) |
78 | 86 | { |
79 | 87 | case 'server': |
@@ -84,8 +92,9 @@ discard block |
||
84 | 92 | break; |
85 | 93 | } |
86 | 94 | |
87 | - if($value == false) |
|
88 | - return false; |
|
95 | + if($value == false) { |
|
96 | + return false; |
|
97 | + } |
|
89 | 98 | |
90 | 99 | switch($validation) |
91 | 100 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -final class Database |
|
4 | -{ |
|
3 | +final class Database |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | private $read_connection; |
7 | 7 | private $write_connection; |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | private static $instance; |
16 | 16 | |
17 | - private function __construct($write_params, $read_params) |
|
18 | - { |
|
17 | + private function __construct($write_params, $read_params) |
|
18 | + { |
|
19 | 19 | $this->write_connection = $this->connect( |
20 | 20 | $write_params->host, |
21 | 21 | $write_params->user, |
@@ -31,19 +31,20 @@ discard block |
||
31 | 31 | return $this; |
32 | 32 | } |
33 | 33 | |
34 | - private function connect($host, $username, $password) |
|
35 | - { |
|
34 | + private function connect($host, $username, $password) |
|
35 | + { |
|
36 | 36 | $mysqli = new mysqli($host, $username, $password); |
37 | 37 | |
38 | 38 | $has_connection_error = $mysqli->connect_error; |
39 | - if(isset($has_connection_error)) |
|
40 | - $this->has_connection_error = true; |
|
39 | + if(isset($has_connection_error)) { |
|
40 | + $this->has_connection_error = true; |
|
41 | + } |
|
41 | 42 | |
42 | 43 | return $mysqli; |
43 | 44 | } |
44 | 45 | |
45 | - public static function instance() |
|
46 | - { |
|
46 | + public static function instance() |
|
47 | + { |
|
47 | 48 | if(!isset(self::$instance)) { |
48 | 49 | global $config; |
49 | 50 | self::$instance = new Database( |
@@ -55,20 +56,21 @@ discard block |
||
55 | 56 | return self::$instance; |
56 | 57 | } |
57 | 58 | |
58 | - public static function escape($string) |
|
59 | - { |
|
59 | + public static function escape($string) |
|
60 | + { |
|
60 | 61 | return self::instance()->read_connection->real_escape_string($string); |
61 | 62 | } |
62 | 63 | |
63 | - public static function select($query) |
|
64 | - { |
|
64 | + public static function select($query) |
|
65 | + { |
|
65 | 66 | $start = microtime(true); |
66 | 67 | if($result = self::instance()->read_connection->query($query)) |
67 | 68 | { |
68 | 69 | self::instance()->log_query($query, $start); |
69 | 70 | $array = array(); |
70 | - while($row = $result->fetch_object()) |
|
71 | - $array[] = $row; |
|
71 | + while($row = $result->fetch_object()) { |
|
72 | + $array[] = $row; |
|
73 | + } |
|
72 | 74 | $result->close(); |
73 | 75 | return $array; |
74 | 76 | } |
@@ -76,16 +78,17 @@ discard block |
||
76 | 78 | return false; |
77 | 79 | } |
78 | 80 | |
79 | - public static function selectRow($query) |
|
80 | - { |
|
81 | + public static function selectRow($query) |
|
82 | + { |
|
81 | 83 | $result = self::select($query); |
82 | - if(is_array($result)) |
|
83 | - return array_pop($result); |
|
84 | + if(is_array($result)) { |
|
85 | + return array_pop($result); |
|
86 | + } |
|
84 | 87 | return false; |
85 | 88 | } |
86 | 89 | |
87 | - public static function execute($query) |
|
88 | - { |
|
90 | + public static function execute($query) |
|
91 | + { |
|
89 | 92 | $start = microtime(true); |
90 | 93 | if(self::instance()->write_connection->query($query)) |
91 | 94 | { |
@@ -96,16 +99,17 @@ discard block |
||
96 | 99 | return false; |
97 | 100 | } |
98 | 101 | |
99 | - public static function lastInsertID() |
|
100 | - { |
|
102 | + public static function lastInsertID() |
|
103 | + { |
|
101 | 104 | $id = self::instance()->write_connection->insert_id; |
102 | - if($id == 0) |
|
103 | - return false; |
|
105 | + if($id == 0) { |
|
106 | + return false; |
|
107 | + } |
|
104 | 108 | return $id; |
105 | 109 | } |
106 | 110 | |
107 | - private function log_query($query, $start) |
|
108 | - { |
|
111 | + private function log_query($query, $start) |
|
112 | + { |
|
109 | 113 | $time = (microtime(true) - $start) * 1000; |
110 | 114 | $query = array( |
111 | 115 | 'sql' => $query, |
@@ -116,8 +120,8 @@ discard block |
||
116 | 120 | $this->query_total['time'] += $time; |
117 | 121 | } |
118 | 122 | |
119 | - private function gather_query_data() |
|
120 | - { |
|
123 | + private function gather_query_data() |
|
124 | + { |
|
121 | 125 | $query_data = array(); |
122 | 126 | foreach($this->query_log as $query) |
123 | 127 | { |
@@ -127,8 +131,8 @@ discard block |
||
127 | 131 | return $query_data; |
128 | 132 | } |
129 | 133 | |
130 | - public static function explain($query) |
|
131 | - { |
|
134 | + public static function explain($query) |
|
135 | + { |
|
132 | 136 | $sql = 'EXPLAIN ' . $query['sql']; |
133 | 137 | |
134 | 138 | if($result = self::instance()->read_connection->query($sql)) |
@@ -140,18 +144,18 @@ discard block |
||
140 | 144 | return $query; |
141 | 145 | } |
142 | 146 | |
143 | - public static function getQueryLog() |
|
144 | - { |
|
147 | + public static function getQueryLog() |
|
148 | + { |
|
145 | 149 | return self::instance()->gather_query_data(); |
146 | 150 | } |
147 | 151 | |
148 | - public static function getQueryTotals() |
|
149 | - { |
|
152 | + public static function getQueryTotals() |
|
153 | + { |
|
150 | 154 | return self::instance()->query_total; |
151 | 155 | } |
152 | 156 | |
153 | - public static function isConnected() |
|
154 | - { |
|
157 | + public static function isConnected() |
|
158 | + { |
|
155 | 159 | return !self::instance()->has_connection_error; |
156 | 160 | } |
157 | 161 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -class Request |
|
4 | -{ |
|
3 | +class Request |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | private static $server = array(); |
7 | 7 | private static $get = array(); |
@@ -9,70 +9,74 @@ discard block |
||
9 | 9 | |
10 | 10 | private static $AJAX_REQUEST = 'HTTP_X_REQUESTED_WITH'; |
11 | 11 | |
12 | - static function init() |
|
13 | - { |
|
12 | + static function init() |
|
13 | + { |
|
14 | 14 | self::make_server(); |
15 | 15 | self::make_get(); |
16 | 16 | self::make_post(); |
17 | 17 | } |
18 | 18 | |
19 | - static function getServer($key = null) |
|
20 | - { |
|
19 | + static function getServer($key = null) |
|
20 | + { |
|
21 | 21 | if($key) |
22 | 22 | { |
23 | - if(isset(self::$server[$key])) |
|
24 | - return self::$server[$key]; |
|
23 | + if(isset(self::$server[$key])) { |
|
24 | + return self::$server[$key]; |
|
25 | + } |
|
25 | 26 | return false; |
26 | 27 | } |
27 | 28 | return self::$server; |
28 | 29 | } |
29 | 30 | |
30 | - static function isAjax() |
|
31 | - { |
|
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
33 | - return true; |
|
31 | + static function isAjax() |
|
32 | + { |
|
33 | + if(self::getServer(self::$AJAX_REQUEST)) { |
|
34 | + return true; |
|
35 | + } |
|
34 | 36 | return false; |
35 | 37 | } |
36 | 38 | |
37 | - static function getGet($key = null) |
|
38 | - { |
|
39 | + static function getGet($key = null) |
|
40 | + { |
|
39 | 41 | if($key) |
40 | 42 | { |
41 | - if(isset(self::$get[$key])) |
|
42 | - return self::$get[$key]; |
|
43 | + if(isset(self::$get[$key])) { |
|
44 | + return self::$get[$key]; |
|
45 | + } |
|
43 | 46 | return false; |
44 | 47 | } |
45 | 48 | return self::$get; |
46 | 49 | } |
47 | 50 | |
48 | - static function getPost($key = null) |
|
49 | - { |
|
51 | + static function getPost($key = null) |
|
52 | + { |
|
50 | 53 | if($key) |
51 | 54 | { |
52 | - if(isset(self::$post[$key])) |
|
53 | - return self::$post[$key]; |
|
55 | + if(isset(self::$post[$key])) { |
|
56 | + return self::$post[$key]; |
|
57 | + } |
|
54 | 58 | return false; |
55 | 59 | } |
56 | 60 | return self::$post; |
57 | 61 | } |
58 | 62 | |
59 | - public static function hasPost() |
|
60 | - { |
|
63 | + public static function hasPost() |
|
64 | + { |
|
61 | 65 | return is_array(self::$post) && !empty(self::$post); |
62 | 66 | } |
63 | 67 | |
64 | - static function make_server() |
|
65 | - { |
|
68 | + static function make_server() |
|
69 | + { |
|
66 | 70 | self::$server = $_SERVER; |
67 | 71 | } |
68 | 72 | |
69 | - static function make_get() |
|
70 | - { |
|
73 | + static function make_get() |
|
74 | + { |
|
71 | 75 | self::$get = $_GET; |
72 | 76 | } |
73 | 77 | |
74 | - static function make_post() |
|
75 | - { |
|
78 | + static function make_post() |
|
79 | + { |
|
76 | 80 | self::$post = $_POST; |
77 | 81 | } |
78 | 82 |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -abstract class Content |
|
4 | -{ |
|
3 | +abstract class Content |
|
4 | +{ |
|
5 | 5 | |
6 | 6 | protected $original_content; |
7 | 7 | protected $content; |
8 | 8 | |
9 | - function __construct($content) |
|
10 | - { |
|
9 | + function __construct($content) |
|
10 | + { |
|
11 | 11 | $this->original_content = $content; |
12 | 12 | $this->content = $content; |
13 | 13 | } |
14 | 14 | |
15 | - public function getOriginal() |
|
16 | - { |
|
15 | + public function getOriginal() |
|
16 | + { |
|
17 | 17 | return $this->original_content; |
18 | 18 | } |
19 | 19 | |
20 | 20 | abstract protected function execute(); |
21 | 21 | |
22 | - public function activate() |
|
23 | - { |
|
22 | + public function activate() |
|
23 | + { |
|
24 | 24 | $args = func_get_args(); |
25 | 25 | call_user_func_array(array($this, 'execute'), $args); |
26 | 26 | |
27 | 27 | return $this->content; |
28 | 28 | } |
29 | 29 | |
30 | - public function check() |
|
31 | - { |
|
30 | + public function check() |
|
31 | + { |
|
32 | 32 | $args = func_get_args(); |
33 | 33 | $return = call_user_func_array(array($this, 'execute'), $args); |
34 | 34 | |
35 | 35 | return $return; |
36 | 36 | } |
37 | 37 | |
38 | - public static function instance($class, $content) |
|
39 | - { |
|
38 | + public static function instance($class, $content) |
|
39 | + { |
|
40 | 40 | $class_name = "{$class}Content"; |
41 | 41 | Loader::load('utility', "content/{$class_name}"); |
42 | 42 | return new $class_name($content); |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlTagRepository implements TagRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlTagRepository implements TagRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array|false |
25 | 25 | */ |
26 | - public function findTagByTitle($title) |
|
27 | - { |
|
26 | + public function findTagByTitle($title) |
|
27 | + { |
|
28 | 28 | $query = " |
29 | 29 | SELECT * |
30 | 30 | FROM `jpemeric_blog`.`tag` |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | ->fetchOne($query, $bindings); |
41 | 41 | } |
42 | 42 | |
43 | - public function getAllTags() |
|
44 | - { |
|
43 | + public function getAllTags() |
|
44 | + { |
|
45 | 45 | $query = " |
46 | 46 | SELECT * |
47 | 47 | FROM `jpemeric_blog`.`tag` |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | ->fetchAll($query); |
54 | 54 | } |
55 | 55 | |
56 | - public function getTagCloud() |
|
57 | - { |
|
56 | + public function getTagCloud() |
|
57 | + { |
|
58 | 58 | $query = " |
59 | 59 | SELECT COUNT(1) AS `count`, `tag` |
60 | 60 | FROM `jpemeric_blog`.`tag` |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | ->fetchAll($query, $bindings); |
73 | 73 | } |
74 | 74 | |
75 | - public function getTagsForPost($post) |
|
76 | - { |
|
75 | + public function getTagsForPost($post) |
|
76 | + { |
|
77 | 77 | $query = " |
78 | 78 | SELECT `tag`.* |
79 | 79 | FROM `jpemeric_blog`.`tag` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlPostRepository implements PostRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlPostRepository implements PostRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator $connections |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array|false |
25 | 25 | */ |
26 | - public function findPostByPath($path) |
|
27 | - { |
|
26 | + public function findPostByPath($path) |
|
27 | + { |
|
28 | 28 | $query = " |
29 | 29 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
30 | 30 | FROM `jpemeric_blog`.`post` |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | ->fetchOne($query, $bindings); |
42 | 42 | } |
43 | 43 | |
44 | - public function getActivePosts($limit = null, $offset = 0) |
|
45 | - { |
|
44 | + public function getActivePosts($limit = null, $offset = 0) |
|
45 | + { |
|
46 | 46 | $query = " |
47 | 47 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
48 | 48 | FROM `jpemeric_blog`.`post` |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | ->fetchAll($query, $bindings); |
64 | 64 | } |
65 | 65 | |
66 | - public function getActivePostsCount() |
|
67 | - { |
|
66 | + public function getActivePostsCount() |
|
67 | + { |
|
68 | 68 | $query = " |
69 | 69 | SELECT COUNT(1) AS `count` |
70 | 70 | FROM `jpemeric_blog`.`post` |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | ->fetchValue($query, $bindings); |
80 | 80 | } |
81 | 81 | |
82 | - public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
|
83 | - { |
|
82 | + public function getActivePostsByTag($tag, $limit = null, $offset = 0) |
|
83 | + { |
|
84 | 84 | $query = " |
85 | 85 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
86 | 86 | FROM `jpemeric_blog`.`post` |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | ->fetchAll($query, $bindings); |
105 | 105 | } |
106 | 106 | |
107 | - public function getActivePostsCountByTag($tag) |
|
108 | - { |
|
107 | + public function getActivePostsCountByTag($tag) |
|
108 | + { |
|
109 | 109 | $query = " |
110 | 110 | SELECT COUNT(1) AS `count` |
111 | 111 | FROM `jpemeric_blog`.`post` |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | ->fetchValue($query, $bindings); |
124 | 124 | } |
125 | 125 | |
126 | - public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
|
127 | - { |
|
126 | + public function getActivePostsByCategory($category, $limit = null, $offset = 0) |
|
127 | + { |
|
128 | 128 | $query = " |
129 | 129 | SELECT `id`, `title`, `path`, `date`, `body`, `category` |
130 | 130 | FROM `jpemeric_blog`.`post` |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | ->fetchAll($query, $bindings); |
147 | 147 | } |
148 | 148 | |
149 | - public function getActivePostsCountByCategory($category) |
|
150 | - { |
|
149 | + public function getActivePostsCountByCategory($category) |
|
150 | + { |
|
151 | 151 | $query = " |
152 | 152 | SELECT COUNT(1) AS `count` |
153 | 153 | FROM `jpemeric_blog`.`post` |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | ->fetchValue($query, $bindings); |
164 | 164 | } |
165 | 165 | |
166 | - public function getActivePostsByRelatedTags($post, $limit = 4) |
|
167 | - { |
|
166 | + public function getActivePostsByRelatedTags($post, $limit = 4) |
|
167 | + { |
|
168 | 168 | $query = " |
169 | 169 | SELECT `id`, `title`, `path`, `date`, `body`, `category`, COUNT(1) AS `count` |
170 | 170 | FROM `jpemeric_blog`.`post` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlIntroductionRepository implements IntroductionRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlIntroductionRepository implements IntroductionRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return array|false |
26 | 26 | */ |
27 | - public function findByType($type, $value = '') |
|
28 | - { |
|
27 | + public function findByType($type, $value = '') |
|
28 | + { |
|
29 | 29 | $query = " |
30 | 30 | SELECT `title`, `content`, `image` |
31 | 31 | FROM `jpemeric_blog`.`introduction` |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | |
5 | 5 | use Aura\Sql\ConnectionLocator; |
6 | 6 | |
7 | -class MysqlSeriesRepository implements SeriesRepositoryInterface |
|
8 | -{ |
|
7 | +class MysqlSeriesRepository implements SeriesRepositoryInterface |
|
8 | +{ |
|
9 | 9 | |
10 | 10 | /** @var Aura\Sql\ConnectionLocator */ |
11 | 11 | protected $connections; |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @param Aura\Sql\ConnectionLocator |
15 | 15 | */ |
16 | - public function __construct(ConnectionLocator $connections) |
|
17 | - { |
|
16 | + public function __construct(ConnectionLocator $connections) |
|
17 | + { |
|
18 | 18 | $this->connections = $connections; |
19 | 19 | } |
20 | 20 | |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array|false |
25 | 25 | */ |
26 | - public function getSeriesForPost($post) |
|
27 | - { |
|
26 | + public function getSeriesForPost($post) |
|
27 | + { |
|
28 | 28 | $query = " |
29 | 29 | SELECT `series`.`title` AS `series_title`, `series`.`description` AS `series_description`, |
30 | 30 | `post`.`id` AS `post`, `post`.`title`, `post`.`category`, `post`.`path` |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | use Jacobemerick\CommentService\Api\DefaultApi; |
7 | 7 | use Jacobemerick\CommentService\Model\Commenter; |
8 | 8 | |
9 | -class ServiceCommenterRepository implements CommenterRepositoryInterface |
|
10 | -{ |
|
9 | +class ServiceCommenterRepository implements CommenterRepositoryInterface |
|
10 | +{ |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * @var DefaultApi |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @param DefaultApi $api |
19 | 19 | */ |
20 | - public function __construct(DefaultApi $api) |
|
21 | - { |
|
20 | + public function __construct(DefaultApi $api) |
|
21 | + { |
|
22 | 22 | $this->api = $api; |
23 | 23 | } |
24 | 24 | |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @return array |
28 | 28 | * @throws ApiException |
29 | 29 | */ |
30 | - public function createCommenter(array $commenter) |
|
31 | - { |
|
30 | + public function createCommenter(array $commenter) |
|
31 | + { |
|
32 | 32 | $response = $this->api->createCommenter($commenter); |
33 | 33 | return $this->deserializeCommenter($response); |
34 | 34 | } |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return array |
39 | 39 | * @throws ApiException |
40 | 40 | */ |
41 | - public function getCommenter($commenterId) |
|
42 | - { |
|
41 | + public function getCommenter($commenterId) |
|
42 | + { |
|
43 | 43 | $response = $this->api->getCommenter($commenterId); |
44 | 44 | return $this->deserializeCommenter($response); |
45 | 45 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @return array |
51 | 51 | * @throws ApiException |
52 | 52 | */ |
53 | - public function getCommenters($page = null, $perPage = null) |
|
54 | - { |
|
53 | + public function getCommenters($page = null, $perPage = null) |
|
54 | + { |
|
55 | 55 | $response = $this->api->getCommenters($page, $perPage); |
56 | 56 | return array_map([$this, 'deserializeCommenter'], $response); |
57 | 57 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param Commenter |
61 | 61 | * @return array |
62 | 62 | */ |
63 | - protected function deserializeCommenter(Commenter $commenter) |
|
64 | - { |
|
63 | + protected function deserializeCommenter(Commenter $commenter) |
|
64 | + { |
|
65 | 65 | return [ |
66 | 66 | 'id' => $commenter->getId(), |
67 | 67 | 'name' => $commenter->getName(), |