Code Duplication    Length = 18-18 lines in 2 locations

src/Gauges/Request.php 2 locations

@@ 420-437 (lines=18) @@
417
     *
418
     * @return Response
419
     */
420
    public function topReferrers(string $id, $date = null, int $page = null) : Response
421
    {
422
        $params = array();
423
424
        if (isset($date)) {
425
            if (!$date instanceof \DateTime) {
426
                $date = new \DateTime($date);
427
            }
428
429
            $params['date'] = $date->format('Y-m-d');
430
        }
431
432
        if (isset($page)) {
433
            $params['page'] = (int) $page;
434
        }
435
436
        return $this->makeApiCall('GET', 'gauges/' . $id . '/referrers', $params);
437
    }
438
439
    /**
440
     * Traffic
@@ 525-542 (lines=18) @@
522
     *
523
     * @return Response
524
     */
525
    public function searchTerms(string $id, $date = null, int $page = null) : Response
526
    {
527
        $params = array();
528
529
        if (isset($date)) {
530
            if (!$date instanceof \DateTime) {
531
                $date = new \DateTime($date);
532
            }
533
534
            $params['date'] = $date->format('Y-m-d');
535
        }
536
537
        if (isset($page)) {
538
            $params['page'] = $page;
539
        }
540
541
        return $this->makeApiCall('GET', 'gauges/' . $id . '/terms', $params);
542
    }
543
544
    /**
545
     * Search Engines