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

View::asTxt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 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