CronCheck   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 20
dl 0
loc 43
rs 10
c 2
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A delete() 0 3 1
A __construct() 0 3 1
A update() 0 11 1
1
<?php
2
3
namespace OhDear\PhpSdk\Resources;
4
5
class CronCheck extends ApiResource
6
{
7
    public int $id;
8
9
    public string $name;
10
11
    public string $uuid;
12
13
    public string $type;
14
15
    public int $checkId;
16
17
    public ?int $frequencyInMinutes;
18
19
    public string $pingUrl;
20
21
    public int $graceTimeInMinutes = 0;
22
23
    public ?string $cronExpression = '';
24
25
    public string $description = '';
26
27
    public function __construct(array $attributes, $ohDear = null)
28
    {
29
        parent::__construct($attributes, $ohDear);
30
    }
31
32
    public function delete(): void
33
    {
34
        $this->ohDear->deleteCronCheck($this->id);
0 ignored issues
show
Bug introduced by
The method deleteCronCheck() does not exist on null. ( Ignorable by Annotation )

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

34
        $this->ohDear->/** @scrutinizer ignore-call */ 
35
                       deleteCronCheck($this->id);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
    }
36
37
    public function update()
38
    {
39
        $attributes = [
40
            'name' => $this->name,
41
            'frequency_in_minutes' => $this->frequencyInMinutes,
42
            'cron_expression' => $this->cronExpression,
43
            'grace_time_in_minutes' => $this->graceTimeInMinutes,
44
            'description' => $this->description,
45
        ];
46
47
        $this->ohDear->updateCronCheck($this->id, $attributes);
48
    }
49
}
50