Host::setHost()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
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\Info;
13
14
use AfriCC\EPP\Frame\Command\Info as InfoCommand;
15
use AfriCC\EPP\Validator;
16
use Exception;
17
18
/**
19
 * @see http://tools.ietf.org/html/rfc5732#section-3.1.2
20
 */
21
class Host extends InfoCommand
22
{
23
    public function setHost($host)
24
    {
25
        if (!Validator::isHostname($host)) {
26
            throw new Exception(sprintf('%s is not a valid host name', $host));
27
        }
28
29
        $this->set('host:name', $host);
30
    }
31
}
32