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.
Passed
Branch master (1cd82a)
by Steven
03:15
created
src/HtpasswdManager/Service/UserService.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
 	 * @return string
29 29
 	 */
30 30
 	public function getCurrentUser() {
31
-		return $this->request->getServer ()->get ( 'REMOTE_USER', null );
31
+		return $this->request->getServer()->get('REMOTE_USER', null);
32 32
 	}
33 33
 
34 34
 	public function isUserDeleteable($username) {
35
-		$eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
35
+		$eResult = $this->getEventManager()->trigger('pre_' . __FUNCTION__, $this, array( 
36 36
 				$username 
37
-		) );
37
+		));
38 38
 		
39
-		if ($eResult->stopped ())
40
-			return $eResult->last ();
39
+		if ($eResult->stopped())
40
+			return $eResult->last();
41 41
 		
42
-		return ! in_array ( $username, $this->not_deletable_users );
42
+		return !in_array($username, $this->not_deletable_users);
43 43
 	}
44 44
 
45 45
 	public function isUserAllowedToManageUsers($username) {
46
-		$eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
46
+		$eResult = $this->getEventManager()->trigger('pre_' . __FUNCTION__, $this, array( 
47 47
 				'user' => $username 
48
-		) );
48
+		));
49 49
 		
50
-		if ($eResult->stopped ())
51
-			return $eResult->last ();
50
+		if ($eResult->stopped())
51
+			return $eResult->last();
52 52
 			
53 53
 			/* If parameter is an array => allow only users in list. IF parameter is boolean, return boolean value */
54
-		if (is_array ( $this->user_with_management_permission )) {
55
-			$accessAllowed = in_array ( $username, $this->user_with_management_permission );
54
+		if (is_array($this->user_with_management_permission)) {
55
+			$accessAllowed = in_array($username, $this->user_with_management_permission);
56 56
 		} else {
57 57
 			$accessAllowed = ($this->user_with_management_permission === true);
58 58
 		}
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
 	}
62 62
 
63 63
 	public function setEventManager(EventManagerInterface $eventManager) {
64
-		$eventManager->setIdentifiers ( array( 
64
+		$eventManager->setIdentifiers(array( 
65 65
 				__CLASS__,
66
-				get_class ( $this ) 
67
-		) );
66
+				get_class($this) 
67
+		));
68 68
 		$this->eventManager = $eventManager;
69 69
 	}
70 70
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 				$username 
37 37
 		) );
38 38
 		
39
-		if ($eResult->stopped ())
40
-			return $eResult->last ();
39
+		if ($eResult->stopped ()) {
40
+					return $eResult->last ();
41
+		}
41 42
 		
42 43
 		return ! in_array ( $username, $this->not_deletable_users );
43 44
 	}
@@ -47,8 +48,9 @@  discard block
 block discarded – undo
47 48
 				'user' => $username 
48 49
 		) );
49 50
 		
50
-		if ($eResult->stopped ())
51
-			return $eResult->last ();
51
+		if ($eResult->stopped ()) {
52
+					return $eResult->last ();
53
+		}
52 54
 			
53 55
 			/* If parameter is an array => allow only users in list. IF parameter is boolean, return boolean value */
54 56
 		if (is_array ( $this->user_with_management_permission )) {
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,65 +11,65 @@
 block discarded – undo
11 11
 use Zend\EventManager\EventManagerInterface;
12 12
 
13 13
 class UserService implements EventManagerAwareInterface {
14
-	protected $request;
15
-	protected $not_deletable_users;
16
-	protected $user_with_management_permission;
17
-	protected $eventManager;
14
+    protected $request;
15
+    protected $not_deletable_users;
16
+    protected $user_with_management_permission;
17
+    protected $eventManager;
18 18
 
19
-	public function __construct(Request $request, $not_deletable_users, $user_with_management_permission) {
20
-		$this->request = $request;
21
-		$this->not_deletable_users = $not_deletable_users;
22
-		$this->user_with_management_permission = $user_with_management_permission;
23
-	}
19
+    public function __construct(Request $request, $not_deletable_users, $user_with_management_permission) {
20
+        $this->request = $request;
21
+        $this->not_deletable_users = $not_deletable_users;
22
+        $this->user_with_management_permission = $user_with_management_permission;
23
+    }
24 24
 
25
-	/**
26
-	 * Return the current used user
27
-	 *
28
-	 * @return string
29
-	 */
30
-	public function getCurrentUser() {
31
-		return $this->request->getServer ()->get ( 'REMOTE_USER', null );
32
-	}
25
+    /**
26
+     * Return the current used user
27
+     *
28
+     * @return string
29
+     */
30
+    public function getCurrentUser() {
31
+        return $this->request->getServer ()->get ( 'REMOTE_USER', null );
32
+    }
33 33
 
34
-	public function isUserDeleteable($username) {
35
-		$eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
36
-				$username 
37
-		) );
34
+    public function isUserDeleteable($username) {
35
+        $eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
36
+                $username 
37
+        ) );
38 38
 		
39
-		if ($eResult->stopped ())
40
-			return $eResult->last ();
39
+        if ($eResult->stopped ())
40
+            return $eResult->last ();
41 41
 		
42
-		return ! in_array ( $username, $this->not_deletable_users );
43
-	}
42
+        return ! in_array ( $username, $this->not_deletable_users );
43
+    }
44 44
 
45
-	public function isUserAllowedToManageUsers($username) {
46
-		$eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
47
-				'user' => $username 
48
-		) );
45
+    public function isUserAllowedToManageUsers($username) {
46
+        $eResult = $this->getEventManager ()->trigger ( 'pre_' . __FUNCTION__, $this, array( 
47
+                'user' => $username 
48
+        ) );
49 49
 		
50
-		if ($eResult->stopped ())
51
-			return $eResult->last ();
50
+        if ($eResult->stopped ())
51
+            return $eResult->last ();
52 52
 			
53
-			/* If parameter is an array => allow only users in list. IF parameter is boolean, return boolean value */
54
-		if (is_array ( $this->user_with_management_permission )) {
55
-			$accessAllowed = in_array ( $username, $this->user_with_management_permission );
56
-		} else {
57
-			$accessAllowed = ($this->user_with_management_permission === true);
58
-		}
53
+            /* If parameter is an array => allow only users in list. IF parameter is boolean, return boolean value */
54
+        if (is_array ( $this->user_with_management_permission )) {
55
+            $accessAllowed = in_array ( $username, $this->user_with_management_permission );
56
+        } else {
57
+            $accessAllowed = ($this->user_with_management_permission === true);
58
+        }
59 59
 		
60
-		return $accessAllowed;
61
-	}
60
+        return $accessAllowed;
61
+    }
62 62
 
63
-	public function setEventManager(EventManagerInterface $eventManager) {
64
-		$eventManager->setIdentifiers ( array( 
65
-				__CLASS__,
66
-				get_class ( $this ) 
67
-		) );
68
-		$this->eventManager = $eventManager;
69
-	}
63
+    public function setEventManager(EventManagerInterface $eventManager) {
64
+        $eventManager->setIdentifiers ( array( 
65
+                __CLASS__,
66
+                get_class ( $this ) 
67
+        ) );
68
+        $this->eventManager = $eventManager;
69
+    }
70 70
 
71
-	public function getEventManager() {
72
-		return $this->eventManager;
73
-	}
71
+    public function getEventManager() {
72
+        return $this->eventManager;
73
+    }
74 74
 
75 75
 }
Please login to merge, or discard this patch.
src/HtpasswdManager/Service/HtpasswdService.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -120,8 +120,9 @@
 block discarded – undo
120 120
 	public function userExists($username) {
121 121
 		$userList = $this->getUserList ();
122 122
 		
123
-		if (isset ( $userList [$username] ))
124
-			return true;
123
+		if (isset ( $userList [$username] )) {
124
+					return true;
125
+		}
125 126
 		
126 127
 		return false;
127 128
 	}
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,120 +7,120 @@
 block discarded – undo
7 7
 namespace HtpasswdManager\Service;
8 8
 
9 9
 class HtpasswdService {
10
-	private $filename;
10
+    private $filename;
11 11
 	
12
-	// Caching of htpasswd-file
13
-	private $userListCache = null;
14
-	private $htpasswdCache = null;
12
+    // Caching of htpasswd-file
13
+    private $userListCache = null;
14
+    private $htpasswdCache = null;
15 15
 	
16
-	// Static Variables
17
-	protected static $REGULAR_USER_PASSWORD = '~^([^:]+):(.+)$~im';
16
+    // Static Variables
17
+    protected static $REGULAR_USER_PASSWORD = '~^([^:]+):(.+)$~im';
18 18
 
19
-	public function __construct($htpasswd_filename) {
20
-		$this->filename = $htpasswd_filename;
21
-		$this->createFileIfNotExistant ();
22
-	}
19
+    public function __construct($htpasswd_filename) {
20
+        $this->filename = $htpasswd_filename;
21
+        $this->createFileIfNotExistant ();
22
+    }
23 23
 
24
-	private function createFileIfNotExistant() {
25
-		if (true === file_exists ( $this->filename )) {
26
-		} else {
27
-			touch ( $this->filename );
28
-		}
29
-	}
24
+    private function createFileIfNotExistant() {
25
+        if (true === file_exists ( $this->filename )) {
26
+        } else {
27
+            touch ( $this->filename );
28
+        }
29
+    }
30 30
 
31
-	private function getHtpasswdContent() {
32
-		if ($this->htpasswdCache === null) {
31
+    private function getHtpasswdContent() {
32
+        if ($this->htpasswdCache === null) {
33 33
 			
34
-			$this->htpasswdCache = file_get_contents ( $this->filename );
35
-		}
34
+            $this->htpasswdCache = file_get_contents ( $this->filename );
35
+        }
36 36
 		
37
-		return $this->htpasswdCache;
38
-	}
37
+        return $this->htpasswdCache;
38
+    }
39 39
 
40
-	private function updateHtpasswdContent() {
41
-		$this->htpasswdCache = null;
42
-		$this->userListCache = null;
43
-		$this->getUserList ();
44
-	}
40
+    private function updateHtpasswdContent() {
41
+        $this->htpasswdCache = null;
42
+        $this->userListCache = null;
43
+        $this->getUserList ();
44
+    }
45 45
 
46
-	public function getUserList() {
47
-		if ($this->userListCache === null) {
48
-			$result = array();
46
+    public function getUserList() {
47
+        if ($this->userListCache === null) {
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];
55
-				}
56
-			}
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
+                }
56
+            }
57 57
 			
58
-			$this->userListCache = $result;
59
-		}
58
+            $this->userListCache = $result;
59
+        }
60 60
 		
61
-		return $this->userListCache;
62
-	}
61
+        return $this->userListCache;
62
+    }
63 63
 
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 ) );
66
-	}
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 ) );
66
+    }
67 67
 
68
-	private function getNewUserEncodedString($username, $password) {
69
-		return $username . ':' . $this->encodePassword ( $password ) . "\n";
70
-	}
68
+    private function getNewUserEncodedString($username, $password) {
69
+        return $username . ':' . $this->encodePassword ( $password ) . "\n";
70
+    }
71 71
 
72
-	public function addUser($username, $password) {
73
-		$newContent = $this->getHtpasswdContent ();
74
-		$newContent .= $this->getNewUserEncodedString ( $username, $password );
72
+    public function addUser($username, $password) {
73
+        $newContent = $this->getHtpasswdContent ();
74
+        $newContent .= $this->getNewUserEncodedString ( $username, $password );
75 75
 		
76
-		$this->replaceHtPasswdContent ( $newContent );
77
-	}
76
+        $this->replaceHtPasswdContent ( $newContent );
77
+    }
78 78
 
79
-	public function updateUser($username, $password) {
80
-		if ($this->userExists ( $username )) {
81
-			$this->deleteUser ( $username );
82
-		}
79
+    public function updateUser($username, $password) {
80
+        if ($this->userExists ( $username )) {
81
+            $this->deleteUser ( $username );
82
+        }
83 83
 		
84
-		$this->addUser ( $username, $password );
85
-	}
84
+        $this->addUser ( $username, $password );
85
+    }
86 86
 
87
-	public function deleteUser($username) {
88
-		$newContent = '';
89
-		$usernameDeleted = false;
87
+    public function deleteUser($username) {
88
+        $newContent = '';
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 ) {
93
-				if ($user == $username) {
94
-					$usernameDeleted = true;
95
-				} else {
96
-					$newContent .= $match [0] [$i] . "\n";
97
-				}
98
-			}
91
+        if (preg_match_all ( $this::$REGULAR_USER_PASSWORD, $this->getHtpasswdContent (), $match ) > 0) {
92
+            foreach ( $match [1] as $i => $user ) {
93
+                if ($user == $username) {
94
+                    $usernameDeleted = true;
95
+                } else {
96
+                    $newContent .= $match [0] [$i] . "\n";
97
+                }
98
+            }
99 99
 			
100
-			if (true === $usernameDeleted) {
101
-				$this->replaceHtPasswdContent ( $newContent );
102
-			}
103
-		}
100
+            if (true === $usernameDeleted) {
101
+                $this->replaceHtPasswdContent ( $newContent );
102
+            }
103
+        }
104 104
 		
105
-		return $usernameDeleted;
106
-	}
105
+        return $usernameDeleted;
106
+    }
107 107
 
108
-	private function replaceHtPasswdContent($newContent) {
109
-		// Alternative: file_put_contents ( $this->filename, $newContent );
110
-		$fp = fopen ( $this->filename, 'w' );
111
-		fwrite ( $fp, $newContent );
112
-		fclose ( $fp );
108
+    private function replaceHtPasswdContent($newContent) {
109
+        // Alternative: file_put_contents ( $this->filename, $newContent );
110
+        $fp = fopen ( $this->filename, 'w' );
111
+        fwrite ( $fp, $newContent );
112
+        fclose ( $fp );
113 113
 		
114
-		$this->updateHtpasswdContent ();
115
-	}
114
+        $this->updateHtpasswdContent ();
115
+    }
116 116
 
117
-	public function userExists($username) {
118
-		$userList = $this->getUserList ();
117
+    public function userExists($username) {
118
+        $userList = $this->getUserList ();
119 119
 		
120
-		if (isset ( $userList [$username] ))
121
-			return true;
120
+        if (isset ( $userList [$username] ))
121
+            return true;
122 122
 		
123
-		return false;
124
-	}
123
+        return false;
124
+    }
125 125
 
126 126
 }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 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,17 +40,17 @@  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 ) {
52
+			if (preg_match_all($this::$REGULAR_USER_PASSWORD, $content, $matches, PREG_PATTERN_ORDER) !== false) {
53
+				foreach ($matches [1] as $i => $user) {
54 54
 					$result [$user] = $matches [2] [$i];
55 55
 				}
56 56
 			}
@@ -62,34 +62,34 @@  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 {
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
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.
src/HtpasswdManager/Controller/UserController.php 2 patches
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -157,12 +157,13 @@
 block discarded – undo
157 157
      * @return boolean string
158 158
      */
159 159
     private function isUsernameValid($username) {
160
-        if (strlen($username) <= 2)
161
-            return "Benutzername ist zu kurz.";
162
-        else if (preg_match('~[a-zäöo][a-zäöu_0-9-]+~i', $username) !== 1)
163
-            return "Benutzername enthält ungültige Zeichen";
164
-        else if (strpos($username, ' ') !== false)
165
-            return "Leerzeichen sind im Benutzernamen nicht erlaubt";
160
+        if (strlen($username) <= 2) {
161
+                    return "Benutzername ist zu kurz.";
162
+        } else if (preg_match('~[a-zäöo][a-zäöu_0-9-]+~i', $username) !== 1) {
163
+                    return "Benutzername enthält ungültige Zeichen";
164
+        } else if (strpos($username, ' ') !== false) {
165
+                    return "Leerzeichen sind im Benutzernamen nicht erlaubt";
166
+        }
166 167
 
167 168
         return true;
168 169
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -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
         ));
@@ -79,7 +79,7 @@  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();
@@ -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 115
         if (!isset ($post ['username'])) {
116
-            return new ViewModel (array(
116
+            return new ViewModel(array(
117 117
                 'username' => $username,
118 118
                 'password' => $password,
119 119
                 'messages' => $messages
Please login to merge, or discard this patch.
config/module.config.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -1,55 +1,55 @@
 block discarded – undo
1 1
 <?php
2 2
 use HtpasswdManager\Service\Factory\UserServiceFactory;
3 3
 return array( 
4
-		'controllers' => array( 
5
-				'invokables' => array( 
6
-						'HtpasswdManager\Controller\User' => 'HtpasswdManager\Controller\UserController' 
7
-				) 
8
-		),
9
-		'service_manager' => array( 
10
-				'factories' => array( 
11
-						'HtpasswdManager\Service\UserService' => 'HtpasswdManager\Service\Factory\UserServiceFactory' 
12
-				) 
13
-		),
14
-		'router' => array( 
15
-				'routes' => array( 
16
-						'htpasswdmanager' => array( 
17
-								'type' => 'Segment',
18
-								'options' => array( 
19
-										// Change this to something specific to your module
20
-										'route' => '/usermanagement[/:action][/:user]',
21
-										'constraints' => array( 
22
-												'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
23
-												'user' => '[a-zA-Z0-9.!?_-]+' 
24
-										),
25
-										'defaults' => array( 
26
-												// Change this value to reflect the namespace in which
27
-												// the controllers for your module are found
28
-												'__NAMESPACE__' => 'HtpasswdManager\Controller',
29
-												'controller' => 'User',
30
-												'action' => 'index' 
31
-										) 
32
-								),
33
-								'may_terminate' => true 
34
-						) 
35
-				) 
36
-		),
37
-		'view_manager' => array( 
38
-				'template_path_stack' => array( 
39
-						'HtpasswdManager' => __DIR__ . '/../view' 
40
-				) 
41
-		),
42
-		'HtpasswdManager' => array( 
43
-				// Carefull! File needs to be writeable by apache-user (www-data)
44
-				// The .htaccess file needs to be set to use this .htpasswd file for authentication
45
-				'htpasswd' => 'path/to/.htpasswd',
4
+        'controllers' => array( 
5
+                'invokables' => array( 
6
+                        'HtpasswdManager\Controller\User' => 'HtpasswdManager\Controller\UserController' 
7
+                ) 
8
+        ),
9
+        'service_manager' => array( 
10
+                'factories' => array( 
11
+                        'HtpasswdManager\Service\UserService' => 'HtpasswdManager\Service\Factory\UserServiceFactory' 
12
+                ) 
13
+        ),
14
+        'router' => array( 
15
+                'routes' => array( 
16
+                        'htpasswdmanager' => array( 
17
+                                'type' => 'Segment',
18
+                                'options' => array( 
19
+                                        // Change this to something specific to your module
20
+                                        'route' => '/usermanagement[/:action][/:user]',
21
+                                        'constraints' => array( 
22
+                                                'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
23
+                                                'user' => '[a-zA-Z0-9.!?_-]+' 
24
+                                        ),
25
+                                        'defaults' => array( 
26
+                                                // Change this value to reflect the namespace in which
27
+                                                // the controllers for your module are found
28
+                                                '__NAMESPACE__' => 'HtpasswdManager\Controller',
29
+                                                'controller' => 'User',
30
+                                                'action' => 'index' 
31
+                                        ) 
32
+                                ),
33
+                                'may_terminate' => true 
34
+                        ) 
35
+                ) 
36
+        ),
37
+        'view_manager' => array( 
38
+                'template_path_stack' => array( 
39
+                        'HtpasswdManager' => __DIR__ . '/../view' 
40
+                ) 
41
+        ),
42
+        'HtpasswdManager' => array( 
43
+                // Carefull! File needs to be writeable by apache-user (www-data)
44
+                // The .htaccess file needs to be set to use this .htpasswd file for authentication
45
+                'htpasswd' => 'path/to/.htpasswd',
46 46
 				
47
-				// Users, that can't be deleted with the GUI
48
-				'not_deletable_users' => array( 
49
-						'admin' 
50
-				),
47
+                // Users, that can't be deleted with the GUI
48
+                'not_deletable_users' => array( 
49
+                        'admin' 
50
+                ),
51 51
 				
52
-				// May be an array (for specific users) or boolean for general true / false
53
-				'usermanagement_users' => true 
54
-		) 
52
+                // May be an array (for specific users) or boolean for general true / false
53
+                'usermanagement_users' => true 
54
+        ) 
55 55
 );
Please login to merge, or discard this patch.
Module.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,46 +16,46 @@
 block discarded – undo
16 16
 
17 17
 class Module implements AutoloaderProviderInterface {
18 18
 
19
-	public function getAutoloaderConfig() {
20
-		return array( 
21
-				'Zend\Loader\StandardAutoloader' => array( 
22
-						'namespaces' => array( 
23
-								// if we're in a namespace deeper than one level we need to fix the \ in the path
24
-								__NAMESPACE__ => __DIR__ . '/src/' . str_replace ( '\\', '/', __NAMESPACE__ ) 
25
-						) 
26
-				) 
27
-		);
28
-	}
29
-
30
-	public function getConfig() {
31
-		return include __DIR__ . '/config/module.config.php';
32
-	}
33
-
34
-	public function onBootstrap(MvcEvent $e) {
35
-		// You may not need to do this if you're doing it elsewhere in your
36
-		// application
37
-		$eventManager = $e->getApplication ()->getEventManager ();
38
-		$moduleRouteListener = new ModuleRouteListener ();
39
-		$moduleRouteListener->attach ( $eventManager );
40
-	}
41
-
42
-	public function getServiceConfig() {
43
-		return array( 
44
-				'factories' => array( 
45
-						'HtpasswdManager\Service\HtpasswdService' => function ($sm) {
46
-							$config = $sm->get ( 'Config' );
19
+    public function getAutoloaderConfig() {
20
+        return array( 
21
+                'Zend\Loader\StandardAutoloader' => array( 
22
+                        'namespaces' => array( 
23
+                                // if we're in a namespace deeper than one level we need to fix the \ in the path
24
+                                __NAMESPACE__ => __DIR__ . '/src/' . str_replace ( '\\', '/', __NAMESPACE__ ) 
25
+                        ) 
26
+                ) 
27
+        );
28
+    }
29
+
30
+    public function getConfig() {
31
+        return include __DIR__ . '/config/module.config.php';
32
+    }
33
+
34
+    public function onBootstrap(MvcEvent $e) {
35
+        // You may not need to do this if you're doing it elsewhere in your
36
+        // application
37
+        $eventManager = $e->getApplication ()->getEventManager ();
38
+        $moduleRouteListener = new ModuleRouteListener ();
39
+        $moduleRouteListener->attach ( $eventManager );
40
+    }
41
+
42
+    public function getServiceConfig() {
43
+        return array( 
44
+                'factories' => array( 
45
+                        'HtpasswdManager\Service\HtpasswdService' => function ($sm) {
46
+                            $config = $sm->get ( 'Config' );
47 47
 							
48
-							if (! isset ( $config ['HtpasswdManager'] ) || ! is_array ( $config ['HtpasswdManager'] ) || ! isset ( $config ['HtpasswdManager'] ['htpasswd'] ) || empty ( $config ['HtpasswdManager'] ['htpasswd'] )) {
49
-								throw new \Exception ( 'HtpasswdManager Config not found' );
50
-							}
48
+                            if (! isset ( $config ['HtpasswdManager'] ) || ! is_array ( $config ['HtpasswdManager'] ) || ! isset ( $config ['HtpasswdManager'] ['htpasswd'] ) || empty ( $config ['HtpasswdManager'] ['htpasswd'] )) {
49
+                                throw new \Exception ( 'HtpasswdManager Config not found' );
50
+                            }
51 51
 							
52
-							$htpasswd_filename = $config ['HtpasswdManager'] ['htpasswd'];
53
-							$service = new HtpasswdService ( $htpasswd_filename );
52
+                            $htpasswd_filename = $config ['HtpasswdManager'] ['htpasswd'];
53
+                            $service = new HtpasswdService ( $htpasswd_filename );
54 54
 							
55
-							return $service;
56
-						} 
57
-				) 
58
-		);
59
-	}
55
+                            return $service;
56
+                        } 
57
+                ) 
58
+        );
59
+    }
60 60
 
61 61
 }
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 				'Zend\Loader\StandardAutoloader' => array( 
22 22
 						'namespaces' => array( 
23 23
 								// if we're in a namespace deeper than one level we need to fix the \ in the path
24
-								__NAMESPACE__ => __DIR__ . '/src/' . str_replace ( '\\', '/', __NAMESPACE__ ) 
24
+								__NAMESPACE__ => __DIR__ . '/src/' . str_replace('\\', '/', __NAMESPACE__) 
25 25
 						) 
26 26
 				) 
27 27
 		);
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 	public function onBootstrap(MvcEvent $e) {
35 35
 		// You may not need to do this if you're doing it elsewhere in your
36 36
 		// application
37
-		$eventManager = $e->getApplication ()->getEventManager ();
38
-		$moduleRouteListener = new ModuleRouteListener ();
39
-		$moduleRouteListener->attach ( $eventManager );
37
+		$eventManager = $e->getApplication()->getEventManager();
38
+		$moduleRouteListener = new ModuleRouteListener();
39
+		$moduleRouteListener->attach($eventManager);
40 40
 	}
41 41
 
42 42
 	public function getServiceConfig() {
43 43
 		return array( 
44 44
 				'factories' => array( 
45
-						'HtpasswdManager\Service\HtpasswdService' => function ($sm) {
46
-							$config = $sm->get ( 'Config' );
45
+						'HtpasswdManager\Service\HtpasswdService' => function($sm) {
46
+							$config = $sm->get('Config');
47 47
 							
48
-							if (! isset ( $config ['HtpasswdManager'] ) || ! is_array ( $config ['HtpasswdManager'] ) || ! isset ( $config ['HtpasswdManager'] ['htpasswd'] ) || empty ( $config ['HtpasswdManager'] ['htpasswd'] )) {
49
-								throw new \Exception ( 'HtpasswdManager Config not found' );
48
+							if (!isset ($config ['HtpasswdManager']) || !is_array($config ['HtpasswdManager']) || !isset ($config ['HtpasswdManager'] ['htpasswd']) || empty ($config ['HtpasswdManager'] ['htpasswd'])) {
49
+								throw new \Exception('HtpasswdManager Config not found');
50 50
 							}
51 51
 							
52 52
 							$htpasswd_filename = $config ['HtpasswdManager'] ['htpasswd'];
53
-							$service = new HtpasswdService ( $htpasswd_filename );
53
+							$service = new HtpasswdService($htpasswd_filename);
54 54
 							
55 55
 							return $service;
56 56
 						} 
Please login to merge, or discard this patch.
src/HtpasswdManager/Test/HtpasswdServiceTest.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
         $userList = $service->getUserList();
59 59
         $this->assertEquals(
60 60
             $expected = [ 'steven' => '$apr1$UF1l/6iv$tT3IJUH.QL82HAraXetNo0',
61
-                          'blub'   => '$apr1$jVosh5nC$q6KJ5EZNU6thOPETMQw8O/'
61
+                            'blub'   => '$apr1$jVosh5nC$q6KJ5EZNU6thOPETMQw8O/'
62 62
             ], $userList, "UserList");
63 63
     }
64 64
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $service = new HtpasswdService($testFile);
44 44
 
45 45
         $userList = $service->getUserList();
46
-        $this->assertEquals($expected = [ ], $userList, "UserList");
46
+        $this->assertEquals($expected = [], $userList, "UserList");
47 47
 
48 48
         // Cleanup
49 49
         unlink($testFile);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $userList = $service->getUserList();
59 59
         $this->assertEquals(
60
-            $expected = [ 'steven' => '$apr1$UF1l/6iv$tT3IJUH.QL82HAraXetNo0',
60
+            $expected = ['steven' => '$apr1$UF1l/6iv$tT3IJUH.QL82HAraXetNo0',
61 61
                           'blub'   => '$apr1$jVosh5nC$q6KJ5EZNU6thOPETMQw8O/'
62 62
             ], $userList, "UserList");
63 63
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
         $userList = $service->getUserList();
87 87
         $this->assertCount(3, $userList);
88
-        $this->assertEquals($expected = [ 'steven', 'blub', 'test' ],
88
+        $this->assertEquals($expected = ['steven', 'blub', 'test'],
89 89
             array_keys($userList));
90 90
         $this->assertEquals(3, $this->getNumberOfLines($testFile), "Number of Lines");
91 91
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $service->deleteUser('steven');
118 118
         $userList = $service->getUserList();
119 119
         $this->assertCount(1, $userList);
120
-        $this->assertEquals($expected = [ 'blub' ],
120
+        $this->assertEquals($expected = ['blub'],
121 121
             array_keys($userList));
122 122
         $this->assertEquals(1, $this->getNumberOfLines($testFile), "Number of Lines");
123 123
 
Please login to merge, or discard this patch.
src/HtpasswdManager/Service/Factory/UserServiceFactory.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 block discarded – undo
6 6
 
7 7
 class UserServiceFactory {
8 8
 
9
-	public function __invoke($sm) {
10
-		$config = $sm->get ( 'Config' );
9
+    public function __invoke($sm) {
10
+        $config = $sm->get ( 'Config' );
11 11
 		
12
-		// Default
13
-		$not_deletable_users = array();
14
-		if (isset ( $config ['HtpasswdManager'] ['not_deletable_users'] ) && is_array ( $config ['HtpasswdManager'] ['not_deletable_users'] )) {
15
-			$not_deletable_users = $config ['HtpasswdManager'] ['not_deletable_users'];
16
-		}
12
+        // Default
13
+        $not_deletable_users = array();
14
+        if (isset ( $config ['HtpasswdManager'] ['not_deletable_users'] ) && is_array ( $config ['HtpasswdManager'] ['not_deletable_users'] )) {
15
+            $not_deletable_users = $config ['HtpasswdManager'] ['not_deletable_users'];
16
+        }
17 17
 		
18
-		// Default
19
-		$user_with_management_permission = true;
20
-		if (isset ( $config ['HtpasswdManager'] ['usermanagement_users'] ) && is_array ( $config ['HtpasswdManager'] ['usermanagement_users'] )) {
21
-			$user_with_management_permission = $config ['HtpasswdManager'] ['usermanagement_users'];
22
-		} else if ($config ['HtpasswdManager'] ['usermanagement_users'] === false) {
23
-			$user_with_management_permission = false;
24
-		}
18
+        // Default
19
+        $user_with_management_permission = true;
20
+        if (isset ( $config ['HtpasswdManager'] ['usermanagement_users'] ) && is_array ( $config ['HtpasswdManager'] ['usermanagement_users'] )) {
21
+            $user_with_management_permission = $config ['HtpasswdManager'] ['usermanagement_users'];
22
+        } else if ($config ['HtpasswdManager'] ['usermanagement_users'] === false) {
23
+            $user_with_management_permission = false;
24
+        }
25 25
 		
26
-		$request = $sm->get ( 'Request' );
26
+        $request = $sm->get ( 'Request' );
27 27
 		
28
-		return new UserService ( $request, $not_deletable_users, $user_with_management_permission );
29
-	}
28
+        return new UserService ( $request, $not_deletable_users, $user_with_management_permission );
29
+    }
30 30
 
31 31
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@
 block discarded – undo
7 7
 class UserServiceFactory {
8 8
 
9 9
 	public function __invoke($sm) {
10
-		$config = $sm->get ( 'Config' );
10
+		$config = $sm->get('Config');
11 11
 		
12 12
 		// Default
13 13
 		$not_deletable_users = array();
14
-		if (isset ( $config ['HtpasswdManager'] ['not_deletable_users'] ) && is_array ( $config ['HtpasswdManager'] ['not_deletable_users'] )) {
14
+		if (isset ($config ['HtpasswdManager'] ['not_deletable_users']) && is_array($config ['HtpasswdManager'] ['not_deletable_users'])) {
15 15
 			$not_deletable_users = $config ['HtpasswdManager'] ['not_deletable_users'];
16 16
 		}
17 17
 		
18 18
 		// Default
19 19
 		$user_with_management_permission = true;
20
-		if (isset ( $config ['HtpasswdManager'] ['usermanagement_users'] ) && is_array ( $config ['HtpasswdManager'] ['usermanagement_users'] )) {
20
+		if (isset ($config ['HtpasswdManager'] ['usermanagement_users']) && is_array($config ['HtpasswdManager'] ['usermanagement_users'])) {
21 21
 			$user_with_management_permission = $config ['HtpasswdManager'] ['usermanagement_users'];
22 22
 		} else if ($config ['HtpasswdManager'] ['usermanagement_users'] === false) {
23 23
 			$user_with_management_permission = false;
24 24
 		}
25 25
 		
26
-		$request = $sm->get ( 'Request' );
26
+		$request = $sm->get('Request');
27 27
 		
28
-		return new UserService ( $request, $not_deletable_users, $user_with_management_permission );
28
+		return new UserService($request, $not_deletable_users, $user_with_management_permission);
29 29
 	}
30 30
 
31 31
 }
Please login to merge, or discard this patch.