Наследование: implements ArrayAccess, implements IteratorAggregate, implements Countable
Пример #1
0
 /**
  * Returns the connection currently associated to a given slot.
  *
  * @param int $slot Slot index.
  *
  * @throws \OutOfBoundsException
  *
  * @return NodeConnectionInterface
  */
 public function getConnectionBySlot($slot)
 {
     if (!SlotMap::isValid($slot)) {
         throw new \OutOfBoundsException("Invalid slot [{$slot}].");
     }
     if (isset($this->slots[$slot])) {
         return $this->slots[$slot];
     }
     $connectionID = $this->guessNode($slot);
     if (!($connection = $this->getConnectionById($connectionID))) {
         $connection = $this->createConnection($connectionID);
         $this->pool[$connectionID] = $connection;
     }
     return $this->slots[$slot] = $connection;
 }