1 | <?php |
||
34 | class LoggerXmlConfiguration implements LoggerConfigurationInterface |
||
35 | { |
||
36 | |||
37 | /** |
||
38 | * Holds the name of the logger |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $name; |
||
42 | |||
43 | /** |
||
44 | * Holds the type of the logger |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $type; |
||
48 | |||
49 | /** |
||
50 | * 'Holds the loggers channel name |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $channel; |
||
54 | |||
55 | /** |
||
56 | * Holds all handlers defined for logger |
||
57 | * @var array |
||
58 | */ |
||
59 | protected $handlers; |
||
60 | |||
61 | /** |
||
62 | * Holds all processors defined for logger |
||
63 | * @var array |
||
64 | */ |
||
65 | protected $processors; |
||
66 | |||
67 | /** |
||
68 | * Constructs config |
||
69 | * |
||
70 | * @param \SimpleXMLElement $node The simple xml element used to build config |
||
71 | */ |
||
72 | public function __construct(\SimpleXMLElement $node) |
||
73 | { |
||
74 | // prepare properties |
||
75 | $this->name = (string)$node->attributes()->name; |
||
76 | $this->type = (string)$node->attributes()->type; |
||
77 | if (isset($node->attributes()->channel)) { |
||
78 | $this->channel = (string)$node->attributes()->channel; |
||
79 | } |
||
80 | |||
81 | // prepare handlers |
||
82 | $this->handlers = $this->prepareHandlers($node); |
||
83 | // prepare processors |
||
84 | $this->processors = $this->prepareProcessors($node); |
||
85 | } |
||
86 | |||
87 | /** |
||
88 | * Returns name |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getName() |
||
96 | |||
97 | /** |
||
98 | * Returns type |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getType() |
||
106 | |||
107 | /** |
||
108 | * Returns channel |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getChannel() |
||
116 | |||
117 | /** |
||
118 | * Returns defined handlers for logger |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getHandlers() |
||
126 | |||
127 | /** |
||
128 | * Returns defined processors for logger |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function getProcessors() |
||
136 | |||
137 | /** |
||
138 | * Prepares handlers array for config |
||
139 | * |
||
140 | * @param \SimpleXMLElement $node The xml node to prepare for |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | public function prepareHandlers($node) |
||
178 | |||
179 | /** |
||
180 | * Prepares processors array for config |
||
181 | * |
||
182 | * @param \SimpleXMLElement $node The xml node to prepare for |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | public function prepareProcessors($node) |
||
196 | } |
||
197 |