@@ -29,7 +29,7 @@ |
||
29 | 29 | )" |
30 | 30 | ); |
31 | 31 | |
32 | - self::$connection = new ConnectionLocator(function () use ($extendedPdo) { |
|
32 | + self::$connection = new ConnectionLocator(function() use ($extendedPdo) { |
|
33 | 33 | return $extendedPdo; |
34 | 34 | }); |
35 | 35 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | )" |
43 | 43 | ); |
44 | 44 | |
45 | - self::$connection = new ConnectionLocator(function () use ($extendedPdo) { |
|
45 | + self::$connection = new ConnectionLocator(function() use ($extendedPdo) { |
|
46 | 46 | return $extendedPdo; |
47 | 47 | }); |
48 | 48 | } |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | $repository = new MysqlSeriesRepository(self::$connection); |
181 | 181 | $data = $repository->getSeriesForPost(reset($testPostData)['id']); |
182 | 182 | |
183 | - usort($testPostData, function ($rowA, $rowB) use ($testSeriesPostData) { |
|
184 | - $seriesA = array_filter($testSeriesPostData, function ($row) use ($rowA) { |
|
183 | + usort($testPostData, function($rowA, $rowB) use ($testSeriesPostData) { |
|
184 | + $seriesA = array_filter($testSeriesPostData, function($row) use ($rowA) { |
|
185 | 185 | return ($rowA['id'] == $row['post']); |
186 | 186 | }); |
187 | - $seriesB = array_filter($testSeriesPostData, function ($row) use ($rowB) { |
|
187 | + $seriesB = array_filter($testSeriesPostData, function($row) use ($rowB) { |
|
188 | 188 | return ($rowB['id'] == $row['post']); |
189 | 189 | }); |
190 | 190 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $this->assertNotFalse($data); |
309 | 309 | $this->assertInternalType('array', $data); |
310 | 310 | |
311 | - $testPostData = array_filter($testPostData, function ($row) { |
|
311 | + $testPostData = array_filter($testPostData, function($row) { |
|
312 | 312 | return ($row['display'] == 1); |
313 | 313 | }); |
314 | 314 | $testPosts = array_column($testPostData, 'id'); |
@@ -29,7 +29,7 @@ |
||
29 | 29 | )" |
30 | 30 | ); |
31 | 31 | |
32 | - self::$connection = new ConnectionLocator(function () use ($extendedPdo) { |
|
32 | + self::$connection = new ConnectionLocator(function() use ($extendedPdo) { |
|
33 | 33 | return $extendedPdo; |
34 | 34 | }); |
35 | 35 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | )" |
41 | 41 | ); |
42 | 42 | |
43 | - self::$connection = new ConnectionLocator(function () use ($extendedPdo) { |
|
43 | + self::$connection = new ConnectionLocator(function() use ($extendedPdo) { |
|
44 | 44 | return $extendedPdo; |
45 | 45 | }); |
46 | 46 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | $this->assertNotFalse($data); |
201 | 201 | $this->assertInternalType('array', $data); |
202 | 202 | |
203 | - $tagCountData = array_map(function ($row) use ($testTagData) { |
|
203 | + $tagCountData = array_map(function($row) use ($testTagData) { |
|
204 | 204 | $tag = $row['tag_id']; |
205 | - $tag = array_filter($testTagData, function ($row) use ($tag) { |
|
205 | + $tag = array_filter($testTagData, function($row) use ($tag) { |
|
206 | 206 | return ($tag == $row['id']); |
207 | 207 | }); |
208 | 208 | $tag = current($tag)['tag']; |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | |
230 | 230 | $this->assertCount(count($testCountData), $data); |
231 | 231 | |
232 | - usort($testCountData, function ($rowA, $rowB) { |
|
232 | + usort($testCountData, function($rowA, $rowB) { |
|
233 | 233 | return ($rowA['tag'] > $rowB['tag']); |
234 | 234 | }); |
235 | - usort($data, function ($rowA, $rowB) { |
|
235 | + usort($data, function($rowA, $rowB) { |
|
236 | 236 | return ($rowA['tag'] > $rowB['tag']); |
237 | 237 | }); |
238 | 238 | |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | $this->assertNotFalse($data); |
299 | 299 | $this->assertInternalType('array', $data); |
300 | 300 | |
301 | - $testPTLinkData = array_filter($testPTLinkData, function ($row) use ($testPostData) { |
|
301 | + $testPTLinkData = array_filter($testPTLinkData, function($row) use ($testPostData) { |
|
302 | 302 | $post = $row['post_id']; |
303 | - $post = array_filter($testPostData, function ($row) use ($post) { |
|
303 | + $post = array_filter($testPostData, function($row) use ($post) { |
|
304 | 304 | return ($post == $row['id']); |
305 | 305 | }); |
306 | 306 | $post = current($post); |
307 | 307 | return ($post['display'] == 1); |
308 | 308 | }); |
309 | 309 | |
310 | - $tagCountData = array_map(function ($row) use ($testTagData) { |
|
310 | + $tagCountData = array_map(function($row) use ($testTagData) { |
|
311 | 311 | $tag = $row['tag_id']; |
312 | - $tag = array_filter($testTagData, function ($row) use ($tag) { |
|
312 | + $tag = array_filter($testTagData, function($row) use ($tag) { |
|
313 | 313 | return ($tag == $row['id']); |
314 | 314 | }); |
315 | 315 | $tag = current($tag)['tag']; |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | |
337 | 337 | $this->assertCount(count($testCountData), $data); |
338 | 338 | |
339 | - usort($testCountData, function ($rowA, $rowB) { |
|
339 | + usort($testCountData, function($rowA, $rowB) { |
|
340 | 340 | return ($rowA['tag'] > $rowB['tag']); |
341 | 341 | }); |
342 | - usort($data, function ($rowA, $rowB) { |
|
342 | + usort($data, function($rowA, $rowB) { |
|
343 | 343 | return ($rowA['tag'] > $rowB['tag']); |
344 | 344 | }); |
345 | 345 | |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $this->assertInternalType('array', $data); |
415 | 415 | $this->assertCount(count($testTagData), $data); |
416 | 416 | |
417 | - usort($testTagData, function ($rowA, $rowB) { |
|
417 | + usort($testTagData, function($rowA, $rowB) { |
|
418 | 418 | return ($rowA['tag'] > $rowB['tag']); |
419 | 419 | }); |
420 | 420 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | )" |
49 | 49 | ); |
50 | 50 | |
51 | - self::$connection = new ConnectionLocator(function () use ($extendedPdo) { |
|
51 | + self::$connection = new ConnectionLocator(function() use ($extendedPdo) { |
|
52 | 52 | return $extendedPdo; |
53 | 53 | }); |
54 | 54 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->assertInternalType('array', $data); |
175 | 175 | $this->assertCount(count($testData), $data); |
176 | 176 | |
177 | - usort($testData, function ($rowA, $rowB) { |
|
177 | + usort($testData, function($rowA, $rowB) { |
|
178 | 178 | return ((new DateTime($rowA['date'])) < (new DateTime($rowB['date']))); |
179 | 179 | }); |
180 | 180 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $this->assertNotFalse($data); |
220 | 220 | $this->assertInternalType('array', $data); |
221 | 221 | |
222 | - $testData = array_filter($testData, function ($row) { |
|
222 | + $testData = array_filter($testData, function($row) { |
|
223 | 223 | return ($row['display'] == 1); |
224 | 224 | }); |
225 | 225 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $this->assertNotFalse($data); |
355 | 355 | $this->assertStringMatchesFormat('%d', $data); |
356 | 356 | |
357 | - $testData = array_filter($testData, function ($row) { |
|
357 | + $testData = array_filter($testData, function($row) { |
|
358 | 358 | return ($row['display'] == 1); |
359 | 359 | }); |
360 | 360 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $this->assertNotFalse($data); |
472 | 472 | $this->assertInternalType('array', $data); |
473 | 473 | |
474 | - $testPostData = array_filter($testPostData, function ($row) { |
|
474 | + $testPostData = array_filter($testPostData, function($row) { |
|
475 | 475 | return ($row['display'] == 1); |
476 | 476 | }); |
477 | 477 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | $this->assertNotFalse($data); |
672 | 672 | $this->assertStringMatchesFormat('%d', $data); |
673 | 673 | |
674 | - $testPostData = array_filter($testPostData, function ($row) { |
|
674 | + $testPostData = array_filter($testPostData, function($row) { |
|
675 | 675 | return ($row['display'] == 1); |
676 | 676 | }); |
677 | 677 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $this->assertNotFalse($data); |
770 | 770 | $this->assertInternalType('array', $data); |
771 | 771 | |
772 | - $testData = array_filter($testData, function ($row) { |
|
772 | + $testData = array_filter($testData, function($row) { |
|
773 | 773 | return ($row['display'] == 1); |
774 | 774 | }); |
775 | 775 | |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | $this->assertNotFalse($data); |
922 | 922 | $this->assertStringMatchesFormat('%d', $data); |
923 | 923 | |
924 | - $testData = array_filter($testData, function ($row) { |
|
924 | + $testData = array_filter($testData, function($row) { |
|
925 | 925 | return ($row['display'] == 1); |
926 | 926 | }); |
927 | 927 | |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | $this->assertInternalType('array', $data); |
1110 | 1110 | |
1111 | 1111 | array_shift($testPostData); |
1112 | - $testPostData = array_filter($testPostData, function ($row) { |
|
1112 | + $testPostData = array_filter($testPostData, function($row) { |
|
1113 | 1113 | return ($row['display'] == 1); |
1114 | 1114 | }); |
1115 | 1115 | |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | $this->assertInternalType('array', $data); |
1182 | 1182 | |
1183 | 1183 | array_shift($testPostData); |
1184 | - $testPostData = array_filter($testPostData, function ($row) use ($testSeriesPostData) { |
|
1184 | + $testPostData = array_filter($testPostData, function($row) use ($testSeriesPostData) { |
|
1185 | 1185 | return (!in_array($row['id'], array_column($testSeriesPostData, 'post'))); |
1186 | 1186 | }); |
1187 | 1187 |
@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | public function perform() |
40 | 40 | { |
41 | 41 | $weighted_array = array(); |
42 | - foreach($this->result as $row) |
|
42 | + foreach ($this->result as $row) |
|
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
45 | + if ($weight > 0) |
|
46 | 46 | $weighted_array[$row['id']] = $weight; |
47 | 47 | } |
48 | 48 | arsort($weighted_array); |
49 | 49 | |
50 | 50 | $final_array = array(); |
51 | - foreach($weighted_array as $id => $weight) |
|
51 | + foreach ($weighted_array as $id => $weight) |
|
52 | 52 | { |
53 | - foreach($this->result as $row) |
|
53 | + foreach ($this->result as $row) |
|
54 | 54 | { |
55 | - if($row['id'] == $id) |
|
55 | + if ($row['id'] == $id) |
|
56 | 56 | $final_array[] = $row; |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function get_search_weight($row) |
63 | 63 | { |
64 | 64 | $weight = 0; |
65 | - foreach($this->weight as $weight_array) |
|
65 | + foreach ($this->weight as $weight_array) |
|
66 | 66 | { |
67 | 67 | $text = $row[$weight_array['field']]; |
68 | 68 | $weight += $weight_array['weight'] * substr_count(strtolower($text), strtolower($this->query)); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
28 | 28 | $this->post = $repository->findPostByPath(URLDecode::getPiece(2)); |
29 | 29 | |
30 | - if($this->post == null) |
|
30 | + if ($this->post == null) |
|
31 | 31 | $this->eject(); |
32 | 32 | |
33 | 33 | $this->handle_comment_submit( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $keyword_array = array(); |
96 | 96 | $keywords = $this->tags; |
97 | 97 | |
98 | - foreach($keywords as $keyword) |
|
98 | + foreach ($keywords as $keyword) |
|
99 | 99 | { |
100 | 100 | $keyword_array[] = $keyword['tag']; |
101 | 101 | } |
@@ -109,16 +109,16 @@ discard block |
||
109 | 109 | private function get_series_posts() |
110 | 110 | { |
111 | 111 | $series_posts = $this->fetch_series_posts(); |
112 | - if(count($series_posts) < 1) |
|
112 | + if (count($series_posts) < 1) |
|
113 | 113 | return array(); |
114 | 114 | |
115 | 115 | $previous_post = new stdclass(); |
116 | 116 | $next_post = new stdclass(); |
117 | 117 | |
118 | 118 | $found_current_post = false; |
119 | - foreach($series_posts as $post_row) |
|
119 | + foreach ($series_posts as $post_row) |
|
120 | 120 | { |
121 | - if($post_row['post'] == $this->post['id']) |
|
121 | + if ($post_row['post'] == $this->post['id']) |
|
122 | 122 | { |
123 | 123 | $found_current_post = true; |
124 | 124 | continue; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $post->url = Loader::getRootUrl('blog') . "{$post_row['category']}/{$post_row['path']}/"; |
146 | 146 | |
147 | - if(!$found_current_post) |
|
147 | + if (!$found_current_post) |
|
148 | 148 | $previous_post = $post; |
149 | 149 | else |
150 | 150 | { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | private $series_posts; |
164 | 164 | private function fetch_series_posts() |
165 | 165 | { |
166 | - if(!isset($this->series_posts)) { |
|
166 | + if (!isset($this->series_posts)) { |
|
167 | 167 | global $container; |
168 | 168 | $repository = new Jacobemerick\Web\Domain\Blog\Series\MysqlSeriesRepository($container['db_connection_locator']); |
169 | 169 | $this->series_posts = $repository->getSeriesForPost($this->post['id']); |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | private function get_related_posts() |
175 | 175 | { |
176 | 176 | $tag_array = array(); |
177 | - foreach($this->tags as $tag) |
|
177 | + foreach ($this->tags as $tag) |
|
178 | 178 | { |
179 | 179 | $tag_array[] = $tag['id']; |
180 | 180 | } |
181 | 181 | |
182 | 182 | $series_posts = $this->fetch_series_posts(); |
183 | 183 | $exclude_post_array = array(); |
184 | - foreach($series_posts as $series_post) |
|
184 | + foreach ($series_posts as $series_post) |
|
185 | 185 | { |
186 | 186 | $exclude_post_array[] = $series_post['post']; |
187 | 187 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $post_array = array(); |
194 | 194 | |
195 | - foreach($post_result as $post_row) |
|
195 | + foreach ($post_result as $post_row) |
|
196 | 196 | { |
197 | 197 | $post = new stdclass(); |
198 | 198 | $post->title = $post_row['title']; |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | { |
33 | 33 | parent::set_head_data(); |
34 | 34 | |
35 | - if($this->page == 1) |
|
35 | + if ($this->page == 1) |
|
36 | 36 | $this->set_title(self::$TITLE_MAIN); |
37 | 37 | else |
38 | 38 | $this->set_title(sprintf(self::$TITLE_PAGINATED, $this->page, $this->total_pages)); |
39 | 39 | |
40 | - if($this->page == 1) |
|
40 | + if ($this->page == 1) |
|
41 | 41 | $this->set_description(self::$DESCRIPTION_MAIN); |
42 | 42 | else |
43 | 43 | $this->set_description(sprintf(self::$DESCRIPTION_PAGINATED, $this->page, $this->total_pages)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | protected function get_introduction() |
49 | 49 | { |
50 | - if($this->page == 1) |
|
50 | + if ($this->page == 1) |
|
51 | 51 | { |
52 | 52 | global $container; |
53 | 53 | $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | protected function get_page_number() |
69 | 69 | { |
70 | 70 | $page = URLDecode::getPiece(1); |
71 | - if(isset($page) && is_numeric($page)) |
|
71 | + if (isset($page) && is_numeric($page)) |
|
72 | 72 | return $page; |
73 | 73 | return 1; |
74 | 74 | } |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | |
91 | 91 | protected function get_list_next_link() |
92 | 92 | { |
93 | - if($this->page == 1) |
|
93 | + if ($this->page == 1) |
|
94 | 94 | return; |
95 | - if($this->page == 2) |
|
95 | + if ($this->page == 2) |
|
96 | 96 | return '/'; |
97 | 97 | return '/' . ($this->page - 1) . '/'; |
98 | 98 | } |
99 | 99 | |
100 | 100 | protected function get_list_prev_link() |
101 | 101 | { |
102 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
102 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
103 | 103 | return; |
104 | 104 | return '/' . ($this->page + 1) . '/'; |
105 | 105 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | private $total_post_count; |
108 | 108 | protected function get_total_post_count() |
109 | 109 | { |
110 | - if(!isset($this->total_post_count)) { |
|
110 | + if (!isset($this->total_post_count)) { |
|
111 | 111 | global $container; |
112 | 112 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
113 | 113 | $this->total_post_count = $repository->getActivePostsCount(); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']); |
31 | 31 | $tag_result = $repository->findTagByTitle($tag); |
32 | 32 | |
33 | - if($tag_result === false) |
|
33 | + if ($tag_result === false) |
|
34 | 34 | $this->eject(); |
35 | 35 | |
36 | 36 | $this->tag = $tag_result; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | parent::set_head_data(); |
44 | 44 | |
45 | - if($this->page == 1) |
|
45 | + if ($this->page == 1) |
|
46 | 46 | { |
47 | 47 | $this->set_title(sprintf(self::$TITLE_MAIN, ucwords($this->tag['tag']))); |
48 | 48 | $this->set_description(sprintf(self::$DESCRIPTION_MAIN, ucwords($this->tag['tag']))); |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | { |
63 | 63 | $tag = ucwords($this->tag['tag']); |
64 | 64 | |
65 | - if($this->page == 1) |
|
65 | + if ($this->page == 1) |
|
66 | 66 | { |
67 | 67 | global $container; |
68 | 68 | $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']); |
69 | 69 | $introduction_result = $repository->findByType('tag', $this->tag['tag']); |
70 | 70 | |
71 | - if($introduction_result !== false) |
|
71 | + if ($introduction_result !== false) |
|
72 | 72 | { |
73 | 73 | $introduction = array(); |
74 | 74 | $introduction['title'] = $introduction_result['title']; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | protected function get_page_number() |
90 | 90 | { |
91 | 91 | $page = URLDecode::getPiece(3); |
92 | - if(isset($page) && is_numeric($page)) |
|
92 | + if (isset($page) && is_numeric($page)) |
|
93 | 93 | return $page; |
94 | 94 | return 1; |
95 | 95 | } |
@@ -111,16 +111,16 @@ discard block |
||
111 | 111 | |
112 | 112 | protected function get_list_next_link() |
113 | 113 | { |
114 | - if($this->page == 1) |
|
114 | + if ($this->page == 1) |
|
115 | 115 | return; |
116 | - if($this->page == 2) |
|
116 | + if ($this->page == 2) |
|
117 | 117 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/")->activate(); |
118 | 118 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page - 1) . '/')->activate(); |
119 | 119 | } |
120 | 120 | |
121 | 121 | protected function get_list_prev_link() |
122 | 122 | { |
123 | - if(($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
123 | + if (($this->page * self::$POSTS_PER_PAGE) >= $this->get_total_post_count()) |
|
124 | 124 | return; |
125 | 125 | return Content::instance('URLSafe', "/tag/{$this->tag['tag']}/" . ($this->page + 1) . '/')->activate(); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | private $total_post_count; |
129 | 129 | protected function get_total_post_count() |
130 | 130 | { |
131 | - if(!isset($this->total_post_count)) { |
|
131 | + if (!isset($this->total_post_count)) { |
|
132 | 132 | global $container; |
133 | 133 | $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); |
134 | 134 | $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']); |