Returns the first element in the collection.

@return mixed
555105
public function first()
    {
        if (!$this->isCollection()) {
            return $this;
        }

        return isset($this->data[0]) ? $this->box($this->data[0]) : null;
    }
88032
public function first()
    {
        $this->throwExceptionIfEmpty();

        $keys = $this->keys();
        $keyOfTheFirstElement = $keys->shift();
        return $this->offsetGet($keyOfTheFirstElement);
    }
165111
public function first()
    {
        $this->executeBeforeCallback();

        return count($this->items) > 0 ? reset($this->items) : null;
    }
588465
public function getFirstCategoryPur()
    {
        $firstOrderId = $this->model->getFirstOrderId();
        $order = $this->orderFactory->create();
        $this->orderResource->load($order, $firstOrderId);
        $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems());

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

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

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

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

            return $key;
        }

        return null;
    }
157302
public function first()
    {
        // Perform query
        $result = $this->get();

        // Abort if no models where found
        if (!$result || !is_array($result) || empty($result)) {
            return false;
        }

        // Return the first matching model
        return reset($result);
    }
655188
final public function current()
    {
        if ($this->position === -1) {
            $this->next();
        }

        Util::ensure(
            true,
            array_key_exists($this->position, $this->results),
            '\OutOfBoundsException',
            ['Collection contains no element at current position']
        );

        return call_user_func_array($this->loader, [$this->results[$this->position]]);
    }
205817
public function getPrev()
    {
        return self::find()->where(['<', 'id', $this->id])->orderBy(['id' => SORT_DESC])->limit(1)->one();
    }
816111
public function getFirst()
    {
        if (0 === count($this->data)) {
            return null;
        }
        reset($this->data);

        return current($this->data);
    }
1174900
public function getFirstChild()
	{
		$xpathStr = self::XPATH_THIS . '*[1]';
		$results = $this->xpath($xpathStr);
		if (count($results) >= 1) {
			return $results[0];
		}
		return null;
	}
1007063
public function getFirst()
    {
        $this->internalDataListUpdate();
        if (isset($this->internalDataListData[0])) {
            return $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, 0);
        }
        return null;
    }
772054
public function getFirst()
    {
        $first = null;

        if (count($this->renderers) > 0) {
            $first = reset($this->renderers);
        }

        return $first;
    }
942795
public function first()
	{
		$result = $this->fetchFirst(PDO::FETCH_ASSOC);

		if($result !== false)
		{
			return $this->hydrateModelsAndLoadIncludes([$result])[0];
		}

		return false;
	}
974691
public function first()
    {
        $result = $this->limit(1)->get();

        return ($result !== null && \count($result) !== 0) ? $result[0] : null;
    }
339190
public function first()
	{
		//get the limit clause value
		$limit = $this->limits;

		//get the offset value
		$limitOffset = $this->offset;

		//set the limit to 1
		$this->limit(1);

		//get all
		$all = $this->all();

		//get the first
		$first = ArrayUtility::first($all->result_array())->get();

		//if limit is defined
		if ( $limit ) 
		{
			//set the limit property
			$this->limits = $limit;

		}

		//if limit offset is set
		if ( $limitOffset ) 
		{
			//set the offset
			$this->offset = $limitOffset;

		}

		//get the response object instance
		$this->responseObject
			->setResultArray($first);

		//return the full response object
		return $this->responseObject;

	}
234237
public function getFirst()
    {
        if (count($this->children)) {
            reset($this->children);
            return current($this->children);
        } else {
            return null;
        }
    }