Get event from the queue.

@param integer $limit Max number of events to be retrieved.

@return array
190979
public function getEvents($limit = null)
    {
        $select = $this->getConnection()->select()->from($this->getMainTable());

        if ($limit !== null) {
            $select->limit($limit);
        }

        $eventData = $this->getConnection()->fetchAll($select);

        foreach ($eventData as &$currentEvent) {
            $currentEvent = array_merge($currentEvent, $this->jsonSerializer->unserialize($currentEvent['data']));
            unset($currentEvent['data']);
        }

        return $eventData;
    }
1083424
public function findAll($limit = 0, $offset = 0)
    {
        $limit = $this->getLimit($limit, $offset);
        $query = 'SELECT ' . $this->getFields(", ") . '
                  FROM ' . $this->tableName . '
                  ' . $limit . ' ;';
        $statement = $this->database->prepare($query);
        $statement->execute();
        return $this->buildAll($statement->fetchAll());
    }
634867
public function getItems($offset, $limit)
    {
        $query = $this->search->getQuery();
        $query->setFrom($offset);
        $query->setSize($limit);

        return $this->search->search()->getResults();
    }
904795
public function getJobs($limit = null)
    {
        $select = $this->getAdapter()->select();
        $select->from($this->jobTable)
               ->where("$this->jobStatusColumn = ?", JobInterface::STATUS_ACTIVE)
               ->order(array("$this->jobPriorityColumn DESC", "$this->jobDateLastRunColumn ASC"));
        
        if ($limit !== null) {
            $select->limit($limit);
        }
        
        $jobs = array();
        foreach ($select->query()->fetchAll() as $result) {
            $job = $this->createJobRowObject($result);
            $jobs[] = $job;
        }

        return $jobs;
    }
698211
public function take($limit): CollectionInterface
    {
        if ($limit >= 0) {
            return $this->takeFirst($limit);
        } else {
            return $this->takeLast(abs($limit));
        }
    }
298200
public function getPosts( $limit = 100 ) {

        return $this->parseGetPosts(
            $this->service->api( $this->getWallGetRequestUrl( $limit ), 'GET' ),
            'response',
            [
                'id',
                'text'
            ],
            [
                'service_id_author' => 'from_id',
                'service_id_post'   => 'id',
                'time_created'      => 'date',
                'content'           => 'text'
            ] );
    }
1288893
public function getItems($offset, $limit) {
		$this->select->limit($limit, $offset);
		
		return $this->datagate->fetchAll($this->select);
	}
392571
public function getEventLimit()
    {
        return [
            'contactClientId' => ($this->contactClient instanceof ContactClient) ? $this->contactClient->getId() : null,
            'limit'           => $this->limit,
            'start'           => (1 >= $this->page) ? 0 : ($this->page - 1) * $this->limit,
        ];
    }
396440
public function getUserAgents($limit = 0)
    {
        $counter   = 0;
        $allAgents = [];

        foreach ($this->collection as $source) {
            if ($limit && $counter >= $limit) {
                return;
            }

            foreach ($source->getUserAgents($limit) as $ua) {
                if ($limit && $counter >= $limit) {
                    return;
                }

                if (empty($ua)) {
                    continue;
                }

                if (array_key_exists($ua, $allAgents)) {
                    continue;
                }

                yield $ua;
                $allAgents[$ua] = 1;
                ++$counter;
            }
        }
    }
301480
public function listCampaigns($limit = null, $offset = null)
    {
        $data = array();
        if (!empty($limit)) {
            $data['limit'] = $limit;
        }
        if (!empty($offset)) {
            $data['offset'] = $offset;
        }
        $requestResult = $this->sendRequest('campaigns', 'GET', $data);

        return $this->handleResult($requestResult);
    }
680340
public function selectAll($limit = 0)
	{
		$stmt = $this->pdo->prepare(<<<EOT
SELECT 
	t1.*,
	t2.ProjectId AS "Project.ProjectId",
	t2.Name AS "Project.Name",
	t2.Description AS "Project.Description",
	t2.Created AS "Project.Created"   
FROM `$this->tableName` AS t1 
LEFT JOIN Projects AS t2 ON t1.ProjectId = t2.ProjectId 
ORDER BY t1.Started DESC ;
EOT
		);
		$res = $stmt->execute();

		if ($res === false) {
			return array();
		}

		$rows = $stmt->fetchAll();

		$ret = array();
		foreach ($rows as $row) {
			array_push($ret, $this->prepareEntity($row));
		}

		return $ret;
	}
416556
public function getChecks($limit = NULL, $offset = NULL) {
    $parameters = array();
    if (!empty($limit)) {
      $parameters['limit'] = $limit;
      if (!empty($offset)) {
        $parameters['offset'] = $offset;
      }
    }
    $data = $this->request('GET', 'checks', $parameters);
    return $data->checks;
  }
349263
public function getEvents()
    {
        $inotifyEvents = $this->readEvents();

        $inotifyEvents = is_array($inotifyEvents) ? $inotifyEvents : array();

        $last = end($inotifyEvents);
        if (IN_Q_OVERFLOW === $last['mask']) {
            throw new RuntimeException('Event queue overflowed. Either read events more frequently or increase the limit for queues. The limit can be changed in /proc/sys/fs/inotify/max_queued_events');
        }

        foreach ($inotifyEvents as $event) {
            foreach ($this->bag->get($event['wd']) as $watched) {
                $watched->setEvent($event['mask'], $event['name']);
            }
        }

        $events = array();

        foreach ($this->checkers as $meta) {
            $tracked = $meta['tracked'];
            $watched = $meta['checker'];
            foreach ($watched->getChangeset() as $change) {
                $events[] = new FilesystemEvent($tracked, $change['resource'], $change['event']);
            }
        }

        return $events;
    }
1217853
public function all($offset = 0, $limit = 15)
    {
        $results = array_slice($this->memory, $offset, $limit);

        foreach ($results as $key => $value) {
            $results[$key] = json_decode($value[self::SUMMARY_KEY]);
        }

        return $results;
    }
1283490
public function getUserAgents($limit = 0)
    {
        $counter = 0;

        foreach ($this->loadFromPath() as $line) {
            if ($limit && $counter >= $limit) {
                return;
            }

            yield $line;
            ++$counter;
        }
    }
396208
public function get($limit = null, $offset = null)
    {
        if (isset($limit)) {
            $this->limit($limit, $offset);
        }

        if (false !== ($result = $this->conn->query($this->builderCache))) {
            $result->setTotalRows($this->countAllResults(true));
        }

        $this->builderCache->reset();

        return $result;
    }
962674
protected function getListLogOrder(array $limit)
    {
        $conditions = array(
            'limit' => $limit,
            'order_id' => $this->data_order['order_id']
        );

        return (array) $this->order_history->getList($conditions);
    }