Return the last not null event

@return string
187298
public function getLastEvent()
    {
        if (null === $this->{self::$sequence[0]}) {
            return self::$sequence[0];
        }

        foreach (self::$sequence as $i => $event) {
            if (null === $this->$event) {
                return self::$sequence[$i-1];
            }
        }

        return self::$sequence[count(self::$sequence)-1];
    }
424033
public function getLast()
    {
        if ($this->isEmpty()) {
            return null;
        }

        $this->seek(count($this->positions) - 1);

        return $this->current();
    }
749063
public function getLast()
    {
        try {
            $query = (new SelectQueryBuilder())->select([
                'max_value' => QueryExpression::max('id')
            ])->from(static::tableName());
            $sql = $query->parse($this->connection->getDialect())->getSQL();
            $data = $this->connection->prepare($sql)->execute()->fetch();
            return $data['max_value'];
        } catch (\PDOException $e) {
            return -1;
        }
    }
683375
public function last()
    {
        if ($this->isEmpty()) {
            return $this->makeItem(null);
        }

        $arResultIDList = $this->arElementIDList;

        $iElementID = array_pop($arResultIDList);

        return $this->makeItem($iElementID);
    }
775367
public function getLastLevel()
    {
        if ($this->lastLevel === null) {
            $this->lastLevel = $this->fusionValue('lastLevel');
            if ($this->lastLevel > self::MAXIMUM_LEVELS_LIMIT) {
                $this->lastLevel = self::MAXIMUM_LEVELS_LIMIT;
            }
        }

        return $this->lastLevel;
    }
876707
public function FirstLast()
    {
        if ($this->First() && $this->Last()) {
            return 'first last';
        }
        if ($this->First()) {
            return 'first';
        }
        if ($this->Last()) {
            return 'last';
        }
        return null;
    }
420928
private function getEventStartDate()
    {
        $currentDate = $this->Event()->getController()->CurrentDate();
        if ($currentDate && $currentDate->exists()) {
            $date = $currentDate->obj('StartDate')->Format('Y-m-d');
            $time = $currentDate->obj('StartTime')->Format('H:i:s');
            $dateTime = SS_Datetime::create();
            $dateTime->setValue("$date $time");
            return $dateTime;
        } else {
            return null;
        }
    }
333687
public function last()
    {
        $where = $this->where;

        $whereData = $this->where_data_binding;

        // We count all.
        $c = $this->count();

        $this->where = $where;

        $this->where_data_binding = $whereData;

        return $this->jump($c - 1)
            ->take(1)->first();
    }
1286474
public function getLastRow()
    {
        if($this->last_row == null) {
            $this->last_row = (int) $this->getActiveSheet()->getHighestRow();
        }

        return $this->last_row;
    }
1230348
public function getEvent() : ?string 
    {
        if ( ! $this->hasEvent()) {
            $this->setEvent($this->getDefaultEvent());
        }
        return $this->event;
    }
829368
public function lastHeartbeat()
    {
        $check = Cache::get($this->HEARTBEAT_WORKER_KEY);
        if (empty($check)) {
            return 'never';
        }

        return date(Library\Utils\Constants::COMMON_DATETIME.' T', $check);
    }
1321391
public function getLastErrorMessage()
    {
        $message = null;
        $error = $this->getConnection()->errorInfo();

        if (is_array($error) && isset($error[2])) {
            $message = $error[2];
        }

        return $message;
    }
224524
public function getLastMessage() {
		$count = count($this->_data);
		if (!$count) {
			return null;
		}
		return $this->_data[$count - 1];
	}
765154
private function getLastXMLErrorMessage()
    {
        $errorMessage = null;
        $error = libxml_get_last_error();

        if ($error !== false) {
            $errorMessage = trim($error->message);
        }

        return $errorMessage;
    }
379304
public function last()
    {
        $arr = $this->val();
        $last = end($arr);

        return StdObjectWrapper::returnStdObject($last);
    }
1333196
public function getLastReference()
    {
        return substr($this->data, $this->forkRate * $this->keyLength*3, $this->keyLength);
    }
313904
public function getEventObject()
    {
        if ($this->currentOverriddenEvent) {
            return $this->currentOverriddenEvent;
        }

        $event = clone $this->masterEvent;

        // Ignoring the following block, because PHPUnit's code coverage
        // ignores most of these lines, and this messes with our stats.
        //
        // @codeCoverageIgnoreStart
        unset(
            $event->RRULE,
            $event->EXDATE,
            $event->RDATE,
            $event->EXRULE,
            $event->{'RECURRENCE-ID'}
        );
        // @codeCoverageIgnoreEnd

        $event->DTSTART->setDateTime($this->getDtStart(), $event->DTSTART->isFloating());
        if (isset($event->DTEND)) {
            $event->DTEND->setDateTime($this->getDtEnd(), $event->DTEND->isFloating());
        }
        $recurid = clone $event->DTSTART;
        $recurid->name = 'RECURRENCE-ID';
        $event->add($recurid);

        return $event;
    }