Completed
Push — master ( 017f18...ac298f )
by Jacob
05:25
created
script/cron/fetch-blog-activity.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@  discard block
 block discarded – undo
13 13
 
14 14
 $blogFeed = Feed::loadRss('http://blog.jacobemerick.com/rss.xml');
15 15
 foreach ($blogFeed->item as $item) {
16
-    $datetime = new DateTime($item->pubDate);
17
-    if ($datetime <= $mostRecentBlogDateTime) {
18
-        // break;
19
-    }
20
-
21
-    $uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid);
22
-    if ($uniqueBlogCheck !== false) {
23
-        continue;
24
-    }
25
-
26
-    $datetime->setTimezone($container['default_timezone']);
27
-    $metadata = json_decode(json_encode($item), true);
28
-
29
-    $blogRepository->insertBlog(
30
-        (string) $item->guid,
31
-        $datetime,
32
-        $metadata
33
-    );
16
+	$datetime = new DateTime($item->pubDate);
17
+	if ($datetime <= $mostRecentBlogDateTime) {
18
+		// break;
19
+	}
20
+
21
+	$uniqueBlogCheck = $blogRepository->getBlogByPermalink((string) $item->guid);
22
+	if ($uniqueBlogCheck !== false) {
23
+		continue;
24
+	}
25
+
26
+	$datetime->setTimezone($container['default_timezone']);
27
+	$metadata = json_decode(json_encode($item), true);
28
+
29
+	$blogRepository->insertBlog(
30
+		(string) $item->guid,
31
+		$datetime,
32
+		$metadata
33
+	);
34 34
 }
35 35
 
36 36
 $blogCommentRepository = new BlogCommentRepository($container['db_connection_locator']);
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 
42 42
 $commentFeed = Feed::loadRss('http://blog.jacobemerick.com/rss-comments.xml');
43 43
 foreach ($commentFeed->item as $item) {
44
-    $datetime = new DateTime($item->pubDate);
45
-    if ($datetime <= $mostRecentBlogCommentDateTime) {
46
-        break;
47
-    }
48
-
49
-    $uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid);
50
-    if ($uniqueBlogCommentCheck !== false) {
51
-        continue;
52
-    }
53
-
54
-    $datetime->setTimezone($container['default_timezone']);
55
-    $metadata = json_decode(json_encode($item), true);
56
-
57
-    $blogCommentRepository->insertBlogComment(
58
-        (string) $item->guid,
59
-        $datetime,
60
-        $metadata
61
-    );
44
+	$datetime = new DateTime($item->pubDate);
45
+	if ($datetime <= $mostRecentBlogCommentDateTime) {
46
+		break;
47
+	}
48
+
49
+	$uniqueBlogCommentCheck = $blogCommentRepository->getBlogCommentByPermalink((string) $item->guid);
50
+	if ($uniqueBlogCommentCheck !== false) {
51
+		continue;
52
+	}
53
+
54
+	$datetime->setTimezone($container['default_timezone']);
55
+	$metadata = json_decode(json_encode($item), true);
56
+
57
+	$blogCommentRepository->insertBlogComment(
58
+		(string) $item->guid,
59
+		$datetime,
60
+		$metadata
61
+	);
62 62
 }
Please login to merge, or discard this patch.
bootstrap.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 
11 11
 $handle = @fopen($config_path, 'r');
12 12
 if ($handle === false) {
13
-    throw new RuntimeException("Could not load config");
13
+	throw new RuntimeException("Could not load config");
14 14
 }
15 15
 $config = fread($handle, filesize($config_path));
16 16
 fclose($handle);
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $config = json_decode($config);
19 19
 $last_json_error = json_last_error();
20 20
 if ($last_json_error !== JSON_ERROR_NONE) {
21
-    throw new RuntimeException("Could not parse config - JSON error detected");
21
+	throw new RuntimeException("Could not parse config - JSON error detected");
22 22
 }
23 23
 $container['config'] = $config;
24 24
 
@@ -26,64 +26,64 @@  discard block
 block discarded – undo
26 26
 // timezones are fun
27 27
 date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration
28 28
 $container['default_timezone'] = function ($c) {
29
-    return new DateTimeZone('America/Phoenix');
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 35
 $db_connections->setDefault(function () use ($config) {
36
-    $connection = $config->database->slave;
37
-    return new Aura\Sql\ExtendedPdo(
38
-        "mysql:host={$connection->host}",
39
-        $connection->user,
40
-        $connection->password
41
-    );
36
+	$connection = $config->database->slave;
37
+	return new Aura\Sql\ExtendedPdo(
38
+		"mysql:host={$connection->host}",
39
+		$connection->user,
40
+		$connection->password
41
+	);
42 42
 });
43 43
 $db_connections->setWrite('master', function () use ($config) {
44
-    $connection = $config->database->master;
45
-    return new Aura\Sql\ExtendedPdo(
46
-        "mysql:host={$connection->host}",
47
-        $connection->user,
48
-        $connection->password
49
-    );
44
+	$connection = $config->database->master;
45
+	return new Aura\Sql\ExtendedPdo(
46
+		"mysql:host={$connection->host}",
47
+		$connection->user,
48
+		$connection->password
49
+	);
50 50
 });
51 51
 $db_connections->setRead('slave', function () use ($config) {
52
-    $connection = $config->database->slave;
53
-    $pdo = new Aura\Sql\ExtendedPdo(
54
-        "mysql:host={$connection->host}",
55
-        $connection->user,
56
-        $connection->password
57
-    );
58
-
59
-    $profiler = new Aura\Sql\Profiler();
60
-    $profiler->setActive(true);
61
-    $pdo->setProfiler($profiler);
62
-
63
-    return $pdo;
52
+	$connection = $config->database->slave;
53
+	$pdo = new Aura\Sql\ExtendedPdo(
54
+		"mysql:host={$connection->host}",
55
+		$connection->user,
56
+		$connection->password
57
+	);
58
+
59
+	$profiler = new Aura\Sql\Profiler();
60
+	$profiler->setActive(true);
61
+	$pdo->setProfiler($profiler);
62
+
63
+	return $pdo;
64 64
 });
65 65
 $container['db_connection_locator'] = $db_connections;
66 66
 
67 67
 
68 68
 // setup mail handler
69 69
 $container['mail'] = $container->factory(function ($c) {
70
-    return new Jacobemerick\Archangel\Archangel();
70
+	return new Jacobemerick\Archangel\Archangel();
71 71
 });
72 72
 
73 73
 
74 74
 // setup the logger
75 75
 $container['setup_logger'] = $container->protect(function ($name) use ($container) {
76
-    $logger = new Monolog\Logger($name);
76
+	$logger = new Monolog\Logger($name);
77 77
 
78
-    $logPath = __DIR__ . "/../logs/{$name}.log";
79
-    $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO);
80
-    $streamHandler->setFormatter(
81
-        new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n")
82
-    );
83
-    $logger->pushHandler($streamHandler);
78
+	$logPath = __DIR__ . "/../logs/{$name}.log";
79
+	$streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO);
80
+	$streamHandler->setFormatter(
81
+		new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n")
82
+	);
83
+	$logger->pushHandler($streamHandler);
84 84
 
85
-    Monolog\ErrorHandler::register($logger);
86
-    $container['logger'] = $logger;
85
+	Monolog\ErrorHandler::register($logger);
86
+	$container['logger'] = $logger;
87 87
 });
88 88
 
89 89
 
Please login to merge, or discard this 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.