ApplicationWrapper::getSessionDir()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * \AppserverIo\Psr\Application\ApplicationWrapper
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-psr/application
18
 * @link      http://www.appserver.io
19
 */
20
21
namespace AppserverIo\Psr\Application;
22
23
/**
24
 * A wrapper implementation for an application.
25
 *
26
 * @author    Tim Wagner <[email protected]>
27
 * @copyright 2015 TechDivision GmbH <[email protected]>
28
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
29
 * @link      https://github.com/appserver-io-psr/application
30
 * @link      http://www.appserver.io
31
 */
32
class ApplicationWrapper
33
{
34
35
    /**
36
     * The wrapped application instance.
37
     *
38
     * @var \AppserverIo\Psr\Application\ApplicationInterface
39
     */
40
    protected $application;
41
42
    /**
43
     * Injects the application instance we want to wrap.
44
     *
45
     * @param \AppserverIo\Psr\Application\ApplicationInterface $application The application instance we want to wrap
46
     *
47
     * @return void
48
     */
49 1
    public function injectApplication(ApplicationInterface $application)
50
    {
51 1
        $this->application = $application;
52 1
    }
53
54
    /**
55
     * Returns the wrapped application instance.
56
     *
57
     * @return \AppserverIo\Psr\Application\ApplicationInterface
58
     */
59 1
    public function getApplication()
60
    {
61 1
        return $this->application;
62
    }
63
64
    /**
65
     * Has been automatically invoked by the container after the application
66
     * instance has been created.
67
     *
68
     * @return \AppserverIo\Psr\Application\ApplicationInterface The connected application
69
     */
70
    public function connect()
71
    {
72
        return $this->getApplication()->connect();
73
    }
74
75
    /**
76
     * Returns the application name (that has to be the class namespace,
77
     * e. g. TechDivision\Example).
78
     *
79
     * @return string The application name
80
     */
81 1
    public function getName()
82
    {
83 1
        return $this->getApplication()->getName();
84
    }
85
86
    /**
87
     * Return's the applications servers base directory, which is
88
     * /opt/appserver by default.
89
     *
90
     * @param string $directoryToAppend Directory to append before returning the base directory
91
     *
92
     * @return string The application server's base directory
93
     */
94
    public function getBaseDirectory($directoryToAppend = null)
95
    {
96
        return $this->getApplication()->getBaseDirectory($directoryToAppend);
97
    }
98
99
    /**
100
     * Returns the path to the web application.
101
     *
102
     * @return string The path to the web application
103
     */
104
    public function getWebappPath()
105
    {
106
        return $this->getApplication()->getWebappPath();
107
    }
108
109
    /**
110
     * Returns the absolute path to the applications base directory.
111
     *
112
     * @return string The app base directory
113
     */
114
    public function getAppBase()
115
    {
116
        return $this->getApplication()->getAppBase();
117
    }
118
119
    /**
120
     * Returns the absolute path to the applications temporary directory.
121
     *
122
     * @return string The app temporary directory
123
     */
124
    public function getTmpDir()
125
    {
126
        return $this->getApplication()->getTmpDir();
0 ignored issues
show
Bug introduced by
The method getTmpDir() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
127
    }
128
129
    /**
130
     * Returns the absolute path to the applications session directory.
131
     *
132
     * @return string The app session directory
133
     */
134
    public function getSessionDir()
135
    {
136
        return $this->getApplication()->getSessionDir();
0 ignored issues
show
Bug introduced by
The method getSessionDir() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
    }
138
139
    /**
140
     * Returns the absolute path to the applications cache directory.
141
     *
142
     * @return string The app cache directory
143
     */
144
    public function getCacheDir()
145
    {
146
        return $this->getApplication()->getCacheDir();
0 ignored issues
show
Bug introduced by
The method getCacheDir() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
147
    }
148
149
    /**
150
     * Injects the username the application should be executed with.
151
     *
152
     * @return string The username
153
     */
154
    public function getUser()
155
    {
156
        return $this->getApplication()->getUser();
0 ignored issues
show
Bug introduced by
The method getUser() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
157
    }
158
159
    /**
160
     * Injects the groupname the application should be executed with.
161
     *
162
     * @return string The groupname
163
     */
164
    public function getGroup()
165
    {
166
        return $this->getApplication()->getGroup();
0 ignored issues
show
Bug introduced by
The method getGroup() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
167
    }
168
169
    /**
170
     * Returns the umask the application should create files/directories with.
171
     *
172
     * @return string The umask
173
     */
174
    public function getUmask()
175
    {
176
        $this->getApplication()->getUmask();
0 ignored issues
show
Bug introduced by
The method getUmask() does not seem to exist on object<AppserverIo\Psr\A...n\ApplicationInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
177
    }
178
}
179