Passed
Push — dependabot/composer/newinterna... ( 13eb18 )
by
unknown
04:37
created
includes/Helpers/Interfaces/IOAuthHelper.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,39 +15,39 @@
 block discarded – undo
15 15
 
16 16
 interface IOAuthHelper
17 17
 {
18
-    /**
19
-     * @return stdClass
20
-     *
21
-     * @throws Exception
22
-     * @throws CurlException
23
-     */
24
-    public function getRequestToken();
18
+	/**
19
+	 * @return stdClass
20
+	 *
21
+	 * @throws Exception
22
+	 * @throws CurlException
23
+	 */
24
+	public function getRequestToken();
25 25
 
26
-    /**
27
-     * @param string $requestToken
28
-     *
29
-     * @return string
30
-     */
31
-    public function getAuthoriseUrl($requestToken);
26
+	/**
27
+	 * @param string $requestToken
28
+	 *
29
+	 * @return string
30
+	 */
31
+	public function getAuthoriseUrl($requestToken);
32 32
 
33
-    /**
34
-     * @param string $oauthRequestToken
35
-     * @param string $oauthRequestSecret
36
-     * @param string $oauthVerifier
37
-     *
38
-     * @return stdClass
39
-     * @throws CurlException
40
-     * @throws Exception
41
-     */
42
-    public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier);
33
+	/**
34
+	 * @param string $oauthRequestToken
35
+	 * @param string $oauthRequestSecret
36
+	 * @param string $oauthVerifier
37
+	 *
38
+	 * @return stdClass
39
+	 * @throws CurlException
40
+	 * @throws Exception
41
+	 */
42
+	public function callbackCompleted($oauthRequestToken, $oauthRequestSecret, $oauthVerifier);
43 43
 
44
-    /**
45
-     * @param string $oauthAccessToken
46
-     * @param string $oauthAccessSecret
47
-     *
48
-     * @return JWT
49
-     * @throws CurlException
50
-     * @throws Exception
51
-     */
52
-    public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret);
44
+	/**
45
+	 * @param string $oauthAccessToken
46
+	 * @param string $oauthAccessSecret
47
+	 *
48
+	 * @return JWT
49
+	 * @throws CurlException
50
+	 * @throws Exception
51
+	 */
52
+	public function getIdentityTicket($oauthAccessToken, $oauthAccessSecret);
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/Interfaces/IBanHelper.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -12,30 +12,30 @@
 block discarded – undo
12 12
 
13 13
 interface IBanHelper
14 14
 {
15
-    /**
16
-     * Summary of nameIsBanned
17
-     *
18
-     * @param string $name The name to test if is banned.
19
-     *
20
-     * @return Ban
21
-     */
22
-    public function nameIsBanned($name);
15
+	/**
16
+	 * Summary of nameIsBanned
17
+	 *
18
+	 * @param string $name The name to test if is banned.
19
+	 *
20
+	 * @return Ban
21
+	 */
22
+	public function nameIsBanned($name);
23 23
 
24
-    /**
25
-     * Summary of emailIsBanned
26
-     *
27
-     * @param string $email
28
-     *
29
-     * @return Ban
30
-     */
31
-    public function emailIsBanned($email);
24
+	/**
25
+	 * Summary of emailIsBanned
26
+	 *
27
+	 * @param string $email
28
+	 *
29
+	 * @return Ban
30
+	 */
31
+	public function emailIsBanned($email);
32 32
 
33
-    /**
34
-     * Summary of ipIsBanned
35
-     *
36
-     * @param string $ip
37
-     *
38
-     * @return Ban
39
-     */
40
-    public function ipIsBanned($ip);
33
+	/**
34
+	 * Summary of ipIsBanned
35
+	 *
36
+	 * @param string $ip
37
+	 *
38
+	 * @return Ban
39
+	 */
40
+	public function ipIsBanned($ip);
41 41
 }
Please login to merge, or discard this patch.
includes/Helpers/Interfaces/IBlacklistHelper.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@
 block discarded – undo
10 10
 
11 11
 interface IBlacklistHelper
12 12
 {
13
-    /**
14
-     * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist
15
-     *
16
-     * @param string $username
17
-     *
18
-     * @return bool
19
-     */
20
-    public function isBlacklisted($username);
13
+	/**
14
+	 * Returns a value indicating whether the provided username is blacklisted by the on-wiki title blacklist
15
+	 *
16
+	 * @param string $username
17
+	 *
18
+	 * @return bool
19
+	 */
20
+	public function isBlacklisted($username);
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/SearchHelpers/UserSearchHelper.php 3 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -15,77 +15,77 @@  discard block
 block discarded – undo
15 15
 
16 16
 class UserSearchHelper extends SearchHelperBase
17 17
 {
18
-    /**
19
-     * UserSearchHelper constructor.
20
-     *
21
-     * @param PdoDatabase $database
22
-     */
23
-    public function __construct(PdoDatabase $database)
24
-    {
25
-        parent::__construct($database, 'user', User::class);
26
-    }
27
-
28
-    /**
29
-     * Initiates a search for requests
30
-     *
31
-     * @param PdoDatabase $database
32
-     *
33
-     * @return UserSearchHelper
34
-     */
35
-    public static function get(PdoDatabase $database)
36
-    {
37
-        $helper = new UserSearchHelper($database);
38
-
39
-        return $helper;
40
-    }
41
-
42
-    /**
43
-     * @param string $status
44
-     *
45
-     * @return $this
46
-     */
47
-    public function byStatus($status)
48
-    {
49
-        $this->whereClause .= ' AND status = ?';
50
-        $this->parameterList[] = $status;
51
-
52
-        return $this;
53
-    }
54
-
55
-    public function statusIn($statuses) {
56
-        $this->inClause('status', $statuses);
57
-
58
-        return $this;
59
-    }
60
-
61
-    /**
62
-     * @param string $role
63
-     *
64
-     * @return $this
65
-     */
66
-    public function byRole($role)
67
-    {
68
-        $this->joinClause .= ' INNER JOIN userrole r on origin.id = r.user';
69
-        $this->whereClause .= ' AND r.role = ?';
70
-        $this->parameterList[] = $role;
71
-
72
-        return $this;
73
-    }
74
-
75
-    /**
76
-     * @param DateTime $instant
77
-     *
78
-     * @return $this
79
-     */
80
-    public function lastActiveBefore(DateTime $instant){
81
-        $this->whereClause .= ' AND origin.lastactive < ?';
82
-        $this->parameterList[] = $instant->format("Y-m-d H:i:s");
83
-
84
-        return $this;
85
-    }
86
-
87
-    public function getRoleMap(&$roleMap){
88
-        $query = <<<SQL
18
+	/**
19
+	 * UserSearchHelper constructor.
20
+	 *
21
+	 * @param PdoDatabase $database
22
+	 */
23
+	public function __construct(PdoDatabase $database)
24
+	{
25
+		parent::__construct($database, 'user', User::class);
26
+	}
27
+
28
+	/**
29
+	 * Initiates a search for requests
30
+	 *
31
+	 * @param PdoDatabase $database
32
+	 *
33
+	 * @return UserSearchHelper
34
+	 */
35
+	public static function get(PdoDatabase $database)
36
+	{
37
+		$helper = new UserSearchHelper($database);
38
+
39
+		return $helper;
40
+	}
41
+
42
+	/**
43
+	 * @param string $status
44
+	 *
45
+	 * @return $this
46
+	 */
47
+	public function byStatus($status)
48
+	{
49
+		$this->whereClause .= ' AND status = ?';
50
+		$this->parameterList[] = $status;
51
+
52
+		return $this;
53
+	}
54
+
55
+	public function statusIn($statuses) {
56
+		$this->inClause('status', $statuses);
57
+
58
+		return $this;
59
+	}
60
+
61
+	/**
62
+	 * @param string $role
63
+	 *
64
+	 * @return $this
65
+	 */
66
+	public function byRole($role)
67
+	{
68
+		$this->joinClause .= ' INNER JOIN userrole r on origin.id = r.user';
69
+		$this->whereClause .= ' AND r.role = ?';
70
+		$this->parameterList[] = $role;
71
+
72
+		return $this;
73
+	}
74
+
75
+	/**
76
+	 * @param DateTime $instant
77
+	 *
78
+	 * @return $this
79
+	 */
80
+	public function lastActiveBefore(DateTime $instant){
81
+		$this->whereClause .= ' AND origin.lastactive < ?';
82
+		$this->parameterList[] = $instant->format("Y-m-d H:i:s");
83
+
84
+		return $this;
85
+	}
86
+
87
+	public function getRoleMap(&$roleMap){
88
+		$query = <<<SQL
89 89
             SELECT /* UserSearchHelper/roleMap */ 
90 90
                   r.user user
91 91
                 , group_concat(r.role SEPARATOR ', ') roles 
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
             GROUP BY r.user
95 95
 SQL;
96 96
 
97
-        $statement = $this->database->prepare($query);
98
-        $statement->execute($this->parameterList);
97
+		$statement = $this->database->prepare($query);
98
+		$statement->execute($this->parameterList);
99 99
 
100
-        $roleMap = array();
101
-        foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $row) {
102
-            $roleMap[$row['user']] = $row['roles'];
103
-        }
100
+		$roleMap = array();
101
+		foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $row) {
102
+			$roleMap[$row['user']] = $row['roles'];
103
+		}
104 104
 
105
-        return $this;
106
-    }
105
+		return $this;
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,14 +77,14 @@
 block discarded – undo
77 77
      *
78 78
      * @return $this
79 79
      */
80
-    public function lastActiveBefore(DateTime $instant){
80
+    public function lastActiveBefore(DateTime $instant) {
81 81
         $this->whereClause .= ' AND origin.lastactive < ?';
82 82
         $this->parameterList[] = $instant->format("Y-m-d H:i:s");
83 83
 
84 84
         return $this;
85 85
     }
86 86
 
87
-    public function getRoleMap(&$roleMap){
87
+    public function getRoleMap(&$roleMap) {
88 88
         $query = <<<SQL
89 89
             SELECT /* UserSearchHelper/roleMap */ 
90 90
                   r.user user
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
         return $this;
53 53
     }
54 54
 
55
-    public function statusIn($statuses) {
55
+    public function statusIn($statuses)
56
+    {
56 57
         $this->inClause('status', $statuses);
57 58
 
58 59
         return $this;
@@ -77,14 +78,16 @@  discard block
 block discarded – undo
77 78
      *
78 79
      * @return $this
79 80
      */
80
-    public function lastActiveBefore(DateTime $instant){
81
+    public function lastActiveBefore(DateTime $instant)
82
+    {
81 83
         $this->whereClause .= ' AND origin.lastactive < ?';
82 84
         $this->parameterList[] = $instant->format("Y-m-d H:i:s");
83 85
 
84 86
         return $this;
85 87
     }
86 88
 
87
-    public function getRoleMap(&$roleMap){
89
+    public function getRoleMap(&$roleMap)
90
+    {
88 91
         $query = <<<SQL
89 92
             SELECT /* UserSearchHelper/roleMap */ 
90 93
                   r.user user
Please login to merge, or discard this patch.
includes/Helpers/SearchHelpers/SearchHelperBase.php 3 patches
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -15,200 +15,200 @@
 block discarded – undo
15 15
 
16 16
 abstract class SearchHelperBase
17 17
 {
18
-    /** @var PdoDatabase */
19
-    protected $database;
20
-    /** @var array */
21
-    protected $parameterList = array();
22
-    /** @var null|int */
23
-    private $limit = null;
24
-    /** @var null|int */
25
-    private $offset = null;
26
-    private $orderBy = null;
27
-    /**
28
-     * @var string The where clause.
29
-     *
30
-     * (the 1=1 condition will be optimised out of the query by the query planner, and simplifies our code here). Note
31
-     * that we use positional parameters instead of named parameters because we don't know many times different options
32
-     * will be called (looking at excluding() here, but there's the option for others).
33
-     */
34
-    protected $whereClause = ' WHERE 1 = 1';
35
-    /** @var string */
36
-    protected $table;
37
-    protected $joinClause = '';
38
-    private $targetClass;
39
-
40
-    /**
41
-     * SearchHelperBase constructor.
42
-     *
43
-     * @param PdoDatabase $database
44
-     * @param string      $table
45
-     * @param             $targetClass
46
-     * @param null|string $order Order by clause, excluding ORDER BY.
47
-     */
48
-    protected function __construct(PdoDatabase $database, $table, $targetClass, $order = null)
49
-    {
50
-        $this->database = $database;
51
-        $this->table = $table;
52
-        $this->orderBy = $order;
53
-        $this->targetClass = $targetClass;
54
-    }
55
-
56
-    /**
57
-     * Finalises the database query, and executes it, returning a set of objects.
58
-     *
59
-     * @return DataObject[]
60
-     */
61
-    public function fetch()
62
-    {
63
-        $statement = $this->getData();
64
-
65
-        /** @var DataObject[] $returnedObjects */
66
-        $returnedObjects = $statement->fetchAll(PDO::FETCH_CLASS, $this->targetClass);
67
-        foreach ($returnedObjects as $req) {
68
-            $req->setDatabase($this->database);
69
-        }
70
-
71
-        return $returnedObjects;
72
-    }
73
-
74
-    /**
75
-     * Finalises the database query, and executes it, returning only the requested column.
76
-     *
77
-     * @param string $column The required column
78
-     * @return array
79
-     */
80
-    public function fetchColumn($column){
81
-        $statement = $this->getData(array($column));
82
-
83
-        return $statement->fetchAll(PDO::FETCH_COLUMN);
84
-    }
85
-
86
-    public function fetchMap($column){
87
-        $statement = $this->getData(array('id', $column));
88
-
89
-        $data = $statement->fetchAll(PDO::FETCH_ASSOC);
90
-        $map = array();
91
-
92
-        foreach ($data as $row) {
93
-            $map[$row['id']] = $row[$column];
94
-        }
95
-
96
-        return $map;
97
-    }
98
-
99
-    /**
100
-     * @param int $count Returns the record count of the result set
101
-     *
102
-     * @return $this
103
-     */
104
-    public function getRecordCount(&$count)
105
-    {
106
-        $query = 'SELECT /* SearchHelper */ COUNT(*) FROM ' . $this->table . ' origin ';
107
-        $query .= $this->joinClause . $this->whereClause;
108
-
109
-        $statement = $this->database->prepare($query);
110
-        $statement->execute($this->parameterList);
111
-
112
-        $count = $statement->fetchColumn(0);
113
-        $statement->closeCursor();
114
-
115
-        return $this;
116
-    }
117
-
118
-    /**
119
-     * Limits the results
120
-     *
121
-     * @param integer      $limit
122
-     * @param integer|null $offset
123
-     *
124
-     * @return $this
125
-     *
126
-     */
127
-    public function limit($limit, $offset = null)
128
-    {
129
-        $this->limit = $limit;
130
-        $this->offset = $offset;
131
-
132
-        return $this;
133
-    }
134
-
135
-    private function applyLimit()
136
-    {
137
-        $clause = '';
138
-        if ($this->limit !== null) {
139
-            $clause = ' LIMIT ?';
140
-            $this->parameterList[] = $this->limit;
141
-
142
-            if ($this->offset !== null) {
143
-                $clause .= ' OFFSET ?';
144
-                $this->parameterList[] = $this->offset;
145
-            }
146
-        }
147
-
148
-        return $clause;
149
-    }
150
-
151
-    private function applyOrder()
152
-    {
153
-        if ($this->orderBy !== null) {
154
-            return ' ORDER BY ' . $this->orderBy;
155
-        }
156
-
157
-        return '';
158
-    }
159
-
160
-    /**
161
-     * @param array $columns
162
-     *
163
-     * @return PDOStatement
164
-     */
165
-    private function getData($columns = array('*'))
166
-    {
167
-        $query = $this->buildQuery($columns);
168
-        $query .= $this->applyOrder();
169
-        $query .= $this->applyLimit();
170
-
171
-        $statement = $this->database->prepare($query);
172
-        $statement->execute($this->parameterList);
173
-
174
-        return $statement;
175
-    }
176
-
177
-    /**
178
-     * @param array $columns
179
-     *
180
-     * @return string
181
-     */
182
-    protected function buildQuery($columns)
183
-    {
184
-        $colData = array();
185
-        foreach ($columns as $c) {
186
-            $colData[] = 'origin.' . $c;
187
-        }
188
-
189
-        $query = 'SELECT /* SearchHelper */ ' . implode(', ', $colData) . ' FROM ' . $this->table . ' origin ';
190
-        $query .= $this->joinClause . $this->whereClause;
191
-
192
-        return $query;
193
-    }
194
-
195
-    public function inIds($idList) {
196
-        $this->inClause('id', $idList);
197
-        return $this;
198
-    }
199
-
200
-    protected function inClause($column, $values) {
201
-        if (count($values) === 0) {
202
-            return;
203
-        }
204
-
205
-        // Urgh. OK. You can't use IN() with parameters directly, so let's munge something together.
206
-        $valueCount = count($values);
207
-
208
-        // Firstly, let's create a string of question marks, which will do as positional parameters.
209
-        $inSection = str_repeat('?,', $valueCount - 1) . '?';
210
-
211
-        $this->whereClause .= " AND {$column} IN ({$inSection})";
212
-        $this->parameterList = array_merge($this->parameterList, $values);
213
-    }
18
+	/** @var PdoDatabase */
19
+	protected $database;
20
+	/** @var array */
21
+	protected $parameterList = array();
22
+	/** @var null|int */
23
+	private $limit = null;
24
+	/** @var null|int */
25
+	private $offset = null;
26
+	private $orderBy = null;
27
+	/**
28
+	 * @var string The where clause.
29
+	 *
30
+	 * (the 1=1 condition will be optimised out of the query by the query planner, and simplifies our code here). Note
31
+	 * that we use positional parameters instead of named parameters because we don't know many times different options
32
+	 * will be called (looking at excluding() here, but there's the option for others).
33
+	 */
34
+	protected $whereClause = ' WHERE 1 = 1';
35
+	/** @var string */
36
+	protected $table;
37
+	protected $joinClause = '';
38
+	private $targetClass;
39
+
40
+	/**
41
+	 * SearchHelperBase constructor.
42
+	 *
43
+	 * @param PdoDatabase $database
44
+	 * @param string      $table
45
+	 * @param             $targetClass
46
+	 * @param null|string $order Order by clause, excluding ORDER BY.
47
+	 */
48
+	protected function __construct(PdoDatabase $database, $table, $targetClass, $order = null)
49
+	{
50
+		$this->database = $database;
51
+		$this->table = $table;
52
+		$this->orderBy = $order;
53
+		$this->targetClass = $targetClass;
54
+	}
55
+
56
+	/**
57
+	 * Finalises the database query, and executes it, returning a set of objects.
58
+	 *
59
+	 * @return DataObject[]
60
+	 */
61
+	public function fetch()
62
+	{
63
+		$statement = $this->getData();
64
+
65
+		/** @var DataObject[] $returnedObjects */
66
+		$returnedObjects = $statement->fetchAll(PDO::FETCH_CLASS, $this->targetClass);
67
+		foreach ($returnedObjects as $req) {
68
+			$req->setDatabase($this->database);
69
+		}
70
+
71
+		return $returnedObjects;
72
+	}
73
+
74
+	/**
75
+	 * Finalises the database query, and executes it, returning only the requested column.
76
+	 *
77
+	 * @param string $column The required column
78
+	 * @return array
79
+	 */
80
+	public function fetchColumn($column){
81
+		$statement = $this->getData(array($column));
82
+
83
+		return $statement->fetchAll(PDO::FETCH_COLUMN);
84
+	}
85
+
86
+	public function fetchMap($column){
87
+		$statement = $this->getData(array('id', $column));
88
+
89
+		$data = $statement->fetchAll(PDO::FETCH_ASSOC);
90
+		$map = array();
91
+
92
+		foreach ($data as $row) {
93
+			$map[$row['id']] = $row[$column];
94
+		}
95
+
96
+		return $map;
97
+	}
98
+
99
+	/**
100
+	 * @param int $count Returns the record count of the result set
101
+	 *
102
+	 * @return $this
103
+	 */
104
+	public function getRecordCount(&$count)
105
+	{
106
+		$query = 'SELECT /* SearchHelper */ COUNT(*) FROM ' . $this->table . ' origin ';
107
+		$query .= $this->joinClause . $this->whereClause;
108
+
109
+		$statement = $this->database->prepare($query);
110
+		$statement->execute($this->parameterList);
111
+
112
+		$count = $statement->fetchColumn(0);
113
+		$statement->closeCursor();
114
+
115
+		return $this;
116
+	}
117
+
118
+	/**
119
+	 * Limits the results
120
+	 *
121
+	 * @param integer      $limit
122
+	 * @param integer|null $offset
123
+	 *
124
+	 * @return $this
125
+	 *
126
+	 */
127
+	public function limit($limit, $offset = null)
128
+	{
129
+		$this->limit = $limit;
130
+		$this->offset = $offset;
131
+
132
+		return $this;
133
+	}
134
+
135
+	private function applyLimit()
136
+	{
137
+		$clause = '';
138
+		if ($this->limit !== null) {
139
+			$clause = ' LIMIT ?';
140
+			$this->parameterList[] = $this->limit;
141
+
142
+			if ($this->offset !== null) {
143
+				$clause .= ' OFFSET ?';
144
+				$this->parameterList[] = $this->offset;
145
+			}
146
+		}
147
+
148
+		return $clause;
149
+	}
150
+
151
+	private function applyOrder()
152
+	{
153
+		if ($this->orderBy !== null) {
154
+			return ' ORDER BY ' . $this->orderBy;
155
+		}
156
+
157
+		return '';
158
+	}
159
+
160
+	/**
161
+	 * @param array $columns
162
+	 *
163
+	 * @return PDOStatement
164
+	 */
165
+	private function getData($columns = array('*'))
166
+	{
167
+		$query = $this->buildQuery($columns);
168
+		$query .= $this->applyOrder();
169
+		$query .= $this->applyLimit();
170
+
171
+		$statement = $this->database->prepare($query);
172
+		$statement->execute($this->parameterList);
173
+
174
+		return $statement;
175
+	}
176
+
177
+	/**
178
+	 * @param array $columns
179
+	 *
180
+	 * @return string
181
+	 */
182
+	protected function buildQuery($columns)
183
+	{
184
+		$colData = array();
185
+		foreach ($columns as $c) {
186
+			$colData[] = 'origin.' . $c;
187
+		}
188
+
189
+		$query = 'SELECT /* SearchHelper */ ' . implode(', ', $colData) . ' FROM ' . $this->table . ' origin ';
190
+		$query .= $this->joinClause . $this->whereClause;
191
+
192
+		return $query;
193
+	}
194
+
195
+	public function inIds($idList) {
196
+		$this->inClause('id', $idList);
197
+		return $this;
198
+	}
199
+
200
+	protected function inClause($column, $values) {
201
+		if (count($values) === 0) {
202
+			return;
203
+		}
204
+
205
+		// Urgh. OK. You can't use IN() with parameters directly, so let's munge something together.
206
+		$valueCount = count($values);
207
+
208
+		// Firstly, let's create a string of question marks, which will do as positional parameters.
209
+		$inSection = str_repeat('?,', $valueCount - 1) . '?';
210
+
211
+		$this->whereClause .= " AND {$column} IN ({$inSection})";
212
+		$this->parameterList = array_merge($this->parameterList, $values);
213
+	}
214 214
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@
 block discarded – undo
77 77
      * @param string $column The required column
78 78
      * @return array
79 79
      */
80
-    public function fetchColumn($column){
80
+    public function fetchColumn($column) {
81 81
         $statement = $this->getData(array($column));
82 82
 
83 83
         return $statement->fetchAll(PDO::FETCH_COLUMN);
84 84
     }
85 85
 
86
-    public function fetchMap($column){
86
+    public function fetchMap($column) {
87 87
         $statement = $this->getData(array('id', $column));
88 88
 
89 89
         $data = $statement->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,13 +77,15 @@  discard block
 block discarded – undo
77 77
      * @param string $column The required column
78 78
      * @return array
79 79
      */
80
-    public function fetchColumn($column){
80
+    public function fetchColumn($column)
81
+    {
81 82
         $statement = $this->getData(array($column));
82 83
 
83 84
         return $statement->fetchAll(PDO::FETCH_COLUMN);
84 85
     }
85 86
 
86
-    public function fetchMap($column){
87
+    public function fetchMap($column)
88
+    {
87 89
         $statement = $this->getData(array('id', $column));
88 90
 
89 91
         $data = $statement->fetchAll(PDO::FETCH_ASSOC);
@@ -192,12 +194,14 @@  discard block
 block discarded – undo
192 194
         return $query;
193 195
     }
194 196
 
195
-    public function inIds($idList) {
197
+    public function inIds($idList)
198
+    {
196 199
         $this->inClause('id', $idList);
197 200
         return $this;
198 201
     }
199 202
 
200
-    protected function inClause($column, $values) {
203
+    protected function inClause($column, $values)
204
+    {
201 205
         if (count($values) === 0) {
202 206
             return;
203 207
         }
Please login to merge, or discard this patch.
includes/Helpers/SearchHelpers/LogSearchHelper.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -13,87 +13,87 @@
 block discarded – undo
13 13
 
14 14
 class LogSearchHelper extends SearchHelperBase
15 15
 {
16
-    /**
17
-     * LogSearchHelper constructor.
18
-     *
19
-     * @param PdoDatabase $database
20
-     */
21
-    protected function __construct(PdoDatabase $database)
22
-    {
23
-        parent::__construct($database, 'log', Log::class, 'timestamp DESC');
24
-    }
16
+	/**
17
+	 * LogSearchHelper constructor.
18
+	 *
19
+	 * @param PdoDatabase $database
20
+	 */
21
+	protected function __construct(PdoDatabase $database)
22
+	{
23
+		parent::__construct($database, 'log', Log::class, 'timestamp DESC');
24
+	}
25 25
 
26
-    /**
27
-     * Initiates a search for requests
28
-     *
29
-     * @param PdoDatabase $database
30
-     *
31
-     * @return LogSearchHelper
32
-     */
33
-    public static function get(PdoDatabase $database)
34
-    {
35
-        $helper = new LogSearchHelper($database);
26
+	/**
27
+	 * Initiates a search for requests
28
+	 *
29
+	 * @param PdoDatabase $database
30
+	 *
31
+	 * @return LogSearchHelper
32
+	 */
33
+	public static function get(PdoDatabase $database)
34
+	{
35
+		$helper = new LogSearchHelper($database);
36 36
 
37
-        return $helper;
38
-    }
37
+		return $helper;
38
+	}
39 39
 
40
-    /**
41
-     * Filters the results by user
42
-     *
43
-     * @param int $userId
44
-     *
45
-     * @return $this
46
-     */
47
-    public function byUser($userId)
48
-    {
49
-        $this->whereClause .= ' AND user = ?';
50
-        $this->parameterList[] = $userId;
40
+	/**
41
+	 * Filters the results by user
42
+	 *
43
+	 * @param int $userId
44
+	 *
45
+	 * @return $this
46
+	 */
47
+	public function byUser($userId)
48
+	{
49
+		$this->whereClause .= ' AND user = ?';
50
+		$this->parameterList[] = $userId;
51 51
 
52
-        return $this;
53
-    }
52
+		return $this;
53
+	}
54 54
 
55
-    /**
56
-     * Filters the results by log action
57
-     *
58
-     * @param string $action
59
-     *
60
-     * @return $this
61
-     */
62
-    public function byAction($action)
63
-    {
64
-        $this->whereClause .= ' AND action = ?';
65
-        $this->parameterList[] = $action;
55
+	/**
56
+	 * Filters the results by log action
57
+	 *
58
+	 * @param string $action
59
+	 *
60
+	 * @return $this
61
+	 */
62
+	public function byAction($action)
63
+	{
64
+		$this->whereClause .= ' AND action = ?';
65
+		$this->parameterList[] = $action;
66 66
 
67
-        return $this;
68
-    }
67
+		return $this;
68
+	}
69 69
 
70
-    /**
71
-     * Filters the results by object type
72
-     *
73
-     * @param string $objectType
74
-     *
75
-     * @return $this
76
-     */
77
-    public function byObjectType($objectType)
78
-    {
79
-        $this->whereClause .= ' AND objecttype = ?';
80
-        $this->parameterList[] = $objectType;
70
+	/**
71
+	 * Filters the results by object type
72
+	 *
73
+	 * @param string $objectType
74
+	 *
75
+	 * @return $this
76
+	 */
77
+	public function byObjectType($objectType)
78
+	{
79
+		$this->whereClause .= ' AND objecttype = ?';
80
+		$this->parameterList[] = $objectType;
81 81
 
82
-        return $this;
83
-    }
82
+		return $this;
83
+	}
84 84
 
85
-    /**
86
-     * Filters the results by object type
87
-     *
88
-     * @param integer $objectId
89
-     *
90
-     * @return $this
91
-     */
92
-    public function byObjectId($objectId)
93
-    {
94
-        $this->whereClause .= ' AND objectid = ?';
95
-        $this->parameterList[] = $objectId;
85
+	/**
86
+	 * Filters the results by object type
87
+	 *
88
+	 * @param integer $objectId
89
+	 *
90
+	 * @return $this
91
+	 */
92
+	public function byObjectId($objectId)
93
+	{
94
+		$this->whereClause .= ' AND objectid = ?';
95
+		$this->parameterList[] = $objectId;
96 96
 
97
-        return $this;
98
-    }
97
+		return $this;
98
+	}
99 99
 }
100 100
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/SearchHelpers/RequestSearchHelper.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -14,117 +14,117 @@
 block discarded – undo
14 14
 
15 15
 class RequestSearchHelper extends SearchHelperBase
16 16
 {
17
-    /**
18
-     * RequestSearchHelper constructor.
19
-     *
20
-     * @param PdoDatabase $database
21
-     */
22
-    protected function __construct(PdoDatabase $database)
23
-    {
24
-        parent::__construct($database, 'request', Request::class);
25
-    }
26
-
27
-    /**
28
-     * Initiates a search for requests
29
-     *
30
-     * @param PdoDatabase $database
31
-     *
32
-     * @return RequestSearchHelper
33
-     */
34
-    public static function get(PdoDatabase $database)
35
-    {
36
-        $helper = new RequestSearchHelper($database);
37
-
38
-        return $helper;
39
-    }
40
-
41
-    /**
42
-     * Filters the results by IP address
43
-     *
44
-     * @param string $ipAddress
45
-     *
46
-     * @return $this
47
-     */
48
-    public function byIp($ipAddress)
49
-    {
50
-        $this->whereClause .= ' AND (ip LIKE ? OR forwardedip LIKE ?)';
51
-        $this->parameterList[] = $ipAddress;
52
-        $this->parameterList[] = '%' . trim($ipAddress, '%') . '%';
53
-
54
-        return $this;
55
-    }
56
-
57
-    /**
58
-     * Filters the results by email address
59
-     *
60
-     * @param string $emailAddress
61
-     *
62
-     * @return $this
63
-     */
64
-    public function byEmailAddress($emailAddress)
65
-    {
66
-        $this->whereClause .= ' AND email LIKE ?';
67
-        $this->parameterList[] = $emailAddress;
68
-
69
-        return $this;
70
-    }
71
-
72
-    /**
73
-     * Filters the results by name
74
-     *
75
-     * @param string $name
76
-     *
77
-     * @return $this
78
-     */
79
-    public function byName($name)
80
-    {
81
-        $this->whereClause .= ' AND name LIKE ?';
82
-        $this->parameterList[] = $name;
83
-
84
-        return $this;
85
-    }
86
-
87
-    /**
88
-     * Excludes a request from the results
89
-     *
90
-     * @param int $requestId
91
-     *
92
-     * @return $this
93
-     */
94
-    public function excludingRequest($requestId)
95
-    {
96
-        $this->whereClause .= ' AND id <> ?';
97
-        $this->parameterList[] = $requestId;
98
-
99
-        return $this;
100
-    }
101
-
102
-    /**
103
-     * Filters the results to only those with a confirmed email address
104
-     *
105
-     * @return $this
106
-     */
107
-    public function withConfirmedEmail()
108
-    {
109
-        $this->whereClause .= ' AND emailconfirm = ?';
110
-        $this->parameterList[] = 'Confirmed';
111
-
112
-        return $this;
113
-    }
114
-
115
-    /**
116
-     * Filters the results to exclude purged data
117
-     *
118
-     * @param SiteConfiguration $configuration
119
-     *
120
-     * @return $this
121
-     */
122
-    public function excludingPurgedData(SiteConfiguration $configuration)
123
-    {
124
-        $this->whereClause .= ' AND ip <> ? AND email <> ?';
125
-        $this->parameterList[] = $configuration->getDataClearIp();
126
-        $this->parameterList[] = $configuration->getDataClearEmail();
127
-
128
-        return $this;
129
-    }
17
+	/**
18
+	 * RequestSearchHelper constructor.
19
+	 *
20
+	 * @param PdoDatabase $database
21
+	 */
22
+	protected function __construct(PdoDatabase $database)
23
+	{
24
+		parent::__construct($database, 'request', Request::class);
25
+	}
26
+
27
+	/**
28
+	 * Initiates a search for requests
29
+	 *
30
+	 * @param PdoDatabase $database
31
+	 *
32
+	 * @return RequestSearchHelper
33
+	 */
34
+	public static function get(PdoDatabase $database)
35
+	{
36
+		$helper = new RequestSearchHelper($database);
37
+
38
+		return $helper;
39
+	}
40
+
41
+	/**
42
+	 * Filters the results by IP address
43
+	 *
44
+	 * @param string $ipAddress
45
+	 *
46
+	 * @return $this
47
+	 */
48
+	public function byIp($ipAddress)
49
+	{
50
+		$this->whereClause .= ' AND (ip LIKE ? OR forwardedip LIKE ?)';
51
+		$this->parameterList[] = $ipAddress;
52
+		$this->parameterList[] = '%' . trim($ipAddress, '%') . '%';
53
+
54
+		return $this;
55
+	}
56
+
57
+	/**
58
+	 * Filters the results by email address
59
+	 *
60
+	 * @param string $emailAddress
61
+	 *
62
+	 * @return $this
63
+	 */
64
+	public function byEmailAddress($emailAddress)
65
+	{
66
+		$this->whereClause .= ' AND email LIKE ?';
67
+		$this->parameterList[] = $emailAddress;
68
+
69
+		return $this;
70
+	}
71
+
72
+	/**
73
+	 * Filters the results by name
74
+	 *
75
+	 * @param string $name
76
+	 *
77
+	 * @return $this
78
+	 */
79
+	public function byName($name)
80
+	{
81
+		$this->whereClause .= ' AND name LIKE ?';
82
+		$this->parameterList[] = $name;
83
+
84
+		return $this;
85
+	}
86
+
87
+	/**
88
+	 * Excludes a request from the results
89
+	 *
90
+	 * @param int $requestId
91
+	 *
92
+	 * @return $this
93
+	 */
94
+	public function excludingRequest($requestId)
95
+	{
96
+		$this->whereClause .= ' AND id <> ?';
97
+		$this->parameterList[] = $requestId;
98
+
99
+		return $this;
100
+	}
101
+
102
+	/**
103
+	 * Filters the results to only those with a confirmed email address
104
+	 *
105
+	 * @return $this
106
+	 */
107
+	public function withConfirmedEmail()
108
+	{
109
+		$this->whereClause .= ' AND emailconfirm = ?';
110
+		$this->parameterList[] = 'Confirmed';
111
+
112
+		return $this;
113
+	}
114
+
115
+	/**
116
+	 * Filters the results to exclude purged data
117
+	 *
118
+	 * @param SiteConfiguration $configuration
119
+	 *
120
+	 * @return $this
121
+	 */
122
+	public function excludingPurgedData(SiteConfiguration $configuration)
123
+	{
124
+		$this->whereClause .= ' AND ip <> ? AND email <> ?';
125
+		$this->parameterList[] = $configuration->getDataClearIp();
126
+		$this->parameterList[] = $configuration->getDataClearEmail();
127
+
128
+		return $this;
129
+	}
130 130
 }
131 131
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/TypeAheadHelper.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,51 +12,51 @@
 block discarded – undo
12 12
 
13 13
 class TypeAheadHelper implements ITypeAheadHelper
14 14
 {
15
-    private $definedClasses = array();
16
-
17
-    /**
18
-     * @param string   $class     CSS class to apply this typeahead to.
19
-     * @param callable $generator Generator function taking no arguments to return an array of strings.
20
-     */
21
-    public function defineTypeAheadSource($class, callable $generator)
22
-    {
23
-        $dataList = '';
24
-        foreach ($generator() as $dataItem) {
25
-            $dataList .= '"' . htmlentities($dataItem) . '", ';
26
-        }
27
-        $dataList = "[" . rtrim($dataList, ", ") . "]";
28
-
29
-        $script = <<<JS
15
+	private $definedClasses = array();
16
+
17
+	/**
18
+	 * @param string   $class     CSS class to apply this typeahead to.
19
+	 * @param callable $generator Generator function taking no arguments to return an array of strings.
20
+	 */
21
+	public function defineTypeAheadSource($class, callable $generator)
22
+	{
23
+		$dataList = '';
24
+		foreach ($generator() as $dataItem) {
25
+			$dataList .= '"' . htmlentities($dataItem) . '", ';
26
+		}
27
+		$dataList = "[" . rtrim($dataList, ", ") . "]";
28
+
29
+		$script = <<<JS
30 30
 $('.{$class}').typeahead({
31 31
 	source: {$dataList}
32 32
 });
33 33
 JS;
34
-        $this->definedClasses[$class] = $script;
35
-    }
34
+		$this->definedClasses[$class] = $script;
35
+	}
36 36
 
37
-    /**
38
-     * @return string HTML fragment containing a JS block for typeaheads.
39
-     */
40
-    public function getTypeAheadScriptBlock()
41
-    {
42
-        $jsBlocks = '';
37
+	/**
38
+	 * @return string HTML fragment containing a JS block for typeaheads.
39
+	 */
40
+	public function getTypeAheadScriptBlock()
41
+	{
42
+		$jsBlocks = '';
43 43
 
44
-        if (count($this->definedClasses) === 0) {
45
-            return '';
46
-        }
44
+		if (count($this->definedClasses) === 0) {
45
+			return '';
46
+		}
47 47
 
48
-        foreach ($this->definedClasses as $class => $js) {
49
-            $jsBlocks = $js . "\r\n\r\n";
50
-        }
48
+		foreach ($this->definedClasses as $class => $js) {
49
+			$jsBlocks = $js . "\r\n\r\n";
50
+		}
51 51
 
52
-        $data = <<<HTML
52
+		$data = <<<HTML
53 53
 <script type="text/javascript">
54 54
 	{$jsBlocks}
55 55
 </script>
56 56
 HTML;
57 57
 
58
-        $this->definedClasses = array();
58
+		$this->definedClasses = array();
59 59
 
60
-        return $data;
61
-    }
60
+		return $data;
61
+	}
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Helpers/WikiTextHelper.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -12,52 +12,52 @@
 block discarded – undo
12 12
 
13 13
 class WikiTextHelper
14 14
 {
15
-    /**
16
-     * @var SiteConfiguration
17
-     */
18
-    private $configuration;
19
-    /**
20
-     * @var HttpHelper
21
-     */
22
-    private $http;
23
-
24
-    /**
25
-     * WikiTextHelper constructor.
26
-     *
27
-     * @param SiteConfiguration $configuration
28
-     * @param HttpHelper        $http
29
-     */
30
-    public function __construct(SiteConfiguration $configuration, HttpHelper $http)
31
-    {
32
-        $this->configuration = $configuration;
33
-        $this->http = $http;
34
-    }
35
-
36
-    /**
37
-     * Gets the HTML for the provided wiki-markup from the MediaWiki service endpoint
38
-     *
39
-     * @param string $wikiText
40
-     *
41
-     * @return string
42
-     */
43
-    public function getHtmlForWikiText($wikiText)
44
-    {
45
-        $endpoint = $this->configuration->getMediawikiWebServiceEndpoint();
46
-
47
-        $parameters = array(
48
-            'action'             => 'parse',
49
-            'pst'                => true,
50
-            'contentmodel'       => 'wikitext',
51
-            'disablelimitreport' => true,
52
-            'disabletoc'         => true,
53
-            'disableeditsection' => true,
54
-            'format'             => 'php',
55
-            'text'               => $wikiText,
56
-        );
57
-
58
-        $apiResult = $this->http->get($endpoint, $parameters);
59
-        $parseResult = unserialize($apiResult);
60
-
61
-        return $parseResult['parse']['text']['*'];
62
-    }
15
+	/**
16
+	 * @var SiteConfiguration
17
+	 */
18
+	private $configuration;
19
+	/**
20
+	 * @var HttpHelper
21
+	 */
22
+	private $http;
23
+
24
+	/**
25
+	 * WikiTextHelper constructor.
26
+	 *
27
+	 * @param SiteConfiguration $configuration
28
+	 * @param HttpHelper        $http
29
+	 */
30
+	public function __construct(SiteConfiguration $configuration, HttpHelper $http)
31
+	{
32
+		$this->configuration = $configuration;
33
+		$this->http = $http;
34
+	}
35
+
36
+	/**
37
+	 * Gets the HTML for the provided wiki-markup from the MediaWiki service endpoint
38
+	 *
39
+	 * @param string $wikiText
40
+	 *
41
+	 * @return string
42
+	 */
43
+	public function getHtmlForWikiText($wikiText)
44
+	{
45
+		$endpoint = $this->configuration->getMediawikiWebServiceEndpoint();
46
+
47
+		$parameters = array(
48
+			'action'             => 'parse',
49
+			'pst'                => true,
50
+			'contentmodel'       => 'wikitext',
51
+			'disablelimitreport' => true,
52
+			'disabletoc'         => true,
53
+			'disableeditsection' => true,
54
+			'format'             => 'php',
55
+			'text'               => $wikiText,
56
+		);
57
+
58
+		$apiResult = $this->http->get($endpoint, $parameters);
59
+		$parseResult = unserialize($apiResult);
60
+
61
+		return $parseResult['parse']['text']['*'];
62
+	}
63 63
 }
64 64
\ No newline at end of file
Please login to merge, or discard this patch.