1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Fwk |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2013-2014, Julien Ballestracci <[email protected]>. |
6
|
|
|
* All rights reserved. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
12
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
13
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
14
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
15
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
16
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
17
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
18
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
19
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
20
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
21
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
22
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
23
|
|
|
* |
24
|
|
|
* PHP Version 5.3 |
25
|
|
|
* |
26
|
|
|
* @category Core |
27
|
|
|
* @package Fwk\Core |
28
|
|
|
* @author Julien Ballestracci <[email protected]> |
29
|
|
|
* @copyright 2013-2014 Julien Ballestracci <[email protected]> |
30
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
31
|
|
|
* @link http://www.fwk.pw |
32
|
|
|
*/ |
33
|
|
|
namespace Fwk\Core\Action; |
34
|
|
|
|
35
|
|
|
use Fwk\Core\ServicesAware, |
36
|
|
|
Fwk\Core\ContextAware, |
37
|
|
|
Fwk\Core\Context, |
38
|
|
|
Fwk\Di\Container; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Simple utility/shortcut base class for Actions. |
42
|
|
|
* |
43
|
|
|
* @category Utilities |
44
|
|
|
* @package Fwk\Core |
45
|
|
|
* @author Julien Ballestracci <[email protected]> |
46
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
47
|
|
|
* @link http://www.fwk.pw |
48
|
|
|
*/ |
49
|
|
|
abstract class Controller implements ContextAware, ServicesAware |
|
|
|
|
50
|
|
|
{ |
51
|
|
|
/** |
52
|
|
|
* @var Container |
53
|
|
|
*/ |
54
|
|
|
protected $services; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var Context |
58
|
|
|
*/ |
59
|
|
|
protected $context; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the Services Container |
63
|
|
|
* |
64
|
|
|
* @return Container |
65
|
|
|
*/ |
66
|
4 |
|
public function getServices() |
67
|
|
|
{ |
68
|
4 |
|
return $this->services; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Sets the Services Container |
73
|
|
|
* |
74
|
|
|
* @param Container $container Services Container |
75
|
|
|
* |
76
|
|
|
* @return void |
77
|
|
|
*/ |
78
|
4 |
|
public function setServices(Container $container) |
79
|
|
|
{ |
80
|
4 |
|
$this->services = $container; |
81
|
4 |
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Sets current context |
85
|
|
|
* |
86
|
|
|
* @param Context $context Current context |
87
|
|
|
* |
88
|
|
|
* @return void |
89
|
|
|
*/ |
90
|
4 |
|
public function setContext(Context $context) |
91
|
|
|
{ |
92
|
4 |
|
$this->context = $context; |
93
|
4 |
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Returns current context |
97
|
|
|
* |
98
|
|
|
* @return Context |
99
|
|
|
*/ |
100
|
4 |
|
public function getContext() |
101
|
|
|
{ |
102
|
4 |
|
return $this->context; |
103
|
|
|
} |
104
|
|
|
} |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.