Removes and returns the object at the beginning of the queue.
@return mixed the item at the beginning of the queue
@throws \yii\base\Exception if the queue is empty
3468
public function dequeue () {
        if ($this->_c === 0)
            throw new Exception(\Yii::t ('yii' , 'The queue is empty.'));
        else {
            --$this->_c;
            return array_shift ($this->_d);
        }
    }
29822
public function reset()
    {
        $ret = $this->unload();
        $this->_table = array();
        $this->conditions = array();
        $this->order = array();
        $this->limit = array();

        return $ret;
    }
1366960
public function deleteDeferred()
    {
        try {
            if ($this->getRequestMethod() !== \Request::HTTP_DELETE) {
                throw new \common_exception_NotImplemented('Only delete method is accepted to deleting delivery');
            }

            if (!$this->hasRequestParameter('uri')) {
                throw new \common_exception_MissingParameter('uri', $this->getRequestURI());
            }

            $uri = $this->getRequestParameter('uri');
            $delivery  = $this->getResource($uri);

            if (!$delivery->exists()) {
                $this->returnFailure(new \common_exception_NotFound('Delivery has not been found'));
            }

            /** @var QueueDispatcher $queueDispatcher */
            $queueDispatcher = $this->getServiceManager()->get(QueueDispatcher::SERVICE_ID);

            $task = new DeliveryDeleteTask();
            $task->setServiceLocator($this->getServiceLocator());
            $taskParameters = ['deliveryId' => $uri];

            $task = $queueDispatcher->createTask($task, $taskParameters, __('Deleting of "%s"', $delivery->getLabel()), null, true);

            $data = $this->getTaskLogReturnData(
                $task->getId(),
                DeliveryDeleteTask::class
            );
            $this->returnSuccess($data);
        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
1094877
public function self()
    {
        $result = $this->itemIterator ? $this->itemIterator->current() : $this->item;
        $this->resetLocalScope();

        return $result;
    }
1192818
protected function first()
    {
        foreach ($this->sortable as $key => $value) {
            if (is_numeric($key)) {
                return $value;
            }

            return $key;
        }

        return null;
    }
937618
public function remove()
    {

        $removed = 0;
        foreach( func_get_args() as $arg ){

            // is this a container?
            if( $arg instanceof Container ) {

                $originalCount = $this->count();
                $this->collection = array_diff_key( $this->collection, $arg->collection );
                $removed += ( $originalCount - $this->count() );

            } else {

                // use array search
                $search = $this->search( $arg, true );

                foreach( $search as $value ){
                    if( $value !== false ){
                        $removed++;
                        $this->offsetUnset( $value );
                    }
                }

            }

        }
        $this->rewind();
        return $removed;

    }
425571
public function getObject()
    {
        if ($this->thawedObject === null) {
            $this->thawedObject = $this->storage->fetch($this->id);
        }

        return $this->thawedObject;
    }
1182691
public function takeFirst()
    {
        if (count($this->list) <= 0) {
            return null;
        }

        $value = $this->list[0];

        unset($this->list[0]);

        return $value;
    }
1114960
public function first() {
		$this->limit(1);
		$result = $this->find();
		return empty($result) ? null : $result[0];
	}
438810
public function first()
    {
        $this->sort();

        return !empty($this->items) ? reset($this->items) : null;
    }
588466
public function removeFirst(): self
    {
        $tmpArray = $this->getArray();

        \array_shift($tmpArray);

        return static::create(
            $tmpArray,
            $this->iteratorClass,
            false
        );
    }
593920
public function first()
    {
        try {
            $row = $this->baseQuery->first();

            if ($row === null) {
                return $row;
            } else {
                return $this->processFetchedRow($row);
            }
        } catch (\Throwable $exception) {
            return $this->handleException($exception);
        }
    }
1171873
public function get()
    {
        $rpc = null;
        if ($this->count > 0) {
            $rpc = $this->items[$this->index];
            if (++$this->index > $this->count - 1) {
                $this->index = 0;
            }
        }

        return $rpc;
    }
1076728
public function remove()
    {
        if ($this->count() === 0) {
            throw new NoSuchElementException('Can\'t return element from Queue. Queue is empty.');
        }

        $head = $this[$this->index];

        unset($this[$this->index]);
        $this->index++;

        return $head;
    }
495208
public function one()
    {
        if ($this->exception !== null) {
            throw $this->exception;
        }

        return $this->fetch(false, $this->fetchAssoc);
    }
875818
public function first()
    {
        $oldLimit = $this->limit;
        $this->limit = 1;
        $rows = $this->get();
        $this->limit = $oldLimit;
        return isset($rows[0]) ? $rows[0] : null;
    }
873496
public function get()
	{
		// if at least an item is available in the pool
		if ( count($this->_poolItems) )
			$item = array_pop($this->_poolItems);
		
		// otherwise, we create a new instance
		else
			$item = call_user_func_array($this->_factorymethod, $this->_factorymethodparams);

		// now in use
		$this->_inUseItems[] = $item;
		
		// initialize item
		if ( $this->_initmethod )
			$item->{$this->_initmethod}();
			
		return $item;
	}