Host::addHost()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * This file is part of the php-epp2 library.
5
 *
6
 * (c) Gunter Grodotzki <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE file
9
 * that was distributed with this source code.
10
 */
11
12
namespace AfriCC\EPP\Frame\Command\Check;
13
14
use AfriCC\EPP\Frame\Command\Check as CheckCommand;
15
use AfriCC\EPP\Validator;
16
use Exception;
17
18
/**
19
 * @see http://tools.ietf.org/html/rfc5732#section-3.1.1
20
 */
21
class Host extends CheckCommand
22
{
23
    public function addHost($host)
24
    {
25
        if (!Validator::isHostname($host)) {
26
            throw new Exception(sprintf('%s is not a valid host', $host));
27
        }
28
        $this->set('host:name[]', $host);
29
    }
30
}
31