wp/wp-includes/class-wp-role.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-role.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-role.php	Mon Oct 14 18:28:13 2019 +0200
@@ -41,7 +41,7 @@
 	 * @param array $capabilities List of capabilities.
 	 */
 	public function __construct( $role, $capabilities ) {
-		$this->name = $role;
+		$this->name         = $role;
 		$this->capabilities = $capabilities;
 	}
 
@@ -54,7 +54,7 @@
 	 * @param bool $grant Whether role has capability privilege.
 	 */
 	public function add_cap( $cap, $grant = true ) {
-		$this->capabilities[$cap] = $grant;
+		$this->capabilities[ $cap ] = $grant;
 		wp_roles()->add_cap( $this->name, $cap, $grant );
 	}
 
@@ -71,7 +71,7 @@
 	 * @param string $cap Capability name.
 	 */
 	public function remove_cap( $cap ) {
-		unset( $this->capabilities[$cap] );
+		unset( $this->capabilities[ $cap ] );
 		wp_roles()->remove_cap( $this->name, $cap );
 	}
 
@@ -94,16 +94,17 @@
 		 *
 		 * @since 2.0.0
 		 *
-		 * @param array  $capabilities Array of role capabilities.
+		 * @param bool[] $capabilities Associative array of capabilities for the role.
 		 * @param string $cap          Capability name.
 		 * @param string $name         Role name.
 		 */
 		$capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
 
-		if ( !empty( $capabilities[$cap] ) )
-			return $capabilities[$cap];
-		else
+		if ( ! empty( $capabilities[ $cap ] ) ) {
+			return $capabilities[ $cap ];
+		} else {
 			return false;
+		}
 	}
 
 }