Completed
Push — master ( 6e5f86...94c6c2 )
by Jacob
05:04
created
controller/blog/TagController.class.inc.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 		$tag = URLDecode::getPiece(2);
27 27
 		$tag = str_replace('-', ' ', $tag);
28 28
 
29
-        global $container;
30
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
31
-        $tag_result = $repository->findTagByTitle($tag);
29
+		global $container;
30
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
31
+		$tag_result = $repository->findTagByTitle($tag);
32 32
 
33 33
 		if($tag_result === false)
34 34
 			$this->eject();
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		
65 65
 		if($this->page == 1)
66 66
 		{
67
-        global $container;
68
-        $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
69
-        $introduction_result = $repository->findByType('tag', $this->tag['tag']);
67
+		global $container;
68
+		$repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
69
+		$introduction_result = $repository->findByType('tag', $this->tag['tag']);
70 70
 			
71 71
 			if($introduction_result !== false)
72 72
 			{
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 
97 97
 	protected function get_list_results()
98 98
 	{
99
-        global $container;
100
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
101
-        return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset);
99
+		global $container;
100
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
101
+		return $repository->getActivePostsByTag($this->tag['id'], self::$POSTS_PER_PAGE, $this->offset);
102 102
 	}
103 103
 
104 104
 	protected function get_list_description()
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	protected function get_total_post_count()
130 130
 	{
131 131
 		if(!isset($this->total_post_count)) {
132
-        global $container;
133
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
134
-        $this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']);
135
-    }
132
+		global $container;
133
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
134
+		$this->total_post_count = $repository->getActivePostsCountByTag($this->tag['id']);
135
+	}
136 136
 
137 137
 		return $this->total_post_count;
138 138
 	}
Please login to merge, or discard this patch.
controller/blog/CategoryController.class.inc.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 	{
116 116
 		if($this->page == 1)
117 117
 		{
118
-        global $container;
119
-        $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
120
-        $introduction_result = $repository->findByType('category', $this->category->link);
118
+		global $container;
119
+		$repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
120
+		$introduction_result = $repository->findByType('category', $this->category->link);
121 121
 			
122 122
 			$introduction = array();
123 123
 			$introduction['title'] = $introduction_result['title'];
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 
142 142
 	protected function get_list_results()
143 143
 	{
144
-        global $container;
145
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
146
-        return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset);
144
+		global $container;
145
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
146
+		return $repository->getActivePostsByCategory($this->category->link, self::$POSTS_PER_PAGE, $this->offset);
147 147
 	}
148 148
 
149 149
 	protected function get_list_description()
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	protected function get_total_post_count()
175 175
 	{
176 176
 		if(!isset($this->total_post_count)) {
177
-        global $container;
178
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
179
-        $this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link);
180
-    }
177
+		global $container;
178
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
179
+		$this->total_post_count = $repository->getActivePostsCountByCategory($this->category->link);
180
+	}
181 181
 		return $this->total_post_count;
182 182
 	}
183 183
 
Please login to merge, or discard this patch.
controller/blog/AboutController.class.inc.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@
 block discarded – undo
33 33
 
34 34
 	protected function get_introduction()
35 35
 	{
36
-        global $container;
37
-        $repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
38
-        $introduction_result = $repository->findByType('about');
36
+		global $container;
37
+		$repository = new Jacobemerick\Web\Domain\Blog\Introduction\MysqlIntroductionRepository($container['db_connection_locator']);
38
+		$introduction_result = $repository->findByType('about');
39 39
 		
40 40
 		if($introduction_result !== null)
41 41
 		{
Please login to merge, or discard this patch.
controller/blog/SearchController.class.inc.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	{
35 35
 		$query = URLDecode::getPiece(2);
36 36
 		$query = urldecode($query);
37
-        $query = str_replace('-', ' ', $query);
37
+		$query = str_replace('-', ' ', $query);
38 38
 		
39 39
 		$this->query = $query;
40 40
 		
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 	{
88 88
 		if(!isset($this->search_result))
89 89
 		{
90
-        global $container;
91
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
92
-        $posts = $repository->getActivePosts();
90
+		global $container;
91
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
92
+		$posts = $repository->getActivePosts();
93 93
 			
94 94
 			$this->search_result = Search::instance()
95 95
 				->setQuery($this->query)
Please login to merge, or discard this patch.
controller/blog/DefaultPageController.class.inc.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function set_head_data()
20 20
 	{
21
-    $this->set_head('rss_link', [
22
-      'title' => 'Jacob Emerick Blog Feed',
23
-      'url' => '/rss.xml'
24
-    ]);
25
-    $this->set_head('rss_comment_link', [
26
-      'title' => 'Jacob Emerick Blog Comment Feed',
27
-      'url' => '/rss-comments.xml'
28
-    ]);
21
+	$this->set_head('rss_link', [
22
+	  'title' => 'Jacob Emerick Blog Feed',
23
+	  'url' => '/rss.xml'
24
+	]);
25
+	$this->set_head('rss_comment_link', [
26
+	  'title' => 'Jacob Emerick Blog Comment Feed',
27
+	  'url' => '/rss-comments.xml'
28
+	]);
29 29
 		
30 30
 		$this->add_css('normalize');
31 31
 		$this->add_css('blog');
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 
88 88
 	final private function get_tags_for_post($post)
89 89
 	{
90
-        global $container;
91
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
92
-        $tag_result = $repository->getTagsForPost($post['id']);
90
+		global $container;
91
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
92
+		$tag_result = $repository->getTagsForPost($post['id']);
93 93
 
94
-        $tag_array = array();
94
+		$tag_array = array();
95 95
 		foreach($tag_result as $tag)
96 96
 		{
97 97
 			$tag_object = new stdclass();
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 
126 126
 	final private function get_tag_cloud()
127 127
 	{
128
-        global $container;
129
-        $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
130
-        $tag_result = $repository->getTagCloud();
128
+		global $container;
129
+		$repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
130
+		$tag_result = $repository->getTagCloud();
131 131
 		
132 132
 		$maximum_tag_count = $this->get_maximum_tag_count($tag_result);
133 133
 		
Please login to merge, or discard this patch.
src/Domain/Blog/Post/MysqlPostRepository.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -7,163 +7,163 @@  discard block
 block discarded – undo
7 7
 class MysqlPostRepository implements PostRepositoryInterface
8 8
 {
9 9
 
10
-    /** @var  Aura\Sql\ConnectionLocator */
11
-    protected $connections;
12
-
13
-    /**
14
-     * @param Aura\Sql\ConnectionLocator $connections
15
-     */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
18
-        $this->connections = $connections;
19
-    }
20
-
21
-    /**
22
-     * @param string $path
23
-     *
24
-     * @return array|false
25
-     */
26
-    public function findPostByPath($path)
27
-    {
28
-        $query = "
10
+	/** @var  Aura\Sql\ConnectionLocator */
11
+	protected $connections;
12
+
13
+	/**
14
+	 * @param Aura\Sql\ConnectionLocator $connections
15
+	 */
16
+	public function __construct(ConnectionLocator $connections)
17
+	{
18
+		$this->connections = $connections;
19
+	}
20
+
21
+	/**
22
+	 * @param string $path
23
+	 *
24
+	 * @return array|false
25
+	 */
26
+	public function findPostByPath($path)
27
+	{
28
+		$query = "
29 29
             SELECT `id`, `title`, `path`, `date`, `body`, `category`
30 30
             FROM `jpemeric_blog`.`post`
31 31
             WHERE `path` = :path AND `display` = :is_active
32 32
             LIMIT 1";
33
-        $bindings = [
34
-            'path'      => $path,
35
-            'is_active' => 1,
36
-        ];
37
-
38
-        return $this
39
-            ->connections
40
-            ->getRead()
41
-            ->fetchOne($query, $bindings);
42
-    }
43
-
44
-    public function getActivePosts($limit = null, $offset = 0)
45
-    {
46
-        $query = "
33
+		$bindings = [
34
+			'path'      => $path,
35
+			'is_active' => 1,
36
+		];
37
+
38
+		return $this
39
+			->connections
40
+			->getRead()
41
+			->fetchOne($query, $bindings);
42
+	}
43
+
44
+	public function getActivePosts($limit = null, $offset = 0)
45
+	{
46
+		$query = "
47 47
             SELECT `id`, `title`, `path`, `date`, `body`, `category`
48 48
             FROM `jpemeric_blog`.`post`
49 49
             WHERE `display` = :is_active
50 50
             ORDER BY `date` DESC";
51
-        if ($limit != null) {
52
-            $query .= "
51
+		if ($limit != null) {
52
+			$query .= "
53 53
             LIMIT {$offset}, {$limit}";
54
-        }
54
+		}
55 55
 
56
-        $bindings = [
57
-            'is_active' => 1,
58
-        ];
56
+		$bindings = [
57
+			'is_active' => 1,
58
+		];
59 59
 
60
-        return $this
61
-            ->connections
62
-            ->getRead()
63
-            ->fetchAll($query, $bindings);
64
-    }
60
+		return $this
61
+			->connections
62
+			->getRead()
63
+			->fetchAll($query, $bindings);
64
+	}
65 65
 
66
-    public function getActivePostsCount()
67
-    {
68
-        $query = "
66
+	public function getActivePostsCount()
67
+	{
68
+		$query = "
69 69
             SELECT COUNT(1) AS `count`
70 70
             FROM `jpemeric_blog`.`post`
71 71
             WHERE `display` = :is_active";
72
-        $bindings = [
73
-            'is_active' => 1,
74
-        ];
75
-
76
-        return $this
77
-            ->connections
78
-            ->getRead()
79
-            ->fetchValue($query, $bindings);
80
-    }
81
-
82
-    public function getActivePostsByTag($tag, $limit = null, $offset = 0)
83
-    {
84
-        $query = "
72
+		$bindings = [
73
+			'is_active' => 1,
74
+		];
75
+
76
+		return $this
77
+			->connections
78
+			->getRead()
79
+			->fetchValue($query, $bindings);
80
+	}
81
+
82
+	public function getActivePostsByTag($tag, $limit = null, $offset = 0)
83
+	{
84
+		$query = "
85 85
             SELECT `id`, `title`, `path`, `date`, `body`, `category`
86 86
             FROM `jpemeric_blog`.`post`
87 87
             INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND
88 88
                                                    `ptlink`.`tag_id` = :tag_id
89 89
             WHERE `display` = :is_active";
90
-        if ($limit != null) {
91
-            $query .= "
90
+		if ($limit != null) {
91
+			$query .= "
92 92
             LIMIT {$offset}, {$limit}";
93
-        }
94
-
95
-        $bindings = [
96
-            'tag_id'    => $tag,
97
-            'is_active' => 1,
98
-        ];
99
-
100
-        return $this
101
-            ->connections
102
-            ->getRead()
103
-            ->fetchAll($query, $bindings);
104
-    }
105
-
106
-    public function getActivePostsCountByTag($tag)
107
-    {
108
-        $query = "
93
+		}
94
+
95
+		$bindings = [
96
+			'tag_id'    => $tag,
97
+			'is_active' => 1,
98
+		];
99
+
100
+		return $this
101
+			->connections
102
+			->getRead()
103
+			->fetchAll($query, $bindings);
104
+	}
105
+
106
+	public function getActivePostsCountByTag($tag)
107
+	{
108
+		$query = "
109 109
             SELECT COUNT(1) AS `count`
110 110
             FROM `jpemeric_blog`.`post`
111 111
             INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND
112 112
                                                    `ptlink`.`tag_id` = :tag_id
113 113
             WHERE `display` = :is_active";
114
-        $bindings = [
115
-            'tag_id'    => $tag,
116
-            'is_active' => 1,
117
-        ];
118
-
119
-        return $this
120
-            ->connections
121
-            ->getRead()
122
-            ->fetchValue($query, $bindings);
123
-    }
124
-
125
-    public function getActivePostsByCategory($category, $limit = null, $offset = 0)
126
-    {
127
-        $query = "
114
+		$bindings = [
115
+			'tag_id'    => $tag,
116
+			'is_active' => 1,
117
+		];
118
+
119
+		return $this
120
+			->connections
121
+			->getRead()
122
+			->fetchValue($query, $bindings);
123
+	}
124
+
125
+	public function getActivePostsByCategory($category, $limit = null, $offset = 0)
126
+	{
127
+		$query = "
128 128
             SELECT `id`, `title`, `path`, `date`, `body`, `category`
129 129
             FROM `jpemeric_blog`.`post`
130 130
             WHERE `category` = :category AND `display` = :is_active";
131
-        if ($limit != null) {
132
-            $query .= "
131
+		if ($limit != null) {
132
+			$query .= "
133 133
             LIMIT {$offset}, {$limit}";
134
-        }
135
-
136
-        $bindings = [
137
-            'category'  => $category,
138
-            'is_active' => 1,
139
-        ];
140
-
141
-        return $this
142
-            ->connections
143
-            ->getRead()
144
-            ->fetchAll($query, $bindings);
145
-    }
146
-
147
-    public function getActivePostsCountByCategory($category)
148
-    {
149
-        $query = "
134
+		}
135
+
136
+		$bindings = [
137
+			'category'  => $category,
138
+			'is_active' => 1,
139
+		];
140
+
141
+		return $this
142
+			->connections
143
+			->getRead()
144
+			->fetchAll($query, $bindings);
145
+	}
146
+
147
+	public function getActivePostsCountByCategory($category)
148
+	{
149
+		$query = "
150 150
             SELECT COUNT(1) AS `count`
151 151
             FROM `jpemeric_blog`.`post`
152 152
             WHERE `category` = :category AND `display` = :is_active";
153
-        $bindings = [
154
-            'category'  => $category,
155
-            'is_active' => 1,
156
-        ];
157
-
158
-        return $this
159
-            ->connections
160
-            ->getRead()
161
-            ->fetchValue($query, $bindings);
162
-    }
163
-
164
-    public function getActivePostsByRelatedTags($post, $limit = 4)
165
-    {
166
-        $query = "
153
+		$bindings = [
154
+			'category'  => $category,
155
+			'is_active' => 1,
156
+		];
157
+
158
+		return $this
159
+			->connections
160
+			->getRead()
161
+			->fetchValue($query, $bindings);
162
+	}
163
+
164
+	public function getActivePostsByRelatedTags($post, $limit = 4)
165
+	{
166
+		$query = "
167 167
             SELECT `id`, `title`, `path`, `date`, `body`, `category`, COUNT(1) AS `count`
168 168
             FROM `jpemeric_blog`.`post`
169 169
             INNER JOIN `jpemeric_blog`.`ptlink` ON `ptlink`.`post_id` = `post`.`id` AND
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
             GROUP BY `id`
184 184
             ORDER BY `count` DESC
185 185
             LIMIT {$limit}";
186
-        $bindings = [
187
-            'post'      => $post,
188
-            'is_active' => 1,
189
-        ];
190
-
191
-        return $this
192
-            ->connections
193
-            ->getRead()
194
-            ->fetchAll($query, $bindings);
195
-    }
186
+		$bindings = [
187
+			'post'      => $post,
188
+			'is_active' => 1,
189
+		];
190
+
191
+		return $this
192
+			->connections
193
+			->getRead()
194
+			->fetchAll($query, $bindings);
195
+	}
196 196
 }
Please login to merge, or discard this patch.
src/Domain/Blog/Post/PostRepositoryInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@
 block discarded – undo
4 4
 
5 5
 interface PostRepositoryInterface
6 6
 {
7
-    public function findPostByPath($path);
8
-    public function getActivePosts($limit = null, $offset= 0);
9
-    public function getActivePostsCount();
10
-    public function getActivePostsByTag($tag, $limit = null, $offset = 0);
11
-    public function getActivePostsCountByTag($tag);
12
-    public function getActivePostsByCategory($category, $limit = null, $offset = 0);
13
-    public function getActivePostsCountByCategory($category);
14
-    public function getActivePostsByRelatedTags($post, $limit = 4);
7
+	public function findPostByPath($path);
8
+	public function getActivePosts($limit = null, $offset= 0);
9
+	public function getActivePostsCount();
10
+	public function getActivePostsByTag($tag, $limit = null, $offset = 0);
11
+	public function getActivePostsCountByTag($tag);
12
+	public function getActivePostsByCategory($category, $limit = null, $offset = 0);
13
+	public function getActivePostsCountByCategory($category);
14
+	public function getActivePostsByRelatedTags($post, $limit = 4);
15 15
 }
Please login to merge, or discard this patch.
utility/content/FixInternalLinkContent.class.inc.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 		switch($type)
33 33
 		{
34 34
 			case 'blog' :
35
-        global $container;
36
-        $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
37
-        $post = $repository->findPostByPath($uri);
35
+		global $container;
36
+		$repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']);
37
+		$post = $repository->findPostByPath($uri);
38 38
 
39 39
 				if($post === NULL)
40 40
 					return;
@@ -73,38 +73,38 @@  discard block
 block discarded – undo
73 73
 				
74 74
 				break;
75 75
 			case 'falls' :
76
-                $pieces = explode('/', $uri);
77
-                if (count($pieces) == 1) {
78
-                    Loader::load('collector', 'waterfall/WatercourseCollector');
79
-                    list ($watercourse_alias) = $pieces;
80
-                    $watercourse = WatercourseCollector::getByAlias($watercourse_alias);
76
+				$pieces = explode('/', $uri);
77
+				if (count($pieces) == 1) {
78
+					Loader::load('collector', 'waterfall/WatercourseCollector');
79
+					list ($watercourse_alias) = $pieces;
80
+					$watercourse = WatercourseCollector::getByAlias($watercourse_alias);
81 81
                     
82
-                    if ($watercourse == null) {
83
-                        return;
84
-                    }
82
+					if ($watercourse == null) {
83
+						return;
84
+					}
85 85
                     
86
-                    $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
87
-                    $link .= "{$watercourse->alias}/";
86
+					$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
87
+					$link .= "{$watercourse->alias}/";
88 88
                     
89
-                    if ($anchor == '') {
90
-                        $anchor = $watercourse->name;
91
-                    }
92
-                } else if (count($pieces) == 2) {
93
-                    Loader::load('collector', 'waterfall/WaterfallCollector');
94
-                    list ($watercourse_alias, $waterfall_alias) = $pieces;
95
-                    $waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias);
89
+					if ($anchor == '') {
90
+						$anchor = $watercourse->name;
91
+					}
92
+				} else if (count($pieces) == 2) {
93
+					Loader::load('collector', 'waterfall/WaterfallCollector');
94
+					list ($watercourse_alias, $waterfall_alias) = $pieces;
95
+					$waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias);
96 96
                     
97
-                    if ($waterfall == null) {
98
-                        return;
99
-                    }
97
+					if ($waterfall == null) {
98
+						return;
99
+					}
100 100
                     
101
-                    $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
102
-                    $link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/";
101
+					$link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/';
102
+					$link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/";
103 103
                     
104
-                    if ($anchor == '') {
105
-                        $anchor = $waterfall->name;
106
-                    }
107
-                }
104
+					if ($anchor == '') {
105
+						$anchor = $waterfall->name;
106
+					}
107
+				}
108 108
 				break;
109 109
 			default :
110 110
 				break;
Please login to merge, or discard this patch.
bootstrap.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 $handle = @fopen($config_path, 'r');
17 17
 if ($handle === false) {
18
-    throw new RuntimeException("Could not load config");
18
+	throw new RuntimeException("Could not load config");
19 19
 }
20 20
 $config = fread($handle, filesize($config_path));
21 21
 fclose($handle);
@@ -23,71 +23,71 @@  discard block
 block discarded – undo
23 23
 $config = json_decode($config);
24 24
 $last_json_error = json_last_error();
25 25
 if ($last_json_error !== JSON_ERROR_NONE) {
26
-    throw new RuntimeException("Could not parse config - JSON error detected");
26
+	throw new RuntimeException("Could not parse config - JSON error detected");
27 27
 }
28 28
 $container['config'] = $config;
29 29
 
30 30
 // timezones are fun
31 31
 date_default_timezone_set('America/Phoenix'); // todo - belongs in configuration
32 32
 $container['default_timezone'] = function ($c) {
33
-    return new DateTimeZone('America/Phoenix');
33
+	return new DateTimeZone('America/Phoenix');
34 34
 };
35 35
 
36 36
 
37 37
 // configure the db connections holder
38 38
 $db_connections = new Aura\Sql\ConnectionLocator();
39 39
 $db_connections->setDefault(function () use ($config) {
40
-    $connection = $config->database->slave;
41
-    return new Aura\Sql\ExtendedPdo(
42
-        "mysql:host={$connection->host}",
43
-        $connection->user,
44
-        $connection->password
45
-    );
40
+	$connection = $config->database->slave;
41
+	return new Aura\Sql\ExtendedPdo(
42
+		"mysql:host={$connection->host}",
43
+		$connection->user,
44
+		$connection->password
45
+	);
46 46
 });
47 47
 $db_connections->setWrite('master', function () use ($config) {
48
-    $connection = $config->database->master;
49
-    return new Aura\Sql\ExtendedPdo(
50
-        "mysql:host={$connection->host}",
51
-        $connection->user,
52
-        $connection->password
53
-    );
48
+	$connection = $config->database->master;
49
+	return new Aura\Sql\ExtendedPdo(
50
+		"mysql:host={$connection->host}",
51
+		$connection->user,
52
+		$connection->password
53
+	);
54 54
 });
55 55
 $db_connections->setRead('slave', function () use ($config) {
56
-    $connection = $config->database->slave;
57
-    $pdo = new Aura\Sql\ExtendedPdo(
58
-        "mysql:host={$connection->host}",
59
-        $connection->user,
60
-        $connection->password
61
-    );
62
-
63
-    $profiler = new Aura\Sql\Profiler();
64
-    $profiler->setActive(true);
65
-    $pdo->setProfiler($profiler);
66
-
67
-    return $pdo;
56
+	$connection = $config->database->slave;
57
+	$pdo = new Aura\Sql\ExtendedPdo(
58
+		"mysql:host={$connection->host}",
59
+		$connection->user,
60
+		$connection->password
61
+	);
62
+
63
+	$profiler = new Aura\Sql\Profiler();
64
+	$profiler->setActive(true);
65
+	$pdo->setProfiler($profiler);
66
+
67
+	return $pdo;
68 68
 });
69 69
 $container['db_connection_locator'] = $db_connections;
70 70
 
71 71
 
72 72
 // setup mail handler
73 73
 $container['mail'] = $container->factory(function ($c) {
74
-    return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']);
74
+	return (new Jacobemerick\Archangel\Archangel())->setLogger($c['logger']);
75 75
 });
76 76
 
77 77
 
78 78
 // setup the logger
79 79
 $container['setup_logger'] = $container->protect(function ($name) use ($container) {
80
-    $logger = new Monolog\Logger($name);
80
+	$logger = new Monolog\Logger($name);
81 81
 
82
-    $logPath = __DIR__ . "/../logs/{$name}.log";
83
-    $streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO);
84
-    $streamHandler->setFormatter(
85
-        new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n")
86
-    );
87
-    $logger->pushHandler($streamHandler);
82
+	$logPath = __DIR__ . "/../logs/{$name}.log";
83
+	$streamHandler = new Monolog\Handler\StreamHandler($logPath, Monolog\Logger::INFO);
84
+	$streamHandler->setFormatter(
85
+		new Monolog\Formatter\LineFormatter("[%datetime%] %channel%.%level_name%: %message%\n")
86
+	);
87
+	$logger->pushHandler($streamHandler);
88 88
 
89
-    Monolog\ErrorHandler::register($logger);
90
-    $container['logger'] = $logger;
89
+	Monolog\ErrorHandler::register($logger);
90
+	$container['logger'] = $logger;
91 91
 });
92 92
 
93 93
 
@@ -108,30 +108,30 @@  discard block
 block discarded – undo
108 108
 
109 109
 // sets up shutdown function to display profiler
110 110
 register_shutdown_function(function () use ($container) {
111
-    if (
112
-        !isset($_COOKIE['debugger']) ||
113
-        $_COOKIE['debugger'] != 'display'
114
-    ) {
115
-        return;
116
-    }
117
-
118
-    $dbProfiles = $container['db_connection_locator']
119
-        ->getRead()
120
-        ->getProfiler()
121
-        ->getProfiles();
122
-    $dbProfiles = array_filter($dbProfiles, function ($profile) {
123
-        return $profile['function'] == 'perform';
124
-    });
125
-    $dbProfiles = array_map(function ($profile) {
126
-        return [
127
-            'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])),
128
-            'parameters' => $profile['bind_values'],
129
-            'time' => $profile['duration'],
130
-        ];
131
-    }, $dbProfiles);
132
-    $container['profiler']->setProfiledQueries($dbProfiles);
133
-    $container['profiler']->setDisplay(new Particletree\Pqp\Display());
134
-    $container['profiler']->display($container['db_connection_locator']->getRead());
111
+	if (
112
+		!isset($_COOKIE['debugger']) ||
113
+		$_COOKIE['debugger'] != 'display'
114
+	) {
115
+		return;
116
+	}
117
+
118
+	$dbProfiles = $container['db_connection_locator']
119
+		->getRead()
120
+		->getProfiler()
121
+		->getProfiles();
122
+	$dbProfiles = array_filter($dbProfiles, function ($profile) {
123
+		return $profile['function'] == 'perform';
124
+	});
125
+	$dbProfiles = array_map(function ($profile) {
126
+		return [
127
+			'sql' => trim(preg_replace('/\s+/', ' ', $profile['statement'])),
128
+			'parameters' => $profile['bind_values'],
129
+			'time' => $profile['duration'],
130
+		];
131
+	}, $dbProfiles);
132
+	$container['profiler']->setProfiledQueries($dbProfiles);
133
+	$container['profiler']->setDisplay(new Particletree\Pqp\Display());
134
+	$container['profiler']->display($container['db_connection_locator']->getRead());
135 135
 });
136 136
 
137 137
 $container['console']->logMemory(null, 'PHP - Post-boostrap memory');
Please login to merge, or discard this patch.