Completed
Pull Request — master (#33)
by
unknown
05:05
created

Aps::create()   B

Complexity

Conditions 6
Paths 24

Size

Total Lines 39
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 39
rs 8.439
cc 6
eloc 20
nc 24
nop 4
1
<?php
2
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3
4
namespace PleskX\Api\Operator;
5
use PleskX\Api\Struct\Aps as Struct;
6
7
class Aps extends \PleskX\Api\Operator
8
{
9
10
    /**
11
     * @param array $properties
0 ignored issues
show
Bug introduced by
There is no parameter named $properties. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
12
     * @return Struct\Info
13
     */
14
    public function create(array $domaininfo,array $package,array $database,array $settings)
15
    {
16
        $packet = $this->_client->getPacket();
17
18
        $infoInstall = $packet->addChild($this->_wrapperTag)->addChild('install');
19
        
20
        foreach ($domaininfo as $name => $value) {
21
            $infoInstall->addChild($name, $value);
22
        }
23
        $infoPackage = $infoInstall->addChild('package');
24
        foreach($package as $name => $value)
25
        {
26
            $infoPackage->addChild($name,$value);
27
        }
28
        $infoInstall->addChild('ssl', true);
29
30
        $infoDatabase = $infoInstall->addChild('database');
31
        foreach($database as $name => $value)
32
        {
33
34
            $infoDatabase->addChild($name,$value);
35
        }
36
37
        $infoSettings = $infoInstall->addChild('settings');
38
        foreach($settings as $settings_array => $setting_array)
39
        {
40
            $infoSetting = $infoSettings->addChild('setting');
41
            foreach($setting_array as $name => $value)
42
            {
43
                $infoSetting->addChild($name,$value);
44
            }
45
        }      
46
47
        $response = $this->_client->request($packet);
48
49
        $info = new Struct\Info($response);
50
51
        return $info;
52
    }
53
54
    /**
55
     * @param string $field
56
     * @param integer|string $value
57
     * @return bool
58
     */
59
    public function delete($field, $value)
60
    {
61
        return $this->_delete($field, $value);
62
    }
63
64
    /**
65
     * @param string $field
66
     * @param integer|string $value
67
     * @return Struct\GeneralInfo
68
     */
69
    public function get($field, $value)
70
    {
71
        $items = $this->_getItems(Struct\GeneralInfo::class, 'install', $field, $value);
72
        return reset($items);
73
    }
74
75
    /**
76
     * @return Struct\GeneralInfo[]
77
     */
78
    public function getAll()
79
    {
80
        return $this->_getItems(Struct\GeneralInfo::class, 'aps');
81
    }
82
83
}
84