Transform the data into a new data instance.

@param \Illuminate\Http\Request $data
@param int                      $limit
@param int                      $time

@return \GrahamCampbell\Throttle\Data
180639
public function transform($data, int $limit = 10, int $time = 60)
    {
        return new Data((string) $data->getClientIp(), (string) $data->path(), (int) $limit, (int) $time);
    }
210972
public function limit($limit)
    {
        if (intval($limit) != $limit) {
            throw new \Exception('The limit must be an integer');
        }

        $this->limit = (int) $limit;

        return $this;
    }
157891
public function process(int $page, int $limit, array $filters = [], array $orders = []): Data
    {
        // process filters
        $this->applyFilters($filters);

        // process orders
        $this->applyOrders($orders);

        $data = $this->getSource();

        $total = \count($data);

        // process pages
        $data = \array_slice($data, $limit * ($page - 1), $limit);

        $gridData = new Data($data);
        $gridData->setTotal($total);
        return $gridData;
    }
233779
public function block($timeout, $callback = null)
    {
        $starting = time();

        $id = Str::random(20);

        while (! $slot = $this->acquire($id)) {
            if (time() - $timeout >= $starting) {
                throw new LimiterTimeoutException;
            }

            usleep(250 * 1000);
        }

        if (is_callable($callback)) {
            try {
                return tap($callback(), function () use ($slot, $id) {
                    $this->release($slot, $id);
                });
            } catch (Exception $exception) {
                $this->release($slot, $id);

                throw $exception;
            }
        }

        return true;
    }
770162
public function transform($data, int $limit = 10, int $time = 60)
    {
        if (($ip = array_get($data, 'ip')) && ($route = array_get($data, 'route'))) {
            return new Data((string) $ip, (string) $route, (int) $limit, (int) $time);
        }

        throw new InvalidArgumentException('The data array does not provide the required ip and route information.');
    }
795634
public function createOne($data)
    {
        // Event
        $this->triggerEvent(
            'onBefore' . ucfirst(__FUNCTION__),
            [
                'data' => &$data,
            ]
        );

        $dataset = $this->create($this->bindDataset([$data]));

        $result = $dataset[0];

        // Event
        $this->triggerEvent(
            'onAfter' . ucfirst(__FUNCTION__),
            [
                'result' => &$result,
            ]
        );

        return $result;
    }
1315973
public function getTopTraderEntityData($limit = 10)
    {
        $topTrader = $this->gameDataService->getTopJobCharacter(1);

        return $topTrader->setMaxResults($limit)
            ->getQuery()
            ->getResult();
    }
51834
function handleRatelimit(?int $limit, ?int $remaining, ?float $resetTime) {
        if($limit === null && $remaining === null && $resetTime === null) {
            $this->remaining++; // there is no ratelimit...
            return;
        }
        
        $this->limit = $limit ?? $this->limit;
        $this->remaining = $remaining ?? $this->remaining;
        $this->resetTime = $resetTime ?? $this->resetTime;
        
        if($this->remaining === 0 && $this->resetTime > \microtime(true)) {
            $this->api->client->emit('debug', 'Endpoint "'.$this->endpoint.'" ratelimit encountered, continueing in '.($this->resetTime - \microtime(true)).' seconds');
        }
    }
1362526
public function limit($limit, $offset = null)
    {
        $this->q['limit']['limit'] = $limit;

        if (isset($offset)) {
            $this->q['limit']['offset'] = $offset;
        }

        return $this;
    }
1371854
public function sendData($data)
    {
        $response = $this->gocardless->mandates()->create($data);

        return $this->response = new MandateResponse($this, $response);
    }
1193093
public function setLimit($limit)
    {
        if (is_array($limit)) {
            $spec = $limit;
            if (!isset($spec['name'])) {
                throw new \Exception("Cannot create Limit: Name missing from configuration.");
            }
            $name = $spec['name'];
            $limit = isset($spec['limit']) ? $spec['limit'] : null;
            $interval = isset($spec['interval']) ? $spec['interval'] : null;
            $actions = isset($spec['actions']) ? $spec['actions'] : array();
            
            $limit = new Limit($name, $limit, $interval);
            
            foreach ($actions as $action) {
                if (is_string($action)) {
                    $action = $this->getActionPlugins()->get($action);
                } elseif (is_array($action)) {
                    if (!isset($action['name'])) {
                        throw new \Exception('Cannot create Action: Name missing from configuration.');
                    }
                    $action = $this->getActionPlugins()->get($action['name'], $action);
                }
                
                if (!$action instanceof Action\ActionInterface) {
                    throw new \Exception("Action must be instance of Spork\Mvc\Listener\Limit\Action\ActionInterface");
                }
                
                $limit->addAction($action);
            }
        }
        
        if (!$limit instanceof Limit) {
            throw new \Exception("Limit must be instance of Spork\Mvc\Listener\Limit\Limit");
        }
        
        $this->limits[$limit->getName()] = $limit;
    }
349516
public function limit(int $limit)
    {
        $this->query = array_merge($this->query ?? [], ['limit' => $limit]);

        return $this;
    }
27564
public function getTimes($limit = 100, $offset = 0)
    {
        /** @var TimeFbApi $response */
        $response = $this->call(new Request('time.get', array(), $limit, $offset), 'DVelopment\FastBill\Model\TimeFbApi');

        return $response->getResponse()->getTimes();
    }
1289152
public function make($data)
    {
        if (is_object($data) && $data instanceof Request) {
            return new RequestTransformer();
        }

        if (is_array($data)) {
            return new ArrayTransformer();
        }

        throw new InvalidArgumentException('An array, or an instance of Illuminate\Http\Request was expected.');
    }
282048
public static function paginate($limit = 10, $sql = '', $binding = [])
    {
        $page = request('page', 1);
        if (!is_numeric($page)) {
            $page = 1;
        }

        $offset = ($page - 1) * $limit;
        $sql .= " limit $limit offset $offset";
        $items = static::findAll($sql, $binding);
        $total = static::countAll($sql, $binding);

        return new Paginator($items, $page, $limit, $total);
    }
303591
public function create($data)
    {
        $res = $this->request(self::PAYMENTS_PATH)->setRequestBody($data)->post();

        if ($res->isError()) {
            throw new RequestError($res->errorMessage, null, $res);
        }

        return new Payment($res->json);
    }
1224942
public function paginate(array $data, $page, $limit , $url, $params = array())
    {
        $pager = $this->makePagerFromArray($data, $page, $limit);

        return $this->factory->createCollectionFromPager($pager, $url, $params);
    }