Completed
Push — master ( b1edf3...c330e2 )
by Jacob
03:28
created
controller/lifestream/DefaultListController.class.inc.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@
 block discarded – undo
56 56
 	final private function get_list_posts()
57 57
 	{
58 58
 		$post_array = array();
59
-		foreach($this->get_list_results() as $post)
59
+		foreach ($this->get_list_results() as $post)
60 60
 		{
61 61
 			$post_array[] = $this->format_post($post, true);
62 62
 		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
63
+		if (count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64 64
 			$this->eject();
65 65
 		return $post_array;
66 66
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@
 block discarded – undo
60 60
 		{
61 61
 			$post_array[] = $this->format_post($post, true);
62 62
 		}
63
-		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search')
64
-			$this->eject();
63
+		if(count($post_array) < 1 && URLDecode::getPiece(1) !== 'search') {
64
+					$this->eject();
65
+		}
65 66
 		return $post_array;
66 67
 	}
67 68
 
Please login to merge, or discard this patch.
controller/home/ContactController.class.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 	public function __construct()
14 14
 	{
15
-        global $config;
15
+		global $config;
16 16
 		$this->headers['From'] = self::$FROM;
17 17
 		$this->headers['Reply-To'] = "Jacob <{$config->admin_email}>";
18 18
 		$this->headers['Bcc'] = "Jacob <{$config->admin_email}>";
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 
34 34
 	private function process_form()
35 35
 	{
36
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
36
+		if (!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
37 37
 			return (object) array('display' => 'normal');
38 38
 		
39 39
 		Loader::load('utility', 'Validate');
40 40
 		$error_result = array();
41
-		if(!Validate::checkRequest('post', 'name', 'string'))
41
+		if (!Validate::checkRequest('post', 'name', 'string'))
42 42
 			$error_result['name'] = 'please enter your name';
43
-		if(!Validate::checkRequest('post', 'email', 'string'))
43
+		if (!Validate::checkRequest('post', 'email', 'string'))
44 44
 			$error_result['email'] = 'please enter a valid email';
45
-		if(!Validate::checkRequest('post', 'message', 'string'))
45
+		if (!Validate::checkRequest('post', 'message', 'string'))
46 46
 			$error_result['message'] = 'please write a message';
47 47
 		
48 48
 		$values = (object) array(
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			'email' => Request::getPost('email'),
51 51
 			'message' => Request::getPost('message'));
52 52
 		
53
-		if(count($error_result) > 0)
53
+		if (count($error_result) > 0)
54 54
 		{
55 55
 			return (object) array(
56 56
 				'display' => 'error',
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,17 +33,21 @@
 block discarded – undo
33 33
 
34 34
 	private function process_form()
35 35
 	{
36
-		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!')
37
-			return (object) array('display' => 'normal');
36
+		if(!Request::hasPost() || Request::getPost('submit') != 'Send Message!') {
37
+					return (object) array('display' => 'normal');
38
+		}
38 39
 		
39 40
 		Loader::load('utility', 'Validate');
40 41
 		$error_result = array();
41
-		if(!Validate::checkRequest('post', 'name', 'string'))
42
-			$error_result['name'] = 'please enter your name';
43
-		if(!Validate::checkRequest('post', 'email', 'string'))
44
-			$error_result['email'] = 'please enter a valid email';
45
-		if(!Validate::checkRequest('post', 'message', 'string'))
46
-			$error_result['message'] = 'please write a message';
42
+		if(!Validate::checkRequest('post', 'name', 'string')) {
43
+					$error_result['name'] = 'please enter your name';
44
+		}
45
+		if(!Validate::checkRequest('post', 'email', 'string')) {
46
+					$error_result['email'] = 'please enter a valid email';
47
+		}
48
+		if(!Validate::checkRequest('post', 'message', 'string')) {
49
+					$error_result['message'] = 'please write a message';
50
+		}
47 51
 		
48 52
 		$values = (object) array(
49 53
 			'name' => Request::getPost('name'),
Please login to merge, or discard this patch.
bootstrap.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 $handle = @fopen($config_path, 'r');
9 9
 if ($handle === false) {
10
-    throw new RuntimeException("Could not load config");
10
+	throw new RuntimeException("Could not load config");
11 11
 }
12 12
 $config = fread($handle, filesize($config_path));
13 13
 fclose($handle);
@@ -15,40 +15,40 @@  discard block
 block discarded – undo
15 15
 $config = json_decode($config);
16 16
 $last_json_error = json_last_error();
17 17
 if ($last_json_error !== JSON_ERROR_NONE) {
18
-    throw new RuntimeException("Could not parse config - JSON error detected");
18
+	throw new RuntimeException("Could not parse config - JSON error detected");
19 19
 }
20 20
 
21 21
 // configure the db connections holder
22 22
 $db_connections = new Aura\Sql\ConnectionLocator();
23 23
 $db_connections->setDefault(function () use ($config) {
24
-    $connection = $config->database->slave;
25
-    return new Aura\Sql\ExtendedPdo(
26
-        "mysql:host={$connection->host}",
27
-        $connection->user,
28
-        $connection->password
29
-    );
24
+	$connection = $config->database->slave;
25
+	return new Aura\Sql\ExtendedPdo(
26
+		"mysql:host={$connection->host}",
27
+		$connection->user,
28
+		$connection->password
29
+	);
30 30
 });
31 31
 $db_connections->setWrite('master', function () use ($config) {
32
-    $connection = $config->database->master;
33
-    return new Aura\Sql\ExtendedPdo(
34
-        "mysql:host={$connection->host}",
35
-        $connection->user,
36
-        $connection->password
37
-    );
32
+	$connection = $config->database->master;
33
+	return new Aura\Sql\ExtendedPdo(
34
+		"mysql:host={$connection->host}",
35
+		$connection->user,
36
+		$connection->password
37
+	);
38 38
 });
39 39
 $db_connections->setRead('slave', function () use ($config) {
40
-    $connection = $config->database->slave;
41
-    $pdo = new Aura\Sql\ExtendedPdo(
42
-        "mysql:host={$connection->host}",
43
-        $connection->user,
44
-        $connection->password
45
-    );
46
-
47
-    $profiler = new Aura\Sql\Profiler();
48
-    $profiler->setActive(true);
49
-    $pdo->setProfiler($profiler);
50
-
51
-    return $pdo;
40
+	$connection = $config->database->slave;
41
+	$pdo = new Aura\Sql\ExtendedPdo(
42
+		"mysql:host={$connection->host}",
43
+		$connection->user,
44
+		$connection->password
45
+	);
46
+
47
+	$profiler = new Aura\Sql\Profiler();
48
+	$profiler->setActive(true);
49
+	$pdo->setProfiler($profiler);
50
+
51
+	return $pdo;
52 52
 });
53 53
 
54 54
 // setup the service locator
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 // configure the db connections holder
22 22
 $db_connections = new Aura\Sql\ConnectionLocator();
23
-$db_connections->setDefault(function () use ($config) {
23
+$db_connections->setDefault(function() use ($config) {
24 24
     $connection = $config->database->slave;
25 25
     return new Aura\Sql\ExtendedPdo(
26 26
         "mysql:host={$connection->host}",
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         $connection->password
29 29
     );
30 30
 });
31
-$db_connections->setWrite('master', function () use ($config) {
31
+$db_connections->setWrite('master', function() use ($config) {
32 32
     $connection = $config->database->master;
33 33
     return new Aura\Sql\ExtendedPdo(
34 34
         "mysql:host={$connection->host}",
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $connection->password
37 37
     );
38 38
 });
39
-$db_connections->setRead('slave', function () use ($config) {
39
+$db_connections->setRead('slave', function() use ($config) {
40 40
     $connection = $config->database->slave;
41 41
     $pdo = new Aura\Sql\ExtendedPdo(
42 42
         "mysql:host={$connection->host}",
Please login to merge, or discard this patch.
src/Domain/Stream/Post/MysqlPostRepository.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -7,132 +7,132 @@
 block discarded – undo
7 7
 class MysqlPostRepository implements PostRepositoryInterface
8 8
 {
9 9
 
10
-    /** @var  ConnectionLocator */
11
-    protected $connections;
12
-
13
-    /**
14
-     * @param ConnectonLocator $connections
15
-     */
16
-    public function __construct(ConnectionLocator $connections)
17
-    {
18
-        $this->connections = $connections;
19
-    }
20
-
21
-    /**
22
-     * @param integer $id
23
-     *
24
-     * @return array|false
25
-     */
26
-    public function getPostById($id)
27
-    {
28
-        $query = "
10
+	/** @var  ConnectionLocator */
11
+	protected $connections;
12
+
13
+	/**
14
+	 * @param ConnectonLocator $connections
15
+	 */
16
+	public function __construct(ConnectionLocator $connections)
17
+	{
18
+		$this->connections = $connections;
19
+	}
20
+
21
+	/**
22
+	 * @param integer $id
23
+	 *
24
+	 * @return array|false
25
+	 */
26
+	public function getPostById($id)
27
+	{
28
+		$query = "
29 29
             SELECT *
30 30
             FROM `jpemeric_stream`.`post`
31 31
             WHERE `id` = :id
32 32
             LIMIT 1";
33
-        $bindings = [
34
-            'id' => $id,
35
-        ];
36
-
37
-        return $this
38
-            ->connections
39
-            ->getRead()
40
-            ->fetchOne($query, $bindings);
41
-    }
42
-
43
-    /**
44
-     * @param string  $type
45
-     * @param integer $type_id
46
-     *
47
-     * @return array|false
48
-     */
49
-    public function getPostByType($type, $type_id)
50
-    {
51
-        $query = "
33
+		$bindings = [
34
+			'id' => $id,
35
+		];
36
+
37
+		return $this
38
+			->connections
39
+			->getRead()
40
+			->fetchOne($query, $bindings);
41
+	}
42
+
43
+	/**
44
+	 * @param string  $type
45
+	 * @param integer $type_id
46
+	 *
47
+	 * @return array|false
48
+	 */
49
+	public function getPostByType($type, $type_id)
50
+	{
51
+		$query = "
52 52
             SELECT *
53 53
             FROM `jpemeric_stream`.`post`
54 54
             WHERE `type` = :type && `type_id` = :type_id
55 55
             LIMIT 1";
56
-        $bindings = [
57
-            'type'    => $type,
58
-            'type_id' => $type_id,
59
-        ];
60
-
61
-        return $this
62
-            ->connections
63
-            ->getRead()
64
-            ->fetchOne($query, $bindings);
65
-    }
66
-
67
-    /**
68
-     * @param integer $limit
69
-     * @param integer $offset
70
-     *
71
-     * @return array|false
72
-     */
73
-    public function getPosts($limit = null, $offset = 0)
74
-    {
75
-        $query = "
56
+		$bindings = [
57
+			'type'    => $type,
58
+			'type_id' => $type_id,
59
+		];
60
+
61
+		return $this
62
+			->connections
63
+			->getRead()
64
+			->fetchOne($query, $bindings);
65
+	}
66
+
67
+	/**
68
+	 * @param integer $limit
69
+	 * @param integer $offset
70
+	 *
71
+	 * @return array|false
72
+	 */
73
+	public function getPosts($limit = null, $offset = 0)
74
+	{
75
+		$query = "
76 76
             SELECT *
77 77
             FROM `jpemeric_stream`.`post`
78 78
             ORDER BY `date` DESC";
79
-        if (!is_null($limit)) {
80
-            $query .= "
79
+		if (!is_null($limit)) {
80
+			$query .= "
81 81
             LIMIT {$offset}, {$limit}";
82
-        }
82
+		}
83 83
 
84
-        return $this
85
-            ->connections
86
-            ->getRead()
87
-            ->fetchAll($query);
88
-    }
84
+		return $this
85
+			->connections
86
+			->getRead()
87
+			->fetchAll($query);
88
+	}
89 89
 
90
-    public function getPostsCount()
91
-    {
92
-        $query = "
90
+	public function getPostsCount()
91
+	{
92
+		$query = "
93 93
             SELECT COUNT(1) AS `count`
94 94
             FROM `jpemeric_stream`.`post`";
95 95
 
96
-        return $this
97
-            ->connections
98
-            ->getRead()
99
-            ->fetchValue($query);
100
-    }
96
+		return $this
97
+			->connections
98
+			->getRead()
99
+			->fetchValue($query);
100
+	}
101 101
 
102
-    public function getPostsByTag($tag, $limit = null, $offset = 0)
103
-    {
104
-        $query = "
102
+	public function getPostsByTag($tag, $limit = null, $offset = 0)
103
+	{
104
+		$query = "
105 105
             SELECT *
106 106
             FROM `jpemeric_stream`.`post`
107 107
             WHERE `tag` = :tag
108 108
             ORDER BY `date` DESC";
109
-        if (!is_null($limit)) {
110
-            $query .= "
109
+		if (!is_null($limit)) {
110
+			$query .= "
111 111
             LIMIT {$offset}, {$limit}";
112
-        }
113
-        $bindings = [
114
-            'tag' => $tag,
115
-        ];
116
-
117
-        return $this
118
-            ->connections
119
-            ->getRead()
120
-            ->fetchAll($query, $bindings);
121
-    }
122
-
123
-    public function getPostsByTagCount($tag)
124
-    {
125
-        $query = "
112
+		}
113
+		$bindings = [
114
+			'tag' => $tag,
115
+		];
116
+
117
+		return $this
118
+			->connections
119
+			->getRead()
120
+			->fetchAll($query, $bindings);
121
+	}
122
+
123
+	public function getPostsByTagCount($tag)
124
+	{
125
+		$query = "
126 126
             SELECT COUNT(1) AS `count`
127 127
             FROM `jpemeric_stream`.`post`
128 128
             WHERE `tag` = :tag";
129
-        $bindings = [
130
-            'tag' => $tag,
131
-        ];
132
-
133
-        return $this
134
-            ->connections
135
-            ->getRead()
136
-            ->fetchAll($query, $bindings);
137
-    }
129
+		$bindings = [
130
+			'tag' => $tag,
131
+		];
132
+
133
+		return $this
134
+			->connections
135
+			->getRead()
136
+			->fetchAll($query, $bindings);
137
+	}
138 138
 }
Please login to merge, or discard this patch.
src/Domain/Stream/Post/PostRepositoryInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 interface PostRepositoryInterface
6 6
 {
7
-    public function getPostById($id);
8
-    public function getPostByType($type, $type_id);
9
-    public function getPosts($limit = null, $offset = 0);
10
-    public function getPostsCount();
11
-    public function getPostsByTag($tag, $limit = null, $offset = 0);
12
-    public function getPostsByTagCount($tag);
7
+	public function getPostById($id);
8
+	public function getPostByType($type, $type_id);
9
+	public function getPosts($limit = null, $offset = 0);
10
+	public function getPostsCount();
11
+	public function getPostsByTag($tag, $limit = null, $offset = 0);
12
+	public function getPostsByTagCount($tag);
13 13
 }
Please login to merge, or discard this patch.