1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* \AppserverIo\Appserver\DependencyInjectionContainer\AbstractParser |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/appserver-io/appserver |
18
|
|
|
* @link http://www.appserver.io |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace AppserverIo\Appserver\DependencyInjectionContainer; |
22
|
|
|
|
23
|
|
|
use AppserverIo\Psr\Application\ManagerInterface; |
24
|
|
|
use AppserverIo\Appserver\Core\Api\Node\ParserNodeInterface; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Abstract parser implementation. |
28
|
|
|
* |
29
|
|
|
* @author Tim Wagner <[email protected]> |
30
|
|
|
* @copyright 2015 TechDivision GmbH <[email protected]> |
31
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
32
|
|
|
* @link https://github.com/appserver-io/appserver |
33
|
|
|
* @link http://www.appserver.io |
34
|
|
|
*/ |
35
|
|
|
abstract class AbstractParser implements ParserInterface |
36
|
|
|
{ |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* The object manager we want to parse the deployment descriptor for. |
40
|
|
|
* |
41
|
|
|
* @var \AppserverIo\Psr\Application\ManagerInterface |
42
|
|
|
*/ |
43
|
|
|
protected $manager; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* The parser configuration. |
47
|
|
|
* |
48
|
|
|
* @var \AppserverIo\Appserver\Core\Api\Node\ParserNodeInterface |
49
|
|
|
*/ |
50
|
|
|
protected $configuration; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Initializes the instance with the parser configuration and manager instance. |
54
|
|
|
* |
55
|
|
|
* @param \AppserverIo\Appserver\Core\Api\Node\ParserNodeInterface $configuration The parser configuration |
56
|
|
|
* @param \AppserverIo\Psr\Application\ManagerInterface $manager The object manager instance |
57
|
|
|
*/ |
58
|
|
|
public function __construct(ParserNodeInterface $configuration, ManagerInterface $manager) |
59
|
|
|
{ |
60
|
|
|
$this->manager = $manager; |
61
|
|
|
$this->configuration = $configuration; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Returns the manager instance. |
66
|
|
|
* |
67
|
|
|
* @return \AppserverIo\Psr\Application\ManagerInterface The manager instance |
68
|
|
|
*/ |
69
|
|
|
public function getManager() |
70
|
|
|
{ |
71
|
|
|
return $this->manager; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* The parser configuration. |
76
|
|
|
* |
77
|
|
|
* @return \AppserverIo\Appserver\Core\Api\Node\ParserNodeInterface The parser configuration |
78
|
|
|
*/ |
79
|
|
|
public function getConfiguration() |
80
|
|
|
{ |
81
|
|
|
return $this->configuration; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Returns the application context instance the bean context is bound to. |
86
|
|
|
* |
87
|
|
|
* @return \AppserverIo\Psr\Application\ApplicationInterface The application context instance |
88
|
|
|
*/ |
89
|
|
|
public function getApplication() |
90
|
|
|
{ |
91
|
|
|
return $this->getManager()->getApplication(); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Returns the configured directories. |
96
|
|
|
* |
97
|
|
|
* @return array The directories |
98
|
|
|
*/ |
99
|
|
|
public function getDirectories() |
100
|
|
|
{ |
101
|
|
|
return $this->getConfiguration()->getDirectoriesAsArray(); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* Returns the configured descriptor classes. |
106
|
|
|
* |
107
|
|
|
* @return array The descriptors |
108
|
|
|
*/ |
109
|
|
|
public function getDescriptors() |
110
|
|
|
{ |
111
|
|
|
return $this->getManager()->getDescriptors(); |
|
|
|
|
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
|