original_string: public function listPermissionsForRole($role, $includeOrphans = true)
      {
          if ($this->permissionRoles === false) {
              $this->permissionRoles = [];
  
              foreach ($this->listPermissions() as $permission) {
                  if ($permission->roles) {
                      foreach ((array) $permission->roles as $_role) {
                          $this->permissionRoles[$_role][$permission->code] = 1;
                      }
                  }
                  else {
                      $this->permissionRoles['*'][$permission->code] = 1;
                  }
              }
          }
  
          $result = $this->permissionRoles[$role] ?? [];
  
          if ($includeOrphans) {
              $result += $this->permissionRoles['*'] ?? [];
          }
  
          return $result;
      }
code: public function listPermissionsForRole($role, $includeOrphans = true)
      {
          if ($this->permissionRoles === false) {
              $this->permissionRoles = [];
  
              foreach ($this->listPermissions() as $permission) {
                  if ($permission->roles) {
                      foreach ((array) $permission->roles as $_role) {
                          $this->permissionRoles[$_role][$permission->code] = 1;
                      }
                  }
                  else {
                      $this->permissionRoles['*'][$permission->code] = 1;
                  }
              }
          }
  
          $result = $this->permissionRoles[$role] ?? [];
  
          if ($includeOrphans) {
              $result += $this->permissionRoles['*'] ?? [];
          }
  
          return $result;
      }
code_tokens: public function listPermissionsForRole ( $ role , $ includeOrphans = true ) { if ( $ this -> permissionRoles === false ) { $ this -> permissionRoles = [ ] ; foreach ( $ this -> listPermissions ( ) as $ permission ) { if ( $ permission -> roles ) { foreach ( ( array ) $ permission -> roles as $ _role ) { $ this -> permissionRoles [ $ _role ] [ $ permission -> code ] = 1 ; } } else { $ this -> permissionRoles [ '*' ] [ $ permission -> code ] = 1 ; } } } $ result = $ this -> permissionRoles [ $ role ] ?? [ ] ; if ( $ includeOrphans ) { $ result += $ this -> permissionRoles [ '*' ] ?? [ ] ; } return $ result ; }
docstring: Returns an array of registered permissions belonging to a given role code
  @param string $role
  @param bool $includeOrphans
  @return array
docstring_tokens: Returns an array of registered permissions belonging to a given role code