Code Duplication    Length = 9-9 lines in 2 locations

packages/roles/src/Roles.php 1 location

@@ 56-64 (lines=9) @@
53
	 * @param \WP_User $user User object.
54
	 * @return string|boolean User's role, false if not enough capabilities for any of the roles.
55
	 */
56
	public function translate_user_to_role( $user ) {
57
		foreach ( $this->capability_translations as $role => $cap ) {
58
			if ( user_can( $user, $role ) || user_can( $user, $cap ) ) {
59
				return $role;
60
			}
61
		}
62
63
		return false;
64
	}
65
66
	/**
67
	 * Get the minimum capability for a role.

class.jetpack.php 1 location

@@ 4406-4414 (lines=9) @@
4403
		return false;
4404
	}
4405
4406
	static function translate_user_to_role( $user ) {
4407
		foreach ( self::$capability_translations as $role => $cap ) {
4408
			if ( user_can( $user, $role ) || user_can( $user, $cap ) ) {
4409
				return $role;
4410
			}
4411
		}
4412
4413
		return false;
4414
    }
4415
4416
	static function translate_role_to_cap( $role ) {
4417
		if ( ! isset( self::$capability_translations[$role] ) ) {