original_string: public function getNextSiteId()
      {
          if ($this->done) {
              // we make sure we don't check again whether there are more sites to be archived as the list of
              // sharedSiteIds may have been reset by now.
              return null;
          }
  
          $self = $this;
  
          $this->currentSiteId = $this->runExclusive(function () use ($self) {
  
              $siteIds = $self->getAllSiteIdsToArchive();
  
              if (empty($siteIds)) {
                  // done... no sites left to be archived
                  return null;
              }
  
              if (count($siteIds) > $self->numWebsitesLeftToProcess) {
                  // done... the number of siteIds in SharedSiteIds is larger than it was initially... therefore it must have
                  // been reset at some point.
                  return null;
              }
  
              $self->numWebsitesLeftToProcess = count($siteIds);
  
              $nextSiteId = array_shift($siteIds);
              $self->setSiteIdsToArchive($siteIds);
  
              return $nextSiteId;
          });
  
          if (is_null($this->currentSiteId)) {
              $this->done = true;
              $this->numWebsitesLeftToProcess = 0;
          }
  
          return $this->currentSiteId;
      }
code: public function getNextSiteId()
      {
          if ($this->done) {
              // we make sure we don't check again whether there are more sites to be archived as the list of
              // sharedSiteIds may have been reset by now.
              return null;
          }
  
          $self = $this;
  
          $this->currentSiteId = $this->runExclusive(function () use ($self) {
  
              $siteIds = $self->getAllSiteIdsToArchive();
  
              if (empty($siteIds)) {
                  // done... no sites left to be archived
                  return null;
              }
  
              if (count($siteIds) > $self->numWebsitesLeftToProcess) {
                  // done... the number of siteIds in SharedSiteIds is larger than it was initially... therefore it must have
                  // been reset at some point.
                  return null;
              }
  
              $self->numWebsitesLeftToProcess = count($siteIds);
  
              $nextSiteId = array_shift($siteIds);
              $self->setSiteIdsToArchive($siteIds);
  
              return $nextSiteId;
          });
  
          if (is_null($this->currentSiteId)) {
              $this->done = true;
              $this->numWebsitesLeftToProcess = 0;
          }
  
          return $this->currentSiteId;
      }
code_tokens: public function getNextSiteId ( ) { if ( $ this -> done ) { // we make sure we don't check again whether there are more sites to be archived as the list of // sharedSiteIds may have been reset by now. return null ; } $ self = $ this ; $ this -> currentSiteId = $ this -> runExclusive ( function ( ) use ( $ self ) { $ siteIds = $ self -> getAllSiteIdsToArchive ( ) ; if ( empty ( $ siteIds ) ) { // done... no sites left to be archived return null ; } if ( count ( $ siteIds ) > $ self -> numWebsitesLeftToProcess ) { // done... the number of siteIds in SharedSiteIds is larger than it was initially... therefore it must have // been reset at some point. return null ; } $ self -> numWebsitesLeftToProcess = count ( $ siteIds ) ; $ nextSiteId = array_shift ( $ siteIds ) ; $ self -> setSiteIdsToArchive ( $ siteIds ) ; return $ nextSiteId ; } ) ; if ( is_null ( $ this -> currentSiteId ) ) { $ this -> done = true ; $ this -> numWebsitesLeftToProcess = 0 ; } return $ this -> currentSiteId ; }
docstring: Get the next site id that needs to be processed or null if all site ids where processed.
  
  @return int|null
docstring_tokens: Get the next site id that needs to be processed or null if all site ids where processed .