Example #1
0
 private function slideForwards()
 {
     /** @var Block $next */
     if (count($this->forwardRecords) === 0) {
         $this->blockStream->next();
         if (!$this->blockStream->valid()) {
             return false;
         }
         $next = $this->blockStream->current();
         if ($this->queue->getOwner()->getConfig()->safeModeOn) {
             $zones = $this->queue->getOwner()->getMain()->getDataProvider()->getZones($next);
             foreach ($zones as $zone) {
                 if ($zone->getType() === Zone::TYPE_UNDER_CONSTRUCTION) {
                     $ok = true;
                     break;
                 }
             }
             if (!isset($ok)) {
                 $this->blocksOutOfBounds++;
                 return true;
             }
         }
     } else {
         $next = array_shift($this->forwardRecords);
     }
     $original = $next->getLevel()->getBlock($next);
     $next->getLevel()->setBlock($next, $next, false, false);
     array_unshift($this->behindRecords, $original);
     return true;
 }