Completed
Push — master ( 8c8014...211020 )
by Jacob
03:25
created
script/cron/generate-sitemaps.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  * @param string $domain
27 27
  * @return boolean
28 28
  */
29
-$buildSitemap = function (array $entries, $domain, $folder) {
29
+$buildSitemap = function(array $entries, $domain, $folder) {
30 30
     $urlSet = new Urlset();
31 31
     foreach ($entries as $path => $entry) {
32 32
         $url = new Url("{$domain}{$path}"); // todo better detection of domain by env
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 /*********************************************
54 54
  * blog.jacobemerick.com
55 55
  *********************************************/
56
-$reduceToMostRecentBlogPost = function ($recentPost, $post) {
56
+$reduceToMostRecentBlogPost = function($recentPost, $post) {
57 57
     if (is_null($recentPost)) {
58 58
         return $post;
59 59
     }
60 60
     $postDate = new DateTime($post['date']);
61 61
     $recentPostDate = new DateTime($recentPost['date']);
62
-    return ($postDate > $recentPostDate) ? $post: $recentPost;
62
+    return ($postDate > $recentPostDate) ? $post : $recentPost;
63 63
 };
64 64
 
65 65
 $blogPostsPerPage = 10;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 ];
95 95
 
96 96
 foreach ($blogCategoryArray as $blogCategory) {
97
-    $blogCategoryPosts = array_filter($activeBlogPosts, function ($post) use ($blogCategory) {
97
+    $blogCategoryPosts = array_filter($activeBlogPosts, function($post) use ($blogCategory) {
98 98
         return $post['category'] == $blogCategory;
99 99
     });
100 100
     $mostRecentBlogCategoryPost = array_reduce($blogCategoryPosts, $reduceToMostRecentBlogPost);
@@ -207,13 +207,13 @@  discard block
 block discarded – undo
207 207
 /*********************************************
208 208
  * lifestream.jacobemerick.com
209 209
  *********************************************/
210
-$reduceToMostRecentStreamActivity = function ($recentActivity, $activity) {
210
+$reduceToMostRecentStreamActivity = function($recentActivity, $activity) {
211 211
     if (is_null($recentActivity)) {
212 212
         return $activity;
213 213
     }
214 214
     $activityDate = new DateTime($activity['datetime']);
215 215
     $recentActivityDate = new DateTime($recentActivity['datetime']);
216
-    return ($activityDate > $recentActivityDate) ? $activity: $recentActivity;
216
+    return ($activityDate > $recentActivityDate) ? $activity : $recentActivity;
217 217
 };
218 218
 
219 219
 $streamActivitiesPerPage = 15;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 ];
252 252
 
253 253
 foreach ($streamTypeArray as $streamType) {
254
-    $streamTypeActivities = array_filter($streamActivities, function ($post) use ($streamType) {
254
+    $streamTypeActivities = array_filter($streamActivities, function($post) use ($streamType) {
255 255
         return $post['type'] == $streamType;
256 256
     });
257 257
     $mostRecentStreamTypeActivity = array_reduce($streamTypeActivities, $reduceToMostRecentStreamActivity);
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
 /*********************************************
386 386
  * www.waterfallofthekeweenaw.com
387 387
  *********************************************/
388
-$reduceToMostRecentJournalLog = function ($recentLog, $log) {
388
+$reduceToMostRecentJournalLog = function($recentLog, $log) {
389 389
     if (is_null($recentLog)) {
390 390
         return $log;
391 391
     }
392 392
     $logDate = new DateTime($log['publish_date']);
393 393
     $recentLogDate = new DateTime($recentLog['publish_date']);
394
-    return ($logDate > $recentLogDate) ? log: $recentLog;
394
+    return ($logDate > $recentLogDate) ? log : $recentLog;
395 395
 };
396 396
 
397 397
 $waterfallRepository = new WaterfallRepository($container['db_connection_locator']);
Please login to merge, or discard this patch.
controller/PageController.class.inc.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $post_result = $activityRepository->getActivities(5);
65 65
 
66 66
         $post_array = array();
67
-        foreach($post_result as $row) {
67
+        foreach ($post_result as $row) {
68 68
             array_push($post_array, $this->expand_post($row));
69 69
         }
70 70
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 		$headers = $this->headers;
101 101
 		Header::$headers();
102 102
 		Loader::load('view', '/Head', $this->data_array['head']);
103
-		foreach($this->body_view_array as $view)
103
+		foreach ($this->body_view_array as $view)
104 104
 		{
105
-			if(substr($view, 0, 1) == '/')
105
+			if (substr($view, 0, 1) == '/')
106 106
 				Loader::load('view', $view, $this->data_array['body']);
107 107
 			else
108 108
 				Loader::load('view', URLDecode::getSite() . '/' . $view, $this->data_array['body']);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             Loader::load('view', '/Foot', array('tracking_code' => self::$TRACKING_CODE));
115 115
         }
116 116
 		
117
-		if($view == '/404' || $view == '/503')
117
+		if ($view == '/404' || $view == '/503')
118 118
 			exit;
119 119
 	}
120 120
 
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 
171 171
 	private function load_assets()
172 172
 	{
173
-    $css_array = array_map(function ($stylesheet) {
173
+    $css_array = array_map(function($stylesheet) {
174 174
       $path = "/css/{$stylesheet[0]}.css";
175 175
       if ($stylesheet[1] > 1) {
176 176
         $path .= "?v={$stylesheet[1]}";
177 177
       }
178 178
       return $path;
179 179
     }, $this->css_array);
180
-    $js_array = array_map(function ($script) {
180
+    $js_array = array_map(function($script) {
181 181
       if (substr($script, 0, 4) == 'http') {
182 182
         return $script;
183 183
       }
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 
196 196
 	protected function eject()
197 197
 	{
198
-		if(get_class($this) !== 'Error404Controller')
198
+		if (get_class($this) !== 'Error404Controller')
199 199
 			Loader::loadNew('controller', '/Error404Controller')->activate();
200 200
 	}
201 201
 
202 202
 	protected function unavailable()
203 203
 	{
204
-		if(get_class($this) !== 'Error503Controller')
204
+		if (get_class($this) !== 'Error503Controller')
205 205
 			Loader::loadNew('controller', '/Error503Controller')->activate();
206 206
 	}
207 207
 
208 208
 	protected function redirect($uri, $method = 301)
209 209
 	{
210
-		switch($method)
210
+		switch ($method)
211 211
 		{
212 212
 			case 301 :
213
-				if(get_class($this) !== 'Error301Controller')
213
+				if (get_class($this) !== 'Error301Controller')
214 214
 					Loader::loadNew('controller', '/Error301Controller', array($uri))->activate();
215 215
 				break;
216 216
 			case 303 :
217
-				if(get_class($this) !== 'Error303Controller')
217
+				if (get_class($this) !== 'Error303Controller')
218 218
 					Loader::loadNew('controller', '/Error303Controller', array($uri))->activate();
219 219
 				break;
220 220
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	private $comment_errors;
235 235
 	protected function handle_comment_submit($site_id, $path, $redirect_url, $page_title)
236 236
 	{
237
-		if(Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
237
+		if (Request::hasPost() && Request::getPost('submit') == 'Submit Comment')
238 238
 		{
239 239
 			$parameters = array($site_id, $path, $redirect_url, $page_title);
240 240
 			$this->comment_errors = Loader::loadNew('module', 'form/CommentSubmitModule', $parameters)->activate();
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		$comment_array = array();
253 253
 		$comment_result = CommentCollector::getCommentsForURL($site, $path, $commenter->id);
254 254
 		
255
-		foreach($comment_result as $comment)
255
+		foreach ($comment_result as $comment)
256 256
 		{
257 257
 			$comment_object = new stdclass();
258 258
 			$comment_object->id = $comment->id;
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 			$comment_object->url = $comment->url;
263 263
 			$comment_object->trusted = $comment->trusted;
264 264
 			
265
-			if($comment->reply == 0 && Request::getPost('type') == $comment->id)
265
+			if ($comment->reply == 0 && Request::getPost('type') == $comment->id)
266 266
 				$comment_object->errors = $this->comment_errors;
267 267
 			else
268 268
 				$comment_object->errors = array();
269 269
 			
270
-			if($comment->reply == 0)
270
+			if ($comment->reply == 0)
271 271
 			{
272 272
 				$comment_object->replies = array();
273 273
 				$comment_array[$comment->id] = $comment_object;
@@ -298,21 +298,21 @@  discard block
 block discarded – undo
298 298
 		$commenter->website = '';
299 299
 		
300 300
 		$commenter_cookie = Cookie::instance('Commenter');
301
-		if(!$commenter_cookie->exists())
301
+		if (!$commenter_cookie->exists())
302 302
 			return $commenter;
303 303
 		
304 304
 		$commenter_cookie_value = $commenter_cookie->getValue();
305 305
 		$commenter_cookie_value = json_decode($commenter_cookie_value);
306 306
 		
307
-		if($commenter_cookie_value === NULL)
307
+		if ($commenter_cookie_value === NULL)
308 308
 			return $commenter;
309 309
 		
310
-		if(!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
310
+		if (!isset($commenter_cookie_value->name) || !isset($commenter_cookie_value->email))
311 311
 			return $commenter;
312 312
 		
313 313
 		$commenter_object = CommentCollector::getCommenterByFields($commenter_cookie_value->name, $commenter_cookie_value->email, (isset($commenter_cookie_value->website) ? $commenter_cookie_value->website : ''));
314 314
 		
315
-		if($commenter_object === NULL)
315
+		if ($commenter_object === NULL)
316 316
 			return $commenter;
317 317
 		
318 318
 		$commenter->id = $commenter_object->id;
Please login to merge, or discard this patch.
utility/Loader.class.inc.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public static function instance()
19 19
 	{
20
-		if(!isset(self::$instance))
20
+		if (!isset(self::$instance))
21 21
 			self::$instance = new Loader();
22 22
 		return self::$instance;
23 23
 	}
24 24
 
25 25
 	private function get_root()
26 26
 	{
27
-		if(!isset($this->root))
27
+		if (!isset($this->root))
28 28
 		{
29 29
 			$current_directory = dirname(__FILE__);
30 30
 			$current_directory = substr($current_directory, 0, -7);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 	private static function get_extension($type)
54 54
 	{
55
-		switch($type)
55
+		switch ($type)
56 56
 		{
57 57
 			case 'collector' :
58 58
 			case 'controller' :
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 
105 105
 	public static function load($type, $files, $data = array())
106 106
 	{
107
-		foreach((array) $files as $file)
107
+		foreach ((array) $files as $file)
108 108
 		{
109 109
 			$file_path = self::instance()->get_path($type, $file);
110
-			if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
110
+			if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view')
111 111
 				continue;
112 112
 			
113 113
 			// if(!file_exists($file_path))
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			
116 116
 			self::instance()->add_included_file($file_path);
117 117
 			
118
-			switch($type)
118
+			switch ($type)
119 119
 			{
120 120
 				case 'images' :
121 121
 				case 'scripts' :
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		
146 146
 		$reflectionObject = self::create_reflection_class($file);
147 147
 		
148
-		if(
148
+		if (
149 149
 			$reflectionObject->hasMethod('instance') &&
150 150
 			$reflectionObject->getMethod('instance')->isStatic())
151 151
 		{
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		
161 161
 		$reflectionObject = self::create_reflection_class($file);
162 162
 		
163
-		if($reflectionObject->hasMethod('__construct'))
163
+		if ($reflectionObject->hasMethod('__construct'))
164 164
 			return $reflectionObject->newInstanceArgs($data);
165 165
 		else
166 166
 			return $reflectionObject->newInstance();
Please login to merge, or discard this patch.
public/index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
 // sets up shutdown function to display profiler
24
-register_shutdown_function(function () use ($container) {
24
+register_shutdown_function(function() use ($container) {
25 25
     if (
26 26
         !isset($_COOKIE['debugger']) ||
27 27
         $_COOKIE['debugger'] != 'display'
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
         ->getRead()
34 34
         ->getProfiler()
35 35
         ->getProfiles();
36
-    $dbProfiles = array_filter($dbProfiles, function ($profile) {
36
+    $dbProfiles = array_filter($dbProfiles, function($profile) {
37 37
         return $profile['function'] == 'perform';
38 38
     });
39
-    $dbProfiles = array_map(function ($profile) {
39
+    $dbProfiles = array_map(function($profile) {
40 40
         return [
41 41
             'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])),
42 42
             'parameters' => $profile['bind_values'],
Please login to merge, or discard this patch.
bootstrap.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 
26 26
 // timezones are fun
27 27
 date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration
28
-$container['default_timezone'] = function ($c) {
28
+$container['default_timezone'] = function($c) {
29 29
     return new DateTimeZone('America/Phoenix');
30 30
 };
31 31
 
32 32
 
33 33
 // configure the db connections holder
34 34
 $db_connections = new Aura\Sql\ConnectionLocator();
35
-$db_connections->setDefault(function () use ($config) {
35
+$db_connections->setDefault(function() use ($config) {
36 36
     $connection = $config->database->slave;
37 37
     return new Aura\Sql\ExtendedPdo(
38 38
         "mysql:host={$connection->host}",
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
         $connection->password
41 41
     );
42 42
 });
43
-$db_connections->setWrite('master', function () use ($config) {
43
+$db_connections->setWrite('master', function() use ($config) {
44 44
     $connection = $config->database->master;
45 45
     return new Aura\Sql\ExtendedPdo(
46 46
         "mysql:host={$connection->host}",
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         $connection->password
49 49
     );
50 50
 });
51
-$db_connections->setRead('slave', function () use ($config) {
51
+$db_connections->setRead('slave', function() use ($config) {
52 52
     $connection = $config->database->slave;
53 53
     $pdo = new Aura\Sql\ExtendedPdo(
54 54
         "mysql:host={$connection->host}",
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 
67 67
 
68 68
 // setup mail handler
69
-$container['mail'] = $container->factory(function ($c) {
69
+$container['mail'] = $container->factory(function($c) {
70 70
     return new Jacobemerick\Archangel\Archangel();
71 71
 });
72 72
 
73 73
 
74 74
 // setup the logger
75
-$container['setup_logger'] = $container->protect(function ($name) use ($container) {
75
+$container['setup_logger'] = $container->protect(function($name) use ($container) {
76 76
     $logger = new Monolog\Logger($name);
77 77
 
78 78
     $logPath = __DIR__ . "/../logs/{$name}.log";
Please login to merge, or discard this patch.
router/Router.class.inc.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 
19 19
 	private static function get_router_name()
20 20
 	{
21
-		if(Request::isAJAX())
21
+		if (Request::isAJAX())
22 22
 			return 'AJAXRouter';
23 23
 		
24
-		switch(URLDecode::getSite())
24
+		switch (URLDecode::getSite())
25 25
 		{
26 26
 			case 'ajax' :
27 27
 				return 'AjaxRouter';
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 
66 66
 	final protected function check_for_redirect($redirect_uri)
67 67
 	{
68
-		foreach($this->get_redirect_array() as $check)
68
+		foreach ($this->get_redirect_array() as $check)
69 69
 		{
70 70
 			$redirect_uri = preg_replace($check->pattern, $check->replace, $redirect_uri);
71 71
 		}
72 72
 		
73 73
 		$redirect_uri = $this->check_for_special_redirect($redirect_uri);
74 74
 		
75
-		if($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
75
+		if ($this->requires_trailing_slash() && substr($redirect_uri, -1) != '/')
76 76
 			$redirect_uri .= '/';
77 77
 		
78 78
         if (URLDecode::getHost() == 'waterfalls.jacobemerick.com') {
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
             $redirect_uri = $protocol . '://' . (!Loader::isLive() ? 'dev' : 'www') . '.waterfallsofthekeweenaw.com' . $redirect_uri;
81 81
         }
82 82
         
83
-		if($redirect_uri == URLDecode::getURI())
83
+		if ($redirect_uri == URLDecode::getURI())
84 84
 			return;
85 85
 		
86 86
 		$controller_check = $redirect_uri;
87
-		if(substr($redirect_uri, 0, 4) == 'http') {
87
+		if (substr($redirect_uri, 0, 4) == 'http') {
88 88
       $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
89 89
 			$controller_check = preg_replace('@^' . $protocol . '://([a-z\.]+)@', '', $redirect_uri);
90 90
 		
91 91
 		$controller = $this->get_controller($controller_check);
92
-		if($controller == '/Error404Controller')
92
+		if ($controller == '/Error404Controller')
93 93
 		{
94 94
 			Loader::loadNew('controller', '/Error404Controller')
95 95
 				->activate();
96 96
 			exit;
97 97
 		}
98 98
 
99
-		if(substr($redirect_uri, 0, 4) != 'http')
99
+		if (substr($redirect_uri, 0, 4) != 'http')
100 100
 		{
101 101
 			$redirect_uri = substr($redirect_uri, 1);
102 102
 			$redirect_uri = URLDecode::getBase() . $redirect_uri;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 
114 114
 	final private function get_controller($uri)
115 115
 	{
116
-		foreach($this->get_direct_array() as $check)
116
+		foreach ($this->get_direct_array() as $check)
117 117
 		{
118
-			if($uri == $check->match)
118
+			if ($uri == $check->match)
119 119
 				return "{$this->get_primary_folder()}/{$check->controller}";
120 120
 			
121
-			if(preg_match("@^{$check->match}$@", $uri))
121
+			if (preg_match("@^{$check->match}$@", $uri))
122 122
 				return "{$this->get_primary_folder()}/{$check->controller}";
123 123
 		}
124 124
 		
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
 	final private function get_primary_folder()
129 129
 	{
130
-		if(Request::isAjax())
130
+		if (Request::isAjax())
131 131
 			return 'ajax';
132 132
 		
133 133
 		return URLDecode::getSite();
Please login to merge, or discard this patch.
tests/unit/Domain/Blog/Post/MysqlPostRepositoryTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     public function __construct()
14 14
     {
15 15
         $extendedPdo = $this->newExtendedPdo();
16
-        $this->connections = new ConnectionLocator(function () use ($extendedPdo) {
16
+        $this->connections = new ConnectionLocator(function() use ($extendedPdo) {
17 17
             return $extendedPdo;
18 18
         });
19 19
     }
Please login to merge, or discard this patch.
tests/unit/Domain/Stream/Activity/MysqlActivityRepositoryTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
         $this->assertNotFalse($data);
250 250
         $this->assertInternalType('array', $data);
251 251
 
252
-        $testData = array_filter($testData, function ($row) {
252
+        $testData = array_filter($testData, function($row) {
253 253
             return ($row['type'] == 'type one');
254 254
         });
255 255
         $testData = array_values($testData);
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
         $this->assertInternalType('array', $data);
319 319
         $this->assertCount(2, $data);
320 320
 
321
-        $testData = array_filter($testData, function ($row) {
321
+        $testData = array_filter($testData, function($row) {
322 322
             return ($row['type'] == 'type one');
323 323
         });
324 324
         $testData = array_values($testData);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
         $repository = new MysqlActivityRepository(self::$connection);
385 385
         $data = $repository->getActivitiesByTypeCount('type one');
386 386
 
387
-        $testData = array_filter($testData, function ($row) {
387
+        $testData = array_filter($testData, function($row) {
388 388
             return ($row['type'] == 'type one');
389 389
         });
390 390
 
Please login to merge, or discard this patch.
tests/unit/Domain/Stream/Changelog/MysqlChangelogRepositoryTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.