original_string: protected function getNewRoleId($oldRoleId)
      {
          if (empty($oldRoleId)) {
              return null;
          }
  
          $roles = $this->package->getResourceFromZip('system/role.json');
          $roleName = null;
          foreach ($roles as $role) {
              if ($oldRoleId === $role['id']) {
                  $roleName = $role['name'];
                  break;
              }
          }
  
          if (!empty($roleName)) {
              $newRole = Role::whereName($roleName)->first(['id']);
              if (!empty($newRole)) {
                  return $newRole->id;
              }
          }
  
          return null;
      }
code: protected function getNewRoleId($oldRoleId)
      {
          if (empty($oldRoleId)) {
              return null;
          }
  
          $roles = $this->package->getResourceFromZip('system/role.json');
          $roleName = null;
          foreach ($roles as $role) {
              if ($oldRoleId === $role['id']) {
                  $roleName = $role['name'];
                  break;
              }
          }
  
          if (!empty($roleName)) {
              $newRole = Role::whereName($roleName)->first(['id']);
              if (!empty($newRole)) {
                  return $newRole->id;
              }
          }
  
          return null;
      }
code_tokens: protected function getNewRoleId ( $ oldRoleId ) { if ( empty ( $ oldRoleId ) ) { return null ; } $ roles = $ this -> package -> getResourceFromZip ( 'system/role.json' ) ; $ roleName = null ; foreach ( $ roles as $ role ) { if ( $ oldRoleId === $ role [ 'id' ] ) { $ roleName = $ role [ 'name' ] ; break ; } } if ( ! empty ( $ roleName ) ) { $ newRole = Role :: whereName ( $ roleName ) -> first ( [ 'id' ] ) ; if ( ! empty ( $ newRole ) ) { return $ newRole -> id ; } } return null ; }
docstring: Finds and returns the new role id by old id.
  
  @param int $oldRoleId
  
  @return int|null
docstring_tokens: Finds and returns the new role id by old id .