1: <?php
2: /*
3: * Copyright (c) 2016 Geraldo B. Landre
4: *
5: * See the file LICENSE for copying permission.
6: */
7: namespace pgn\tags;
8:
9: use pgn\exceptions\InvalidClassNameException;
10:
11: /**
12: * Represents an unrecognized tag
13: *
14: * @author Geraldo
15: */
16: class UknownTag extends Tag {
17: /**
18: *
19: * @var string
20: */
21: private $className;
22:
23: /**
24: *
25: * @param string $name
26: * @throws InvalidClassNameException
27: */
28: public function setName($name) {
29: if(is_string($name)) {
30: $this->className = $name;
31: }
32: else {
33: throw new InvalidClassNameException("[" . __CLASS__ . "] bad name: " . $name);
34: }
35: }
36:
37: /**
38: *
39: * @return string name of the class
40: * @throws InvalidClassNameException if className was not set
41: */
42: public function getName() {
43: if(!empty($this->className)) {
44: return $this->className;
45: }
46: throw new InvalidClassNameException("[" . __CLASS__ . "] name was not set for an uknown tag");
47: }
48: }
49: