private function buildRoleMap() {
		
		$this->mappedRoleNames = [];

		foreach ($this->hierarchy as $parent => $roles) {

			$roles = array_map('strtolower', $roles);
			$this->mappedRoleNames[$parent] = $roles;
			$additionalRoles = $roles;
			$foundParent = [];

			// check for every role, whether there are other roles below it

			while ($role = array_shift($additionalRoles)) {

				if (!isset($this->hierarchy[$role])) {
					
					// role has no further sub-roles defined

					continue;
				}
		
				$foundParent[] = $role;
		
				foreach ($this->hierarchy[$role] as $roleToAdd) {
					$this->mappedRoleNames[$parent][] = $roleToAdd;
				}

				foreach (array_diff($this->hierarchy[$role], $foundParent) as $roleToAdd) {

					$additionalRoles[] = $roleToAdd;

				}
			}
		
			$this->mappedRoleNames[$parent] = array_unique($this->mappedRoleNames[$parent]);

		}
		
	}
private function buildRoleMap() {
		
		$this->mappedRoleNames = [];

		foreach ($this->hierarchy as $parent => $roles) {

			$roles = array_map('strtolower', $roles);
			$this->mappedRoleNames[$parent] = $roles;
			$additionalRoles = $roles;
			$foundParent = [];

			// check for every role, whether there are other roles below it

			while ($role = array_shift($additionalRoles)) {

				if (!isset($this->hierarchy[$role])) {
					
					// role has no further sub-roles defined

					continue;
				}
		
				$foundParent[] = $role;
		
				foreach ($this->hierarchy[$role] as $roleToAdd) {
					$this->mappedRoleNames[$parent][] = $roleToAdd;
				}

				foreach (array_diff($this->hierarchy[$role], $foundParent) as $roleToAdd) {

					$additionalRoles[] = $roleToAdd;

				}
			}
		
			$this->mappedRoleNames[$parent] = array_unique($this->mappedRoleNames[$parent]);

		}
		
	}
private function buildRoleMap ( ) { $ this -> mappedRoleNames = [ ] ; foreach ( $ this -> hierarchy as $ parent => $ roles ) { $ roles = array_map ( 'strtolower' , $ roles ) ; $ this -> mappedRoleNames [ $ parent ] = $ roles ; $ additionalRoles = $ roles ; $ foundParent = [ ] ; // check for every role, whether there are other roles below it while ( $ role = array_shift ( $ additionalRoles ) ) { if ( ! isset ( $ this -> hierarchy [ $ role ] ) ) { // role has no further sub-roles defined continue ; } $ foundParent [ ] = $ role ; foreach ( $ this -> hierarchy [ $ role ] as $ roleToAdd ) { $ this -> mappedRoleNames [ $ parent ] [ ] = $ roleToAdd ; } foreach ( array_diff ( $ this -> hierarchy [ $ role ] , $ foundParent ) as $ roleToAdd ) { $ additionalRoles [ ] = $ roleToAdd ; } } $ this -> mappedRoleNames [ $ parent ] = array_unique ( $ this -> mappedRoleNames [ $ parent ] ) ; } }
build the map which maps all sub-roles on any level to any of their parent roles

@param array $hierarchy
build the map which maps all sub - roles on any level to any of their parent roles