Mark V
1: <?php
2: namespace MOC\V\Core\AutoLoader\Component\Parameter\Repository;
3:
4: use MOC\V\Core\AutoLoader\Component\Exception\Repository\EmptyNamespaceException;
5: use MOC\V\Core\AutoLoader\Component\IParameterInterface;
6: use MOC\V\Core\AutoLoader\Component\Parameter\Parameter;
7:
8: /**
9: * Class NamespaceParameter
10: *
11: * @package MOC\V\Core\AutoLoader\Component\Parameter\Repository
12: */
13: class NamespaceParameter extends Parameter implements IParameterInterface
14: {
15:
16: /** @var string $Namespace */
17: private $Namespace = null;
18:
19: /**
20: * @param string $Namespace
21: */
22: public function __construct($Namespace)
23: {
24:
25: $this->setNamespace($Namespace);
26: }
27:
28: /**
29: * @return string
30: */
31: public function __toString()
32: {
33:
34: return (string)$this->getNamespace();
35: }
36:
37: /**
38: * @return string
39: */
40: public function getNamespace()
41: {
42:
43: return $this->Namespace;
44: }
45:
46: /**
47: * @param null|string $Namespace
48: *
49: * @throws EmptyNamespaceException
50: */
51: public function setNamespace($Namespace)
52: {
53:
54: if (null === $Namespace) {
55: $this->Namespace = null;
56: } else {
57: $Namespace = trim($Namespace, '\\');
58: if (empty( $Namespace )) {
59: throw new EmptyNamespaceException();
60: } else {
61: $this->Namespace = $Namespace;
62: }
63: }
64: }
65: }
66: