Helper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A canonical() 0 8 2
A className() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the africc/pdns-client 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\Pdns;
13
14
class Helper
15
{
16
    /**
17
     * returns canonical domain (e.g. always returns root dot)
18
     *
19
     * @param string $name
20
     *
21
     * @return string
22
     */
23
    public static function canonical($name)
24
    {
25
        if (substr($name, -1) !== '.') {
26
            return $name . '.';
27
        }
28
29
        return $name;
30
    }
31
32
    /**
33
     * returns class name of given object (excluding namespace)
34
     *
35
     * @param object $object
36
     *
37
     * @return string
38
     */
39
    public static function className($object)
40
    {
41
        return substr(strrchr(get_class($object), '\\'), 1);
42
    }
43
}
44