Completed
Pull Request — master (#68)
by
unknown
02:16
created

Domain   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 24
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDomain() 0 8 2
A setRegistrarTag() 0 4 1
A getExtensionNamespace() 0 4 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 App\EPP\Extension\Nominet\Release;
13
14
use AfriCC\EPP\Frame\Command\Update as UpdateCommand;
15
use AfriCC\EPP\ExtensionInterface as Extension;
16
use AfriCC\EPP\Validator;
17
use Exception;
18
19
/**
20
 * @see https://registrars.nominet.uk/namespace/uk/registration-and-domain-management/epp-commands#release
21
 */
22
class Domain extends UpdateCommand implements Extension
23
{
24
    protected $extension = 'r';
25
    protected $extension_xmlns = 'http://www.nominet.org.uk/epp/xml/std-release-1.0';
26
27
    public function setDomain($domain)
28
    {
29
        if (!Validator::isHostname($domain)) {
30
            throw new Exception(sprintf('%s is not a valid domain name', $domain));
31
        }
32
33
        $this->set('//epp:epp/epp:command/epp:update/r:release/r:domainName', $domain);
34
    }
35
36
    public function setRegistrarTag($tag)
37
    {
38
        $this->set('//epp:epp/epp:command/epp:update/r:release/r:registrarTag', $tag);
39
    }
40
41
    public function getExtensionNamespace()
42
    {
43
        return $this->extension_xmlns;
44
    }
45
}
46