示例#1
0
 private function processImportanceQueue()
 {
     if ($this->queuedImportanceSkills->size() == 0) {
         return;
     }
     $skills = clone $this->queuedImportanceSkills;
     $this->queuedImportanceSkills->clear();
     foreach ($skills as $skill) {
         $this->calculateImportance($skill);
     }
     $this->processImportanceQueue();
 }
 public function testOrder()
 {
     $item1 = 'item 1';
     $item2 = 'item 2';
     $item3 = 'item 3';
     $items = [$item1, $item2, $item3];
     $queue = new Queue($items);
     $this->assertSame($item1, $queue->peek());
     $polls = [];
     $iters = [];
     foreach ($queue as $element) {
         $iters[] = $element;
     }
     while (($item = $queue->poll()) !== null) {
         $polls[] = $item;
     }
     $this->assertSame($iters, $polls);
     $queue->clear();
     $this->assertNull($queue->peek());
 }