1 | <?php |
||||||
2 | |||||||
3 | namespace OhDear\PhpSdk\Actions; |
||||||
4 | |||||||
5 | use OhDear\PhpSdk\Resources\CronCheck; |
||||||
6 | |||||||
7 | trait ManagesCronChecks |
||||||
8 | { |
||||||
9 | public function cronChecks(int $siteId) |
||||||
10 | { |
||||||
11 | return $this->transformCollection( |
||||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||||
12 | $this->get("sites/{$siteId}/cron-checks")['data'], |
||||||
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
![]() |
|||||||
13 | CronCheck::class |
||||||
14 | ); |
||||||
15 | } |
||||||
16 | |||||||
17 | public function createSimpleCronCheck( |
||||||
18 | int $siteId, |
||||||
19 | string $name, |
||||||
20 | int $frequencyInMinutes, |
||||||
21 | int $graceTimeInMinutes, |
||||||
22 | string $description |
||||||
23 | ): CronCheck { |
||||||
24 | $attributes = $this->post("sites/{$siteId}/cron-checks", [ |
||||||
0 ignored issues
–
show
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
![]() |
|||||||
25 | 'name' => $name, |
||||||
26 | 'type' => 'simple', |
||||||
27 | 'frequency_in_minutes' => $frequencyInMinutes, |
||||||
28 | 'grace_time_in_minutes' => $graceTimeInMinutes, |
||||||
29 | 'description' => $description, |
||||||
30 | ]); |
||||||
31 | |||||||
32 | return new CronCheck($attributes, $this); |
||||||
33 | } |
||||||
34 | |||||||
35 | public function createCronCheck( |
||||||
36 | int $siteId, |
||||||
37 | string $name, |
||||||
38 | string $cronExpression, |
||||||
39 | int $graceTimeInMinutes, |
||||||
40 | string $description, |
||||||
41 | string $serverTimezone |
||||||
42 | ): CronCheck { |
||||||
43 | $attributes = $this->post("sites/{$siteId}/cron-checks", [ |
||||||
44 | 'name' => $name, |
||||||
45 | 'type' => 'cron', |
||||||
46 | 'cron_expression' => $cronExpression, |
||||||
47 | 'grace_time_in_minutes' => $graceTimeInMinutes, |
||||||
48 | 'description' => $description, |
||||||
49 | 'server_timezone' => $serverTimezone, |
||||||
50 | ]); |
||||||
51 | |||||||
52 | return new CronCheck($attributes, $this); |
||||||
53 | } |
||||||
54 | |||||||
55 | public function updateCronCheck(int $cronCheckId, array $payload): CronCheck |
||||||
56 | { |
||||||
57 | $attributes = $this->put("cron-checks/{$cronCheckId}", $payload); |
||||||
0 ignored issues
–
show
It seems like
put() 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
![]() |
|||||||
58 | |||||||
59 | return new CronCheck($attributes, $this); |
||||||
60 | } |
||||||
61 | |||||||
62 | public function deleteCronCheck(int $cronCheckId): void |
||||||
63 | { |
||||||
64 | $this->delete("cron-checks/{$cronCheckId}"); |
||||||
0 ignored issues
–
show
The method
delete() does not exist on OhDear\PhpSdk\Actions\ManagesCronChecks . Did you maybe mean deleteCronCheck() ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
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. ![]() |
|||||||
65 | } |
||||||
66 | |||||||
67 | public function syncCronChecks(int $siteId, array $cronCheckAttributes): array |
||||||
68 | { |
||||||
69 | $response = $this->post("sites/{$siteId}/cron-checks/sync", ['cron_checks' => $cronCheckAttributes]); |
||||||
70 | |||||||
71 | return $this->transformCollection( |
||||||
72 | $response, |
||||||
73 | CronCheck::class, |
||||||
74 | ); |
||||||
75 | } |
||||||
76 | } |
||||||
77 |