original_string: private function _expandRole(&$roleList, $roleName, $depth = 0)
      {
          $role = $roleList[$roleName];
  
          if (isset($role['marked']) && $role['marked']) {
              return;
          }
  
          // possible circular reference!
          if ($depth > 5) {
              throw new \Exception("Possible circular reference detected while expanding role '{$roleName}'");
          }
  
          if (!empty($role['grl_parents'])) {
              $parents = $this->translateToRoleNames($role['grl_parents']);
  
              foreach ($parents as $parent) {
                  $this->_expandRole($roleList, $parent, $depth + 1);
              }
          } else {
              $parents = array();
          }
  
          $this->_acl->addRole(new \Zend_Acl_Role($role['grl_name']), $parents);
  
          $privileges = array_filter(array_map('trim', explode(",", $role['grl_privileges'])));
          if ($privileges) {
              $this->_acl->addPrivilege($role['grl_name'], $privileges);
          }
  
          $roleList[$roleName]['marked'] = true;
      }
code: private function _expandRole(&$roleList, $roleName, $depth = 0)
      {
          $role = $roleList[$roleName];
  
          if (isset($role['marked']) && $role['marked']) {
              return;
          }
  
          // possible circular reference!
          if ($depth > 5) {
              throw new \Exception("Possible circular reference detected while expanding role '{$roleName}'");
          }
  
          if (!empty($role['grl_parents'])) {
              $parents = $this->translateToRoleNames($role['grl_parents']);
  
              foreach ($parents as $parent) {
                  $this->_expandRole($roleList, $parent, $depth + 1);
              }
          } else {
              $parents = array();
          }
  
          $this->_acl->addRole(new \Zend_Acl_Role($role['grl_name']), $parents);
  
          $privileges = array_filter(array_map('trim', explode(",", $role['grl_privileges'])));
          if ($privileges) {
              $this->_acl->addPrivilege($role['grl_name'], $privileges);
          }
  
          $roleList[$roleName]['marked'] = true;
      }
code_tokens: private function _expandRole ( & $ roleList , $ roleName , $ depth = 0 ) { $ role = $ roleList [ $ roleName ] ; if ( isset ( $ role [ 'marked' ] ) && $ role [ 'marked' ] ) { return ; } // possible circular reference! if ( $ depth > 5 ) { throw new \ Exception ( "Possible circular reference detected while expanding role '{$roleName}'" ) ; } if ( ! empty ( $ role [ 'grl_parents' ] ) ) { $ parents = $ this -> translateToRoleNames ( $ role [ 'grl_parents' ] ) ; foreach ( $ parents as $ parent ) { $ this -> _expandRole ( $ roleList , $ parent , $ depth + 1 ) ; } } else { $ parents = array ( ) ; } $ this -> _acl -> addRole ( new \ Zend_Acl_Role ( $ role [ 'grl_name' ] ) , $ parents ) ; $ privileges = array_filter ( array_map ( 'trim' , explode ( "," , $ role [ 'grl_privileges' ] ) ) ) ; if ( $ privileges ) { $ this -> _acl -> addPrivilege ( $ role [ 'grl_name' ] , $ privileges ) ; } $ roleList [ $ roleName ] [ 'marked' ] = true ; }
docstring: Recursively expands roles into \Zend_Acl_Role objects
  
  @param array  $roleList
  @param string $roleName
docstring_tokens: Recursively expands roles into \ Zend_Acl_Role objects