Passed
Push — master ( c30585...90dc34 )
by Christopher
02:43
created

SchemaTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @link      https://github.com/chrmorandi/yii2-ldap for the source repository
4
 * @package   yii2-ldap
5
 * @author    Christopher Mota <[email protected]>
6
 * @license   MIT License - view the LICENSE file that was distributed with this source code.
7
 */
8
9
namespace chrmorandi\ldap\schemas;
10
11
use ReflectionClass;
12
use ReflectionProperty;
13
14
/**
15
 *
16
 * @since 1.0.0
17
 */
18
trait SchemaTrait
19
{
20
    /**
21
     * The LDAP API references an LDAP object by its distinguished name (DN).
22
     * A DN is a sequence of relative distinguished names (RDN) connected by commas.
23
     *
24
     * @link https://msdn.microsoft.com/en-us/library/aa366101(v=vs.85).aspx
25
     * @var  string
26
     */
27
    public $dn;
28
29
    /**
30
     * Returns the list of attribute names.
31
     * By default, this method returns all public properties of the class.
32
     * @return array list of attribute names.
33
     */
34
    public function getAttributes()
35
    {
36
        $class = new ReflectionClass(self::class);
37
        $names = [];
38
        foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
39
            $names[] = $property->getName();
40
        }
41
42
        return $names;
43
    }
44
45
}
46