Completed
Push — master ( 6bfb13...0fc592 )
by Lars
02:22
created

Object::getChildren()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 3
Bugs 1 Features 2
Metric Value
c 3
b 1
f 2
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace SimpleAcl;
3
4
use IteratorAggregate;
5
use SimpleAcl\Object\RecursiveIterator;
6
7
/**
8
 * Use to keep shared function between Roles and Resources.
9
 *
10
 * @package SimpleAcl
11
 */
12
abstract class Object implements IteratorAggregate
13
{
14
  /**
15
   * Hold the name of object.
16
   *
17
   * @var string
18
   */
19
  protected $name;
20
21
  /**
22
   * Create Object with given name.
23
   *
24
   * @param string $name
25
   */
26 57
  public function __construct($name)
27
  {
28 57
    $this->setName($name);
29 57
  }
30
31
  /**
32
   * @return RecursiveIterator
33
   */
34 27
  public function getIterator()
35
  {
36 27
    return new RecursiveIterator(array($this));
37
  }
38
39
  /**
40
   * @return string
41
   */
42 44
  public function getName()
43
  {
44 44
    return $this->name;
45
  }
46
47
  /**
48
   * @param string $name
49
   */
50 57
  public function setName($name)
51
  {
52 57
    $this->name = $name;
53 57
  }
54
}
55