Completed
Push — master ( a1f655...a0345d )
by Jacob
08:14
created
controller/blog/DefaultPageController.class.inc.php 1 patch
Braces   +36 added lines, -32 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 Loader::load('controller', '/PageController');
4 4
 Loader::load('utility', 'Content');
5 5
 
6
-abstract class DefaultPageController extends PageController
7
-{
6
+abstract class DefaultPageController extends PageController
7
+{
8 8
 
9 9
 	private static $RECENT_COMMENT_COUNT = 10;
10 10
 	private static $MINIMUM_TAG_COUNT = 10;
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
 	private static $INTRODUCTION_IMAGE_PATTERN = '<img src="/photo/%s/%s-size-%s.jpg" height="%d" width="%d" alt="%s" />';
16 16
 
17
-	protected function set_head_data()
18
-	{
17
+	protected function set_head_data()
18
+	{
19 19
     $this->set_head('rss_link', [
20 20
       'title' => 'Jacob Emerick Blog Feed',
21 21
       'url' => '/rss.xml'
@@ -29,18 +29,19 @@  discard block
 block discarded – undo
29 29
 		$this->add_css('blog');
30 30
 	}
31 31
 
32
-	protected function get_introduction()
33
-	{
32
+	protected function get_introduction()
33
+	{
34 34
 		return;
35 35
 	}
36 36
 
37
-	protected function get_introduction_image($id)
38
-	{
37
+	protected function get_introduction_image($id)
38
+	{
39 39
 		Loader::load('collector', 'image/PhotoCollector');
40 40
 		$photo_result = PhotoCollector::getRow($id);
41 41
 		
42
-		if($photo_result == null)
43
-			return;
42
+		if($photo_result == null) {
43
+					return;
44
+		}
44 45
 		
45 46
 		$name = $photo_result->name;
46 47
 		$category = $photo_result->category;
@@ -52,8 +53,8 @@  discard block
 block discarded – undo
52 53
 		return sprintf(self::$INTRODUCTION_IMAGE_PATTERN, $category, $name, $size, $height, $width, $description);
53 54
 	}
54 55
 
55
-	protected function set_body_data()
56
-	{
56
+	protected function set_body_data()
57
+	{
57 58
 		$this->set_body('introduction', $this->get_introduction());
58 59
 		$this->set_body('right_side', $this->get_right_side());
59 60
 		$this->set_body('activity_array', $this->get_recent_activity());
@@ -61,8 +62,8 @@  discard block
 block discarded – undo
61 62
 		$this->set_body_view('Page');
62 63
 	}
63 64
 
64
-	final protected function format_post($post, $trim = false)
65
-	{
65
+	final protected function format_post($post, $trim = false)
66
+	{
66 67
 		$post_object = new stdclass();
67 68
 		
68 69
 		$post_object->title = $post['title'];
@@ -77,8 +78,8 @@  discard block
 block discarded – undo
77 78
 		return $post_object;
78 79
 	}
79 80
 
80
-	final private function get_tags_for_post($post)
81
-	{
81
+	final private function get_tags_for_post($post)
82
+	{
82 83
         global $container;
83 84
         $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
84 85
         $tag_result = $repository->getTagsForPost($post['id']);
@@ -94,12 +95,13 @@  discard block
 block discarded – undo
94 95
 		return $tag_array;
95 96
 	}
96 97
 
97
-	final private function get_body_for_post($post, $trim)
98
-	{
98
+	final private function get_body_for_post($post, $trim)
99
+	{
99 100
 		$body = $post['body'];
100 101
 		
101
-		if($trim)
102
-			$body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
102
+		if($trim) {
103
+					$body = Content::instance('SmartTrim', $body)->activate(self::$LENGTH_OF_TRIMMED_POST);
104
+		}
103 105
 		
104 106
 		$body = Content::instance('FixPhoto', $body)->activate(false, 'standard');
105 107
 		$body = Content::instance('MarkupCode', $body)->activate();
@@ -107,16 +109,16 @@  discard block
 block discarded – undo
107 109
 		return $body;
108 110
 	}
109 111
 
110
-	final protected function get_right_side()
111
-	{
112
+	final protected function get_right_side()
113
+	{
112 114
 		$side_array = array();
113 115
 		$side_array['tags'] = $this->get_tag_cloud();
114 116
 		$side_array['comments'] = $this->get_comments();
115 117
 		return $side_array;
116 118
 	}
117 119
 
118
-	final private function get_tag_cloud()
119
-	{
120
+	final private function get_tag_cloud()
121
+	{
120 122
         global $container;
121 123
         $repository = new Jacobemerick\Web\Domain\Blog\Tag\MysqlTagRepository($container['db_connection_locator']);
122 124
         $tag_result = $repository->getTagCloud();
@@ -126,8 +128,9 @@  discard block
 block discarded – undo
126 128
 		$cloud_array = array();
127 129
 		foreach($tag_result as $tag)
128 130
 		{
129
-			if($tag['count'] < self::$MINIMUM_TAG_COUNT)
130
-				continue;
131
+			if($tag['count'] < self::$MINIMUM_TAG_COUNT) {
132
+							continue;
133
+			}
131 134
 			
132 135
 			$tag_object = new stdclass();
133 136
 			$tag_object->name = $tag['tag'];
@@ -139,20 +142,21 @@  discard block
 block discarded – undo
139 142
 		return $cloud_array;
140 143
 	}
141 144
 
142
-	final private function get_maximum_tag_count($tag_result)
143
-	{
145
+	final private function get_maximum_tag_count($tag_result)
146
+	{
144 147
 		$maximum = 1;
145 148
 		
146 149
 		foreach($tag_result as $tag)
147 150
 		{
148
-			if($tag['count'] > $maximum)
149
-				$maximum = $tag['count'];
151
+			if($tag['count'] > $maximum) {
152
+							$maximum = $tag['count'];
153
+			}
150 154
 		}
151 155
 		return $maximum;
152 156
 	}
153 157
 
154
-    final private function get_comments()
155
-    {
158
+    final private function get_comments()
159
+    {
156 160
         global $container;
157 161
         $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']);
158 162
         $start = microtime(true);
Please login to merge, or discard this patch.
controller/waterfalls/HomeController.class.inc.php 1 patch
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 ));
7 7
 Loader::load('controller', 'waterfalls/DefaultPageController');
8 8
 
9
-final class HomeController extends DefaultPageController
10
-{
9
+final class HomeController extends DefaultPageController
10
+{
11 11
 
12 12
     private static $TITLE = 'Waterfalls of the Keweenaw | Stories and Tips from Jacob Emerick';
13 13
     private static $DESCRIPTION = 'Stories, maps, and details about many of the waterfalls in the Upper Peninsula of Michigan, compiled by Jacob Emerick.';
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 
21 21
     private static $BANNER_IMAGE = 2661;
22 22
 
23
-    protected function set_head_data()
24
-    {
23
+    protected function set_head_data()
24
+    {
25 25
         parent::set_head_data();
26 26
         
27 27
         $this->set_title(self::$TITLE);
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
         $this->set_keywords(self::$KEYWORD_ARRAY);
30 30
     }
31 31
 
32
-    protected function set_body_data($page_type = 'wide')
33
-    {
32
+    protected function set_body_data($page_type = 'wide')
33
+    {
34 34
         parent::set_body_data($page_type);
35 35
         
36 36
         $photo = PhotoCollector::getRow(self::$BANNER_IMAGE);
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
         $this->set_body('view', 'Home');
60 60
     }
61 61
 
62
-    protected function get_comments()
63
-    {
62
+    protected function get_comments()
63
+    {
64 64
         global $container;
65 65
         $repository = new Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository($container['comment_service_api']);
66 66
         $start = microtime(true);
Please login to merge, or discard this patch.
controller/waterfalls/WaterfallController.class.inc.php 1 patch
Braces   +34 added lines, -32 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
     'waterfall/LogCollector'));
8 8
 Loader::load('controller', 'waterfalls/DefaultPageController');
9 9
 
10
-final class WaterfallController extends DefaultPageController
11
-{
10
+final class WaterfallController extends DefaultPageController
11
+{
12 12
 
13 13
     private static $STANDARD_IMAGE_NODE = '<img src="/photo/%s/%s-size-standard.jpg" alt="%s" height="600" width="800" />';
14 14
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
     private $waterfall;
20 20
 
21
-    public function __construct()
22
-    {
21
+    public function __construct()
22
+    {
23 23
         parent::__construct();
24 24
 
25 25
         $path_watercourse = URLDecode::getPiece(1);
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
         $this->add_waterfall_js();
40 40
     }
41 41
 
42
-    protected function set_head_data()
43
-    {
42
+    protected function set_head_data()
43
+    {
44 44
         parent::set_head_data();
45 45
 
46 46
         $this->set_title("{$this->waterfall->name} on {$this->waterfall->watercourse} | " . self::$WEBSITE_TITLE);
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
         $this->set_keywords((array) $this->waterfall->name);
49 49
     }
50 50
 
51
-    protected function set_body_data($page_type = 'normal')
52
-    {
51
+    protected function set_body_data($page_type = 'normal')
52
+    {
53 53
         parent::set_body_data($page_type);
54 54
 
55 55
         $body_data = array_merge(
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
         $this->set_body('view', 'Fall');
67 67
     }
68 68
 
69
-    private function format_waterfall_data($waterfall)
70
-    {
69
+    private function format_waterfall_data($waterfall)
70
+    {
71 71
         $waterfall_data = array();
72 72
         $waterfall_data['introduction'] = $this->get_waterfall_introduction($waterfall);
73 73
         $waterfall_data['name'] = $waterfall->name;
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
         return $waterfall_data;
84 84
     }
85 85
 
86
-    private function get_waterfall_introduction($waterfall)
87
-    {
86
+    private function get_waterfall_introduction($waterfall)
87
+    {
88 88
         return array(
89 89
             'path' => "/{$waterfall->watercourse_alias}/{$waterfall->alias}/",
90 90
             'name' => $waterfall->name,
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
         );
94 94
     }
95 95
 
96
-    private function get_main_watercourse($alias)
97
-    {
96
+    private function get_main_watercourse($alias)
97
+    {
98 98
         $watercourse = WatercourseCollector::getByAlias($alias);
99 99
         if ($watercourse->parent != 0) {
100 100
             $watercourse = WatercourseCollector::getById($watercourse->parent);
@@ -107,19 +107,20 @@  discard block
 block discarded – undo
107 107
         );
108 108
     }
109 109
 
110
-    private function format_waterfall_content($content)
111
-    {
110
+    private function format_waterfall_content($content)
111
+    {
112 112
         $content = Content::instance('FixInternalLink', $content)->activate();
113 113
         
114 114
         return $content;
115 115
     }
116 116
 
117
-    private function get_album()
118
-    {
117
+    private function get_album()
118
+    {
119 119
         $album = array();
120 120
         
121
-        if($this->waterfall->album == 0)
122
-            return $album;
121
+        if($this->waterfall->album == 0) {
122
+                    return $album;
123
+        }
123 124
         
124 125
         $photo_list = AlbumCollector::getPhotoListForAlbum($this->waterfall->album);
125 126
         foreach($photo_list as $photo)
@@ -128,10 +129,11 @@  discard block
 block discarded – undo
128 129
             $photo_array['full_link'] = sprintf(self::$FULL_IMAGE_LINK, $photo->category, $photo->name);
129 130
             $photo_array['description'] = $photo->description;
130 131
             
131
-            if($photo->height < $photo->width)
132
-                list($height, $width) = array(75, 100);
133
-            else
134
-                list($height, $width) = array(100, 75);
132
+            if($photo->height < $photo->width) {
133
+                            list($height, $width) = array(75, 100);
134
+            } else {
135
+                            list($height, $width) = array(100, 75);
136
+            }
135 137
             
136 138
             $photo_array['image_node'] = sprintf(
137 139
                 self::$THUMB_IMAGE_NODE,
@@ -147,8 +149,8 @@  discard block
 block discarded – undo
147 149
         return $album;
148 150
     }
149 151
 
150
-	private function get_sidebar($waterfall)
151
-	{
152
+	private function get_sidebar($waterfall)
153
+	{
152 154
 		$sidebar_data = array();
153 155
 		$sidebar_data['name'] = $waterfall->name;
154 156
 		$sidebar_data['watercourse'] = $waterfall->watercourse;
@@ -180,8 +182,8 @@  discard block
 block discarded – undo
180 182
 		return $sidebar_data;
181 183
 	}
182 184
 
183
-    private function get_journal_list($waterfall)
184
-    {
185
+    private function get_journal_list($waterfall)
186
+    {
185 187
         $list = array();
186 188
         $log_result = LogCollector::getLogListForWaterfall($waterfall);
187 189
         foreach ($log_result as $log_row) {
@@ -195,8 +197,8 @@  discard block
 block discarded – undo
195 197
         return $list;
196 198
     }
197 199
 
198
-    private function get_map_piece($waterfall)
199
-    {
200
+    private function get_map_piece($waterfall)
201
+    {
200 202
         $map_holder = array();
201 203
         
202 204
         $url = 'https://maps.googleapis.com/maps/api/staticmap';
@@ -217,8 +219,8 @@  discard block
 block discarded – undo
217 219
         return (object) $map_holder;
218 220
     }
219 221
 
220
-    private function get_nearby_list($waterfall)
221
-    {
222
+    private function get_nearby_list($waterfall)
223
+    {
222 224
         $nearby_list = array();
223 225
         
224 226
         $result = WaterfallCollector::getNearbyList($waterfall);
Please login to merge, or discard this patch.
module/form/CommentSubmitModule.class.inc.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@  discard block
 block discarded – undo
7 7
 
8 8
 use Jacobemerick\Web\Domain\Comment\Comment\ServiceCommentRepository;
9 9
 
10
-class CommentSubmitModule
11
-{
10
+class CommentSubmitModule
11
+{
12 12
 
13 13
     private $site;
14 14
     private $path;
15 15
     private $fullPath;
16 16
 
17
-    public function __construct($site, $path, $fullPath, $pageTitle)
18
-    {
17
+    public function __construct($site, $path, $fullPath, $pageTitle)
18
+    {
19 19
         $this->site = $site;
20 20
         $this->path = $path;
21 21
         $this->fullPath = $fullPath;
22 22
     }
23 23
 
24
-    public function activate()
25
-    {
24
+    public function activate()
25
+    {
26 26
         // todo why is this responsible for checking on valid calls
27 27
         if (!Request::hasPost()) {
28 28
             return false;
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
         $this->redirectToComment($commentId);
45 45
     }
46 46
 
47
-    private function checkValidation()
48
-    {
47
+    private function checkValidation()
48
+    {
49 49
         $errors = array();
50 50
         if (!Validate::checkRequest('post', 'name', 'name')) {
51 51
             $errors['name'] = 'You must include a valid name';
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         return $errors;
70 70
     }
71 71
 
72
-    private function save(array $data)
73
-    {
72
+    private function save(array $data)
73
+    {
74 74
         $path = $_SERVER['REQUEST_URI'];
75 75
         $path = explode('/', $path);
76 76
         $path = array_filter($path);
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         return $response['id'];
108 108
     }
109 109
 
110
-    private function redirectToComment($commentId)
111
-    {
110
+    private function redirectToComment($commentId)
111
+    {
112 112
         $url = '';
113 113
         $url .= $this->fullPath;
114 114
         $url .= "#comment-{$commentId}";
Please login to merge, or discard this patch.
src/Domain/Comment/Comment/ServiceCommentRepository.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use Jacobemerick\CommentService\Api\DefaultApi;
7 7
 use Jacobemerick\CommentService\Model\Comment;
8 8
 
9
-class ServiceCommentRepository implements CommentRepositoryInterface
10
-{
9
+class ServiceCommentRepository implements CommentRepositoryInterface
10
+{
11 11
 
12 12
     /**
13 13
      * @var DefaultApi
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
27 27
      * @return array
28 28
      * @throws ApiException
29 29
      */
30
-    public function createComment(array $comment)
31
-    {
30
+    public function createComment(array $comment)
31
+    {
32 32
         $response = $this->api->createComment($comment);
33 33
         return $this->deserializeComment($response);
34 34
     }
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      * @return array
39 39
      * @throws ApiException
40 40
      */
41
-    public function getComment($commentId)
42
-    {
41
+    public function getComment($commentId)
42
+    {
43 43
         $response = $this->api->getComment($commentId);
44 44
         return $this->deserializeComment($response);
45 45
     }
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
      * @return array
54 54
      * @throws ApiException
55 55
      */
56
-    public function getComments($domain = null, $path = null, $page = null, $perPage = null, $order = null)
57
-    {
56
+    public function getComments($domain = null, $path = null, $page = null, $perPage = null, $order = null)
57
+    {
58 58
         $response = (array) $this->api->getComments($page, $perPage, $order, $domain, $path);
59 59
         return array_map([$this, 'deserializeComment'], $response);
60 60
     }
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
      * @param Comment $comment
64 64
      * @return array
65 65
      */
66
-    protected function deserializeComment(Comment $comment)
67
-    {
66
+    protected function deserializeComment(Comment $comment)
67
+    {
68 68
         return [
69 69
             'id' => $comment->getId(),
70 70
             'commenter' => [
Please login to merge, or discard this patch.
controller/waterfalls/MapController.class.inc.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 Loader::load('controller', 'waterfalls/DefaultPageController');
4 4
 Loader::load('collector', 'waterfall/WaterfallCollector');
5 5
 
6
-final class MapController extends DefaultPageController
7
-{
6
+final class MapController extends DefaultPageController
7
+{
8 8
 
9 9
     private static $TITLE = 'Map of Upper Peninsula Waterfalls';
10 10
     private static $DESCRIPTION = '';
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
         'Upper Tahquamenon Falls',
20 20
     );
21 21
 
22
-    public function __construct()
23
-    {
22
+    public function __construct()
23
+    {
24 24
         parent::__construct();
25 25
 
26 26
         $this->add_js('https://maps.googleapis.com/maps/api/js?key=' . self::$API_KEY . '&sensor=false');
27 27
         $this->add_waterfall_js();
28 28
     }
29 29
 
30
-    protected function set_head_data()
31
-    {
30
+    protected function set_head_data()
31
+    {
32 32
         parent::set_head_data();
33 33
         
34 34
         $this->set_title(self::$TITLE . ' | ' . self::$WEBSITE_TITLE);
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
         $this->set_keywords(self::$KEYWORD_ARRAY);
37 37
     }
38 38
 
39
-    protected function set_body_data($page_type = 'wide')
40
-    {
39
+    protected function set_body_data($page_type = 'wide')
40
+    {
41 41
         parent::set_body_data($page_type);
42 42
         
43 43
         $this->set_head('full_page_map', true);
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
         $this->set_body('view', 'Map');
46 46
     }
47 47
 
48
-    private function fetch_waterfall_list()
49
-    {
48
+    private function fetch_waterfall_list()
49
+    {
50 50
         $list = WaterfallCollector::getMapList();
51 51
         array_walk($list, array($this, 'parse_waterfall'));
52 52
         return $list;
53 53
     }
54 54
 
55
-    private function parse_waterfall(&$waterfall)
56
-    {
55
+    private function parse_waterfall(&$waterfall)
56
+    {
57 57
         $waterfall = (object) array(
58 58
             'name'  => $waterfall->name,
59 59
             'latitude' => $waterfall->latitude,
Please login to merge, or discard this patch.