ManagesChecks   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 12
dl 0
loc 37
rs 10
c 2
b 0
f 1
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A enableCheck() 0 5 1
A snooze() 0 7 1
A disableCheck() 0 5 1
A unsnooze() 0 5 1
A requestRun() 0 5 1
1
<?php
2
3
namespace OhDear\PhpSdk\Actions;
4
5
use OhDear\PhpSdk\Resources\Check;
6
7
trait ManagesChecks
8
{
9
    public function enableCheck(int $checkId): Check
10
    {
11
        $checkAttributes = $this->post("checks/{$checkId}/enable");
0 ignored issues
show
Bug introduced by
It seems like post() 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

11
        /** @scrutinizer ignore-call */ 
12
        $checkAttributes = $this->post("checks/{$checkId}/enable");
Loading history...
12
13
        return new Check($checkAttributes, $this);
14
    }
15
16
    public function disableCheck(int $checkId): Check
17
    {
18
        $checkAttributes = $this->post("checks/{$checkId}/disable");
19
20
        return new Check($checkAttributes, $this);
21
    }
22
23
    public function requestRun(int $checkId): Check
24
    {
25
        $checkAttributes = $this->post("checks/{$checkId}/request-run");
26
27
        return new Check($checkAttributes, $this);
28
    }
29
30
    public function snooze(int $checkId, int $minutes)
31
    {
32
        $checkAttributes = $this->post("checks/{$checkId}/snooze", [
33
            'minutes' => $minutes,
34
        ]);
35
36
        return new Check($checkAttributes, $this);
37
    }
38
39
    public function unsnooze(int $checkId): Check
40
    {
41
        $checkAttributes = $this->post("checks/{$checkId}/unsnooze");
42
43
        return new Check($checkAttributes, $this);
44
    }
45
}
46