Completed
Push — master ( e6cea0...5c122a )
by Marcin
01:53
created

View   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 38
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addContact() 0 6 1
A asTxt() 0 4 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
16
namespace mrcnpdlk\Grandstream\XMLApp\AddressBook;
17
18
19
use mrcnpdlk\Grandstream\XMLApp\AddressBook\Model\Contact;
20
use mrcnpdlk\Grandstream\XMLApp\AddressBook\Model\Phone;
21
22
class View
23
{
24
    /**
25
     * @var AddressBook
26
     */
27
    private $oAddressBook;
28
29
    /**
30
     * View constructor.
31
     */
32 1
    public function __construct()
33
    {
34 1
        $this->oAddressBook = new AddressBook();
35 1
    }
36
37
    /**
38
     * @param string      $lastName
39
     * @param string      $number
40
     * @param string|null $firstName
41
     * @param int         $iAccountId
42
     *
43
     * @return $this
44
     */
45 1
    public function addContact(string $lastName, string $number, string $firstName = null, int $iAccountId = 1)
0 ignored issues
show
Unused Code introduced by
The parameter $firstName is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
46
    {
47 1
        $this->oAddressBook->addContact(new Contact($lastName, new Phone($number, $iAccountId)));
48
49 1
        return $this;
50
    }
51
52
    /**
53
     * @return string
54
     */
55 1
    public function asTxt()
56
    {
57 1
        return $this->oAddressBook->getXml()->asText();
58
    }
59
}
60