Issues (34)

src/Actions/ManagesPerformance.php (3 issues)

Labels
Severity
1
<?php
2
3
namespace OhDear\PhpSdk\Actions;
4
5
use OhDear\PhpSdk\Resources\PerformanceRecord;
6
7
trait ManagesPerformance
8
{
9
    /**
10
     * @param int $siteId
11
     * @param string $start Short (2020-12-01) or long (2020-12-01 15:00:00) date format
12
     * @param string $end Short (2020-12-01) or long (2020-12-01 15:00:00) date format
13
     * @param string $timeframe Should be 1m or 1h
14
     *
15
     * @return array
16
     */
17
    public function performanceRecords(int $siteId, string $start, string $end, string $timeframe = '1m'): array
18
    {
19
        $start = $this->convertDateFormat($start);
0 ignored issues
show
It seems like convertDateFormat() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        /** @scrutinizer ignore-call */ 
20
        $start = $this->convertDateFormat($start);
Loading history...
20
        $end = $this->convertDateFormat($end);
21
22
        return $this->transformCollection(
0 ignored issues
show
It seems like transformCollection() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        return $this->/** @scrutinizer ignore-call */ transformCollection(
Loading history...
23
            $this->get("sites/$siteId/performance-records?filter[start]={$start}&filter[end]={$end}&filter[timeframe]={$timeframe}"),
0 ignored issues
show
It seems like get() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
            $this->/** @scrutinizer ignore-call */ 
24
                   get("sites/$siteId/performance-records?filter[start]={$start}&filter[end]={$end}&filter[timeframe]={$timeframe}"),
Loading history...
24
            PerformanceRecord::class
25
        );
26
    }
27
}
28