GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — develop ( 99571d...4cb748 )
by Steven
03:40
created
src/HtpasswdManager/Controller/UserController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $result = array();
39 39
         foreach ($userList as $username => $pass) {
40 40
 
41
-            $result [] = array(
41
+            $result [ ] = array(
42 42
                 'username'    => $username,
43 43
                 'paswd'       => $pass,
44 44
                 'isAdmin'     => $this->getUserService()->isUserAllowedToManageUsers($username),
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         $userService = $this->getServiceLocator()->get('HtpasswdManager\Service\UserService');
50 50
 
51
-        $model = new ViewModel (array(
51
+        $model = new ViewModel(array(
52 52
             'userList'    => $result,
53 53
             'currentUser' => $userService->getCurrentUser()
54 54
         ));
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
 
63 63
         if (true === $this->getUserService()->isUserDeleteable($user)) {
64 64
             $this->getHtpasswdService()->deleteUser($user);
65
-            $messages [] = "Der Benutzer '{$user}' wurde gelöscht.";
65
+            $messages [ ] = "Der Benutzer '{$user}' wurde gelöscht.";
66 66
         } else {
67
-            $messages [] = "Der Benutzer '{$user}' steht auf einer Sperrliste und kann nicht gelöscht werden.";
67
+            $messages [ ] = "Der Benutzer '{$user}' steht auf einer Sperrliste und kann nicht gelöscht werden.";
68 68
         }
69 69
 
70 70
         $model = $this->indexAction();
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
         $messages = array();
80 80
         $htpasswd = $this->getHtpasswdService();
81 81
 
82
-        $model = new ViewModel ();
82
+        $model = new ViewModel();
83 83
         $model->setVariable('user', $user);
84 84
 
85 85
         $post = $this->getRequest()->getPost();
86
-        if (!isset ($post ['password'])) {
86
+        if (!isset ($post [ 'password' ])) {
87 87
             // Formular initialisieren
88 88
             if (false === $htpasswd->userExists($user)) {
89 89
                 $this->redirect()->toRoute('htpasswdmanager', array(
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
             }
93 93
         } else {
94 94
             // Formular speichern
95
-            $password = $post ['password'];
95
+            $password = $post [ 'password' ];
96 96
             $htpasswd->updateUser($user, $password);
97
-            $messages [] = "Passwort für '{$user}' wurde aktualisiert.";
97
+            $messages [ ] = "Passwort für '{$user}' wurde aktualisiert.";
98 98
 
99 99
             $model = $this->indexAction();
100 100
             $model->setTemplate('htpasswd-manager/user/index');
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
         $username = $this->getRequest()->getPost('username', '');
110 110
         $password = $this->getRequest()->getPost('password', '');
111 111
         $messages = array();
112
-        $model    = new ViewModel ();
112
+        $model    = new ViewModel();
113 113
 
114 114
         $post = $this->getRequest()->getPost();
115
-        if (!isset ($post ['username'])) {
116
-            return new ViewModel (array(
115
+        if (!isset ($post [ 'username' ])) {
116
+            return new ViewModel(array(
117 117
                 'username' => $username,
118 118
                 'password' => $password,
119 119
                 'messages' => $messages
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
         $model->setVariable('username', $username);
124 124
         $uValid = $this->isUsernameValid($username);
125 125
         if (true !== $uValid) {
126
-            $messages [] = $uValid;
126
+            $messages [ ] = $uValid;
127 127
         }
128 128
 
129 129
         $model->setVariable('password', $password);
130 130
         $pValid = $this->isPasswordValid($password);
131 131
         if (true !== $pValid) {
132
-            $messages [] = $pValid;
132
+            $messages [ ] = $pValid;
133 133
         }
134 134
 
135 135
         if (true === $uValid && true === $pValid) {
136 136
             if (true === $this->getHtpasswdService()->userExists($username)) {
137 137
                 $this->getHtpasswdService()->updateUser($username, $password);
138
-                $messages [] = "Benutzer '{$username}' wurde aktualisiert.";
138
+                $messages [ ] = "Benutzer '{$username}' wurde aktualisiert.";
139 139
             } else {
140 140
                 $this->getHtpasswdService()->addUser($username, $password);
141
-                $messages [] = "Benutzer '{$username}' wurde hinzugefügt.";
141
+                $messages [ ] = "Benutzer '{$username}' wurde hinzugefügt.";
142 142
             }
143 143
 
144 144
             $model = $this->indexAction();
Please login to merge, or discard this patch.
src/HtpasswdManager/Service/HtpasswdService.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
 
19 19
 	public function __construct($htpasswd_filename) {
20 20
 		$this->filename = $htpasswd_filename;
21
-		$this->createFileIfNotExistant ();
21
+		$this->createFileIfNotExistant();
22 22
 	}
23 23
 
24 24
 	private function createFileIfNotExistant() {
25
-		if (true === file_exists ( $this->filename )) {
25
+		if (true === file_exists($this->filename)) {
26 26
 		} else {
27
-			touch ( $this->filename );
27
+			touch($this->filename);
28 28
 		}
29 29
 	}
30 30
 
31 31
 	private function getHtpasswdContent() {
32 32
 		if ($this->htpasswdCache === null) {
33 33
 			
34
-			$this->htpasswdCache = file_get_contents ( $this->filename );
34
+			$this->htpasswdCache = file_get_contents($this->filename);
35 35
 		}
36 36
 		
37 37
 		return $this->htpasswdCache;
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 	private function updateHtpasswdContent() {
41 41
 		$this->htpasswdCache = null;
42 42
 		$this->userListCache = null;
43
-		$this->getUserList ();
43
+		$this->getUserList();
44 44
 	}
45 45
 
46 46
 	public function getUserList() {
47 47
 		if ($this->userListCache === null) {
48 48
 			$result = array();
49 49
 			
50
-			$content = $this->getHtpasswdContent ();
50
+			$content = $this->getHtpasswdContent();
51 51
 			
52
-			if (preg_match_all ( $this::$REGULAR_USER_PASSWORD, $content, $matches, PREG_PATTERN_ORDER ) !== false) {
53
-				foreach ( $matches [1] as $i => $user ) {
54
-					$result [$user] = $matches [2] [$i];
52
+			if (preg_match_all($this::$REGULAR_USER_PASSWORD, $content, $matches, PREG_PATTERN_ORDER) !== false) {
53
+				foreach ($matches [ 1 ] as $i => $user) {
54
+					$result [ $user ] = $matches [ 2 ] [ $i ];
55 55
 				}
56 56
 			}
57 57
 			
@@ -62,43 +62,43 @@  discard block
 block discarded – undo
62 62
 	}
63 63
 
64 64
 	private function encodePassword($password) {
65
-		return crypt ( $password, substr ( str_replace ( '+', '.', base64_encode ( pack ( 'N4', mt_rand (), mt_rand (), mt_rand (), mt_rand () ) ) ), 0, 22 ) );
65
+		return crypt($password, substr(str_replace('+', '.', base64_encode(pack('N4', mt_rand(), mt_rand(), mt_rand(), mt_rand()))), 0, 22));
66 66
 	}
67 67
 
68 68
 	private function getNewUserEncodedString($username, $password) {
69
-		return $username . ':' . $this->encodePassword ( $password ) . "\n";
69
+		return $username . ':' . $this->encodePassword($password) . "\n";
70 70
 	}
71 71
 
72 72
 	public function addUser($username, $password) {
73
-		$newContent = $this->getHtpasswdContent ();
74
-		$newContent .= $this->getNewUserEncodedString ( $username, $password );
73
+		$newContent = $this->getHtpasswdContent();
74
+		$newContent .= $this->getNewUserEncodedString($username, $password);
75 75
 		
76
-		$this->replaceHtPasswdContent ( $newContent );
76
+		$this->replaceHtPasswdContent($newContent);
77 77
 	}
78 78
 
79 79
 	public function updateUser($username, $password) {
80
-		if ($this->userExists ( $username )) {
81
-			$this->deleteUser ( $username );
80
+		if ($this->userExists($username)) {
81
+			$this->deleteUser($username);
82 82
 		}
83 83
 		
84
-		$this->addUser ( $username, $password );
84
+		$this->addUser($username, $password);
85 85
 	}
86 86
 
87 87
 	public function deleteUser($username) {
88 88
 		$newContent = '';
89 89
 		$usernameDeleted = false;
90 90
 		
91
-		if (preg_match_all ( $this::$REGULAR_USER_PASSWORD, $this->getHtpasswdContent (), $match ) > 0) {
92
-			foreach ( $match [1] as $i => $user ) {
91
+		if (preg_match_all($this::$REGULAR_USER_PASSWORD, $this->getHtpasswdContent(), $match) > 0) {
92
+			foreach ($match [ 1 ] as $i => $user) {
93 93
 				if ($user == $username) {
94 94
 					$usernameDeleted = true;
95 95
 				} else {
96
-					$newContent .= $match [0] [$i] . "\n";
96
+					$newContent .= $match [ 0 ] [ $i ] . "\n";
97 97
 				}
98 98
 			}
99 99
 			
100 100
 			if (true === $usernameDeleted) {
101
-				$this->replaceHtPasswdContent ( $newContent );
101
+				$this->replaceHtPasswdContent($newContent);
102 102
 			}
103 103
 		}
104 104
 		
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
 
108 108
 	private function replaceHtPasswdContent($newContent) {
109 109
 		// Alternative: file_put_contents ( $this->filename, $newContent );
110
-		$fp = fopen ( $this->filename, 'w' );
111
-		fwrite ( $fp, $newContent );
112
-		fclose ( $fp );
110
+		$fp = fopen($this->filename, 'w');
111
+		fwrite($fp, $newContent);
112
+		fclose($fp);
113 113
 		
114
-		$this->updateHtpasswdContent ();
114
+		$this->updateHtpasswdContent();
115 115
 	}
116 116
 
117 117
 	public function userExists($username) {
118
-		$userList = $this->getUserList ();
118
+		$userList = $this->getUserList();
119 119
 		
120
-		if (isset ( $userList [$username] ))
120
+		if (isset ($userList [ $username ]))
121 121
 			return true;
122 122
 		
123 123
 		return false;
Please login to merge, or discard this patch.