Phone   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 31
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getXml() 0 9 1
1
<?php
2
/**
3
 * Grandstream-XMLApp
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author  Marcin Pudełek <[email protected]>
13
 */
14
15
namespace mrcnpdlk\Grandstream\XMLApp\AddressBook\Model;
16
17
use mrcnpdlk\Grandstream\XMLApp\AddressBook\ModelInterface;
18
use mrcnpdlk\Grandstream\XMLApp\MyXML;
19
20
/**
21
 * Class Phone
22
 *
23
 * @package mrcnpdlk\Grandstream\XMLApp\AddressBook\Model
24
 */
25
class Phone implements ModelInterface
26
{
27
    /**
28
     * @var string
29
     */
30
    private $phoneNumber;
31
    /**
32
     * @var integer
33
     */
34
    private $accountIndex;
35
36 2
    public function __construct(string $phoneNumber, int $accountIndex = 1)
37
    {
38 2
        $this->phoneNumber  = $phoneNumber;
39 2
        $this->accountIndex = $accountIndex;
40 2
    }
41
42
    /**
43
     * @return MyXML
44
     */
45 2
    public function getXml(): MyXML
46
    {
47 2
        $oXml = new MyXML('Phone');
48 2
        $oXml->asObject()->addChild('phonenumber', $this->phoneNumber);
49 2
        $oXml->asObject()->addChild('accountindex', $this->accountIndex);
50
51 2
        return $oXml;
52
53
    }
54
55
}
56