Code Duplication    Length = 13-14 lines in 5 locations

Services/Pagination.php 5 locations

@@ 256-269 (lines=14) @@
253
     * @return $this
254
     * @throws \Exception
255
     */
256
    public function setTotalCount($totalCount)
257
    {
258
        if (!is_numeric($totalCount)) {
259
            throw new \Exception(
260
                'The expected type of the '.Pagination::class
261
                .' items total count is a numeric.'.gettype($totalCount)
262
                .' given.'
263
            );
264
        }
265
266
        $this->totalCount = (int)$totalCount;
267
268
        return $this;
269
    }
270
271
    /**
272
     * Set route name.
@@ 279-291 (lines=13) @@
276
     * @return $this
277
     * @throws \Exception
278
     */
279
    public function setRoute($route)
280
    {
281
        if (!is_string($route)) {
282
            throw new \Exception(
283
                'The expected type of the '.Pagination::class
284
                .' route is a string. '.gettype($route).' given.'
285
            );
286
        }
287
288
        $this->route = $route;
289
290
        return $this;
291
    }
292
293
    /**
294
     * @param int $defaultPageSize
@@ 299-312 (lines=14) @@
296
     * @return $this
297
     * @throws \Exception
298
     */
299
    public function setDefaultPageSize($defaultPageSize)
300
    {
301
        if (!is_numeric($defaultPageSize)) {
302
            throw new \Exception(
303
                'The expected type of the '.Pagination::class
304
                .' default page size is a numeric.'.gettype($defaultPageSize)
305
                .' given.'
306
            );
307
        }
308
309
        $this->defaultPageSize = (int)$defaultPageSize;
310
311
        return $this;
312
    }
313
314
    /**
315
     * @param string $pageSizeParam
@@ 320-333 (lines=14) @@
317
     * @return $this
318
     * @throws \Exception
319
     */
320
    public function setPageSizeParam($pageSizeParam)
321
    {
322
        if (!is_string($pageSizeParam)) {
323
            throw new \Exception(
324
                'The expected type of the '.Pagination::class
325
                .' page size param name is a string. '.gettype($pageSizeParam)
326
                .' given.'
327
            );
328
        }
329
330
        $this->pageSizeParam = $pageSizeParam;
331
332
        return $this;
333
    }
334
335
    /**
336
     * @param string $pageParam
@@ 341-354 (lines=14) @@
338
     * @return $this
339
     * @throws \Exception
340
     */
341
    public function setPageParam($pageParam)
342
    {
343
        if (!is_string($pageParam)) {
344
            throw new \Exception(
345
                'The expected type of the '.Pagination::class
346
                .' page param name is a string. '.gettype($pageParam)
347
                .' given.'
348
            );
349
        }
350
351
        $this->pageParam = $pageParam;
352
353
        return $this;
354
    }
355
}