Completed
Push — master ( 791aba...50879e )
by Timur
01:32
created

BackupsManager::disable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Linode\Api\Backups;
4
5
use Linode\Api\Backups\Commands\CancelBackupsCommand;
6
use Linode\Api\Backups\Commands\EnableBackupsCommand;
7
use Linode\Api\Backups\Commands\ListBackupsCommand;
8
use Linode\Api\Backups\Commands\RestoreBackupCommand;
9
10
class BackupsManager
11
{
12
    /**
13
     * @return ListBackupsCommand
14
     */
15
    public function list()
16
    {
17
        return new ListBackupsCommand();
18
    }
19
20
    /**
21
     * @param int $targetServerId = null
22
     *
23
     * @return RestoreBackupCommand
24
     */
25
    public function restore(int $targetServerId = null)
26
    {
27
        $command = new RestoreBackupCommand();
28
29
        if (is_null($targetServerId)) {
30
            return $command;
31
        }
32
33
        return $command->targeting($targetServerId);
34
    }
35
36
    public function enable()
37
    {
38
        return new EnableBackupsCommand();
39
    }
40
41
    public function cancel()
42
    {
43
        return new CancelBackupsCommand();
44
    }
45
46
    public function disable()
47
    {
48
        return $this->cancel();
49
    }
50
}
51