shift() public method

Shifts an item from the objects properties table
public shift ( ) : mixed
return mixed The first item from the objects properties table
Ejemplo n.º 1
0
 /**
  * Reads a line from console, if available. Returns null if not available
  *
  * @return string|null
  */
 public function getLine()
 {
     if ($this->buffer->count() !== 0) {
         return $this->buffer->shift();
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Reads a line from console, if available. Returns null if not available
  *
  * @return string|null
  */
 public function getLine()
 {
     if ($this->buffer->count() !== 0) {
         return $this->buffer->synchronized(function () {
             return $this->buffer->shift();
         });
     }
     return \null;
 }
Ejemplo n.º 3
0
 /**
  * @internal Only call from AsyncPool.php on the main thread
  *
  * @param Server $server
  */
 public function checkProgressUpdates(Server $server)
 {
     while ($this->progressUpdates->count() !== 0) {
         $progress = $this->progressUpdates->shift();
         $this->onProgressUpdate($server, unserialize($progress));
     }
 }
Ejemplo n.º 4
0
 public function testThreadedShift()
 {
     $threaded = new Threaded();
     $threaded[] = "something";
     $threaded[] = "else";
     $this->assertEquals("something", $threaded->shift());
     $this->assertEquals(1, count($threaded));
 }
Ejemplo n.º 5
0
 public function readThreadToMainPacket()
 {
     return $this->externalQueue->shift();
 }