public function add($entry, $priority = self::DEFAULT_PRIORITY)
    {
        if (isset($this->entryClass) && !($entry instanceof $this->entryClass)) {
            throw new InvalidObjectClassException($this->entryClass, get_class($entry));
        }
        $this->entries[] = ['data' => $entry, 'priority' => $priority];
        $this->sorted = false;
        return $this;
    }
public function add($entry, $priority = self::DEFAULT_PRIORITY)
    {
        if (isset($this->entryClass) && !($entry instanceof $this->entryClass)) {
            throw new InvalidObjectClassException($this->entryClass, get_class($entry));
        }
        $this->entries[] = ['data' => $entry, 'priority' => $priority];
        $this->sorted = false;
        return $this;
    }
public function add ( $ entry , $ priority = self :: DEFAULT_PRIORITY ) { if ( isset ( $ this -> entryClass ) && ! ( $ entry instanceof $ this -> entryClass ) ) { throw new InvalidObjectClassException ( $ this -> entryClass , get_class ( $ entry ) ) ; } $ this -> entries [ ] = [ 'data' => $ entry , 'priority' => $ priority ] ; $ this -> sorted = false ; return $ this ; }
Add an entry to the list.
@param mixed $entry
@param int $priority
@return $this
@throws InvalidObjectClassException
Add an entry to the list .