Completed
Pull Request — master (#221)
by Maximilian
10:25 queued 07:13
created
tests/includes/stringsTest.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 class stringsTest extends PHPUnit_Framework_TestCase
4 4
 {
5
-    private $e;
5
+	private $e;
6 6
 
7 7
 	public function setUp()
8 8
 	{
@@ -11,38 +11,38 @@  discard block
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	public function tearDown() {
14
-        $this->e = NULL;
15
-    }
16
-
17
-    public function test_struname() {
18
-        // Happy path
19
-        $this->assertEquals($this->e->struname("this"), "This");
20
-        $this->assertEquals($this->e->struname("1this"), "1this");
21
-        $this->assertEquals($this->e->struname("This"), "This");
22
-        $this->assertEquals($this->e->struname("This "), "This");
23
-        $this->assertEquals($this->e->struname("This_"), "This");
24
-
25
-        // Sad Path
26
-        $this->assertNotEquals($this->e->struname("This "), "This ");
27
-        $this->assertNotEquals($this->e->struname("This_"), "This_");
28
-        $this->assertNotEquals($this->e->struname("this"), "this");
29
-        $this->assertNotEquals($this->e->struname("1this"), "1This");
30
-    }
31
-
32
-    public function test_stremail() {
33
-        $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
34
-        $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
35
-        $this->assertEquals($this->e->stremail(" [email protected]"), "[email protected]");
36
-        $this->assertEquals($this->e->stremail("[email protected] "), "[email protected]");
37
-        $this->assertEquals($this->e->stremail("1this12345 @example.com"), "[email protected]");
38
-        $this->assertEquals($this->e->stremail("1this12345@ example.com"), "[email protected]");
39
-
40
-        // Sad Path
41
-        $this->assertNotEquals($this->e->stremail(" [email protected]"), " [email protected]");
42
-        $this->assertNotEquals($this->e->stremail("[email protected] "), "[email protected] ");
43
-        $this->assertNotEquals($this->e->stremail("1this12345 @example.com"), "1this12345 @example.com");
44
-        $this->assertNotEquals($this->e->stremail("1this12345@ example.com"), "1this12345@ example.com");
45
-
46
-    }
14
+		$this->e = NULL;
15
+	}
16
+
17
+	public function test_struname() {
18
+		// Happy path
19
+		$this->assertEquals($this->e->struname("this"), "This");
20
+		$this->assertEquals($this->e->struname("1this"), "1this");
21
+		$this->assertEquals($this->e->struname("This"), "This");
22
+		$this->assertEquals($this->e->struname("This "), "This");
23
+		$this->assertEquals($this->e->struname("This_"), "This");
24
+
25
+		// Sad Path
26
+		$this->assertNotEquals($this->e->struname("This "), "This ");
27
+		$this->assertNotEquals($this->e->struname("This_"), "This_");
28
+		$this->assertNotEquals($this->e->struname("this"), "this");
29
+		$this->assertNotEquals($this->e->struname("1this"), "1This");
30
+	}
31
+
32
+	public function test_stremail() {
33
+		$this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
34
+		$this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
35
+		$this->assertEquals($this->e->stremail(" [email protected]"), "[email protected]");
36
+		$this->assertEquals($this->e->stremail("[email protected] "), "[email protected]");
37
+		$this->assertEquals($this->e->stremail("1this12345 @example.com"), "[email protected]");
38
+		$this->assertEquals($this->e->stremail("1this12345@ example.com"), "[email protected]");
39
+
40
+		// Sad Path
41
+		$this->assertNotEquals($this->e->stremail(" [email protected]"), " [email protected]");
42
+		$this->assertNotEquals($this->e->stremail("[email protected] "), "[email protected] ");
43
+		$this->assertNotEquals($this->e->stremail("1this12345 @example.com"), "1this12345 @example.com");
44
+		$this->assertNotEquals($this->e->stremail("1this12345@ example.com"), "1this12345@ example.com");
45
+
46
+	}
47 47
 
48 48
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,11 +10,13 @@  discard block
 block discarded – undo
10 10
 		$this->e = new strings();
11 11
 	}
12 12
 
13
-	public function tearDown() {
13
+	public function tearDown()
14
+	{
14 15
         $this->e = NULL;
15 16
     }
16 17
 
17
-    public function test_struname() {
18
+    public function test_struname()
19
+    {
18 20
         // Happy path
19 21
         $this->assertEquals($this->e->struname("this"), "This");
20 22
         $this->assertEquals($this->e->struname("1this"), "1this");
@@ -29,7 +31,8 @@  discard block
 block discarded – undo
29 31
         $this->assertNotEquals($this->e->struname("1this"), "1This");
30 32
     }
31 33
 
32
-    public function test_stremail() {
34
+    public function test_stremail()
35
+    {
33 36
         $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
34 37
         $this->assertEquals($this->e->stremail("[email protected]"), "[email protected]");
35 38
         $this->assertEquals($this->e->stremail(" [email protected]"), "[email protected]");
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	public function tearDown() {
14
-        $this->e = NULL;
14
+        $this->e = null;
15 15
     }
16 16
 
17 17
     public function test_struname() {
Please login to merge, or discard this patch.
functions.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  */
51 51
 function isHttps() {
52 52
 	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
53
-		if($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
53
+		if ($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
54 54
 			// Client <=> Proxy is encrypted
55 55
 			return true;
56 56
 		}
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	if (isset($_SERVER['HTTPS'])) {
64
-		if($_SERVER['HTTPS'] === 'off') {
64
+		if ($_SERVER['HTTPS'] === 'off') {
65 65
 			// ISAPI on IIS breaks the spec. :(
66 66
 			return false;
67 67
 		}
68 68
 
69
-		if($_SERVER['HTTPS'] !== '') {
69
+		if ($_SERVER['HTTPS'] !== '') {
70 70
 			// Set to a non-empty value
71 71
 			return true;
72 72
 		}
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@  discard block
 block discarded – undo
48 48
  * Returns a value indicating whether the current request was issued over HTTPSs
49 49
  * @return bool true if HTTPS
50 50
  */
51
-function isHttps() {
51
+function isHttps()
52
+{
52 53
 	if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
53 54
 		if($_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
54 55
 			// Client <=> Proxy is encrypted
@@ -399,7 +400,8 @@  discard block
 block discarded – undo
399 400
  * @param $users string[] Array of usernames as strings
400 401
  * @return string
401 402
  */
402
-function getTypeaheadSource($users) {
403
+function getTypeaheadSource($users)
404
+{
403 405
 	$userList = "";
404 406
 	foreach ($users as $v) {
405 407
 		$userList .= "\"" . htmlentities($v) . "\", ";
Please login to merge, or discard this patch.
includes/DataObjects/Notification.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -330,7 +330,8 @@  discard block
 block discarded – undo
330 330
 	 * Summary of sentMail
331 331
 	 * @param Request $request
332 332
 	 */
333
-	public static function sentMail(Request $request) {
333
+	public static function sentMail(Request $request)
334
+	{
334 335
 		self::send(User::getCurrent()->getUsername() 
335 336
 			. " sent an email related to Request {$request->getId()} ({$request->getName()})");
336 337
 	}
@@ -371,7 +372,8 @@  discard block
 block discarded – undo
371 372
 	 * @param Request $request
372 373
 	 * @param User $target
373 374
 	 */
374
-	public static function requestReservationSent(Request $request, User $target) {
375
+	public static function requestReservationSent(Request $request, User $target)
376
+	{
375 377
 		self::send(
376 378
 			"Reservation of request {$request->getId()} ({$request->getName()}) sent to {$target->getUsername()} by " 
377 379
 			. User::getCurrent()->getUsername());
Please login to merge, or discard this patch.
includes/DataObjects/Request.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -271,7 +271,9 @@
 block discarded – undo
271 271
 			return true;
272 272
 		}
273 273
 
274
-		if (is_null(self::$commentsQuery)) self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;");
274
+		if (is_null(self::$commentsQuery)) {
275
+			self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;");
276
+		}
275 277
 		self::$commentsQuery->bindValue(":id", $this->id);
276 278
 
277 279
 		self::$commentsQuery->execute();
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,8 @@
 block discarded – undo
261 261
 		}
262 262
         
263 263
 		if (isset(self::$commentsResults[$this->id])) {
264
-		    $this->hasCommentsResolved = true;
265
-		    return $this->hasComments = self::$commentsResults[$this->id];
264
+			$this->hasCommentsResolved = true;
265
+			return $this->hasComments = self::$commentsResults[$this->id];
266 266
 		}
267 267
 
268 268
 		if ($this->comment != "") {
Please login to merge, or discard this patch.
includes/DataObject.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 	 */
45 45
 	public static function getById($id, PdoDatabase $database)
46 46
 	{
47
-		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
-		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
47
+		if (isset(self::$getByIdResults[strtolower(get_called_class())][$id])) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
+		if (!isset(self::$getByIdStatement[strtolower(get_called_class())])) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
49 49
 		self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id);
50 50
 
51 51
 		self::$getByIdStatement[strtolower(get_called_class())]->execute();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,12 @@
 block discarded – undo
44 44
 	 */
45 45
 	public static function getById($id, PdoDatabase $database)
46 46
 	{
47
-		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
-		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
47
+		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) {
48
+			return self::$getByIdResults[strtolower(get_called_class())][$id];
49
+		}
50
+		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) {
51
+			self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
52
+		}
49 53
 		self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id);
50 54
 
51 55
 		self::$getByIdStatement[strtolower(get_called_class())]->execute();
Please login to merge, or discard this patch.