Passed
Pull Request — master (#1108)
by Tim
06:37
created

AbstractParser   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 77
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescriptors() 0 3 1
A __construct() 0 4 1
A getConfiguration() 0 3 1
A getDirectories() 0 3 1
A getApplication() 0 3 1
A getManager() 0 3 1
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();
0 ignored issues
show
Bug introduced by
The method getApplication() does not exist on AppserverIo\Psr\Application\ManagerInterface. It seems like you code against a sub-type of AppserverIo\Psr\Application\ManagerInterface such as AppserverIo\Appserver\Pe...ntainer\ServiceRegistry or AppserverIo\Appserver\Core\AbstractManager or AppserverIo\Appserver\As...Container\AspectManager or AppserverIo\Appserver\Se...rdAuthenticationManager or AppserverIo\Appserver\Se...\StandardSessionManager or AppserverIo\Appserver\De...ctionContainer\Provider or AppserverIo\Appserver\Console\ConsoleManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

91
        return $this->getManager()->/** @scrutinizer ignore-call */ getApplication();
Loading history...
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();
0 ignored issues
show
Bug introduced by
The method getDescriptors() does not exist on AppserverIo\Psr\Application\ManagerInterface. It seems like you code against a sub-type of AppserverIo\Psr\Application\ManagerInterface such as AppserverIo\Appserver\Pe...ntainer\ServiceRegistry or AppserverIo\Appserver\Core\AbstractManager or AppserverIo\Appserver\Se...rdAuthenticationManager or AppserverIo\Appserver\Console\ConsoleManager. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

111
        return $this->getManager()->/** @scrutinizer ignore-call */ getDescriptors();
Loading history...
112
    }
113
}
114