@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * @param array $routes |
|
53 | + * @param array $routables |
|
54 | 54 | * @return AppConfig Chainable |
55 | 55 | */ |
56 | 56 | public function set_routables(array $routables) |
@@ -88,7 +88,6 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * Set the application's available languages |
90 | 90 | * |
91 | - * @param Language[] $lang |
|
92 | 91 | * @return self |
93 | 92 | */ |
94 | 93 | public function set_languages(array $languages) |
@@ -17,24 +17,24 @@ discard block |
||
17 | 17 | class AppConfig extends AbstractConfig |
18 | 18 | { |
19 | 19 | /** |
20 | - * @var array $routes |
|
21 | - */ |
|
20 | + * @var array $routes |
|
21 | + */ |
|
22 | 22 | private $routes = []; |
23 | 23 | |
24 | 24 | /** |
25 | - * @var array $routables |
|
26 | - */ |
|
25 | + * @var array $routables |
|
26 | + */ |
|
27 | 27 | private $routables = []; |
28 | 28 | |
29 | 29 | /** |
30 | - * @var array $modules |
|
31 | - */ |
|
30 | + * @var array $modules |
|
31 | + */ |
|
32 | 32 | private $modules = []; |
33 | 33 | |
34 | 34 | /** |
35 | - * @param array $routes |
|
36 | - * @return AppConfig Chainable |
|
37 | - */ |
|
35 | + * @param array $routes |
|
36 | + * @return AppConfig Chainable |
|
37 | + */ |
|
38 | 38 | public function set_routes(array $routes) |
39 | 39 | { |
40 | 40 | $this->routes = $routes; |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * @return array |
|
46 | - */ |
|
45 | + * @return array |
|
46 | + */ |
|
47 | 47 | public function routes() |
48 | 48 | { |
49 | 49 | return $this->routes; |
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * @param array $routes |
|
54 | - * @return AppConfig Chainable |
|
55 | - */ |
|
53 | + * @param array $routes |
|
54 | + * @return AppConfig Chainable |
|
55 | + */ |
|
56 | 56 | public function set_routables(array $routables) |
57 | 57 | { |
58 | 58 | $this->routables = $routables; |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * @return array |
|
64 | - */ |
|
63 | + * @return array |
|
64 | + */ |
|
65 | 65 | public function routables() |
66 | 66 | { |
67 | 67 | return $this->routables; |
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * @param array $modules |
|
72 | - * @return AppConfig Chainable |
|
73 | - */ |
|
71 | + * @param array $modules |
|
72 | + * @return AppConfig Chainable |
|
73 | + */ |
|
74 | 74 | public function set_modules(array $modules) |
75 | 75 | { |
76 | 76 | $this->modules = $modules; |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * @return array |
|
82 | - */ |
|
81 | + * @return array |
|
82 | + */ |
|
83 | 83 | public function modules() |
84 | 84 | { |
85 | 85 | return $this->modules; |
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Set the application's available languages |
|
90 | - * |
|
91 | - * @param Language[] $lang |
|
92 | - * @return self |
|
93 | - */ |
|
89 | + * Set the application's available languages |
|
90 | + * |
|
91 | + * @param Language[] $lang |
|
92 | + * @return self |
|
93 | + */ |
|
94 | 94 | public function set_languages(array $languages) |
95 | 95 | { |
96 | 96 | $this->languages = $languages; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | - * Add or update an available language to the application |
|
102 | - * |
|
103 | - * @param Language $lang |
|
104 | - * @return self |
|
105 | - */ |
|
101 | + * Add or update an available language to the application |
|
102 | + * |
|
103 | + * @param Language $lang |
|
104 | + * @return self |
|
105 | + */ |
|
106 | 106 | public function add_language(Language $lang) |
107 | 107 | { |
108 | 108 | $this->languages[$lang->ident()] = $lang; |
@@ -110,21 +110,21 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
113 | - * Get the application's list of available languages |
|
114 | - * |
|
115 | - * @return Language[] |
|
116 | - */ |
|
113 | + * Get the application's list of available languages |
|
114 | + * |
|
115 | + * @return Language[] |
|
116 | + */ |
|
117 | 117 | public function languages() |
118 | 118 | { |
119 | 119 | return $this->languages; |
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * Set the application's global TranslationConfig |
|
124 | - * |
|
125 | - * @param array|TranslationConfig $translation |
|
126 | - * @return self |
|
127 | - */ |
|
123 | + * Set the application's global TranslationConfig |
|
124 | + * |
|
125 | + * @param array|TranslationConfig $translation |
|
126 | + * @return self |
|
127 | + */ |
|
128 | 128 | public function set_translation($translation) |
129 | 129 | { |
130 | 130 | if ($translation instanceof TranslationConfig) { |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | - * Get the application's global TranslationConfig |
|
140 | - * |
|
141 | - * @return TranslationConfig |
|
142 | - */ |
|
139 | + * Get the application's global TranslationConfig |
|
140 | + * |
|
141 | + * @return TranslationConfig |
|
142 | + */ |
|
143 | 143 | public function translation() |
144 | 144 | { |
145 | 145 | return $this->translation_config; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @param SlimApp $app |
47 | - * @return App Chainable |
|
47 | + * @return AbstractTemplate Chainable |
|
48 | 48 | */ |
49 | 49 | public function set_app(SlimApp $app) |
50 | 50 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * Fulfills the PSR-1 style LoggerAwareInterface |
64 | 64 | * |
65 | 65 | * @param LoggerInterface $logger |
66 | - * @return AbstractEngine Chainable |
|
66 | + * @return AbstractTemplate Chainable |
|
67 | 67 | */ |
68 | 68 | public function setLogger(LoggerInterface $logger) |
69 | 69 | { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | /** |
74 | 74 | * @param LoggerInterface $logger |
75 | - * @return AbstractEngine Chainable |
|
75 | + * @return AbstractTemplate Chainable |
|
76 | 76 | */ |
77 | 77 | public function set_logger(LoggerInterface $logger = null) |
78 | 78 | { |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | use ViewableTrait; |
30 | 30 | |
31 | 31 | /** |
32 | - * @var LoggerInterface $logger |
|
33 | - */ |
|
32 | + * @var LoggerInterface $logger |
|
33 | + */ |
|
34 | 34 | private $logger; |
35 | 35 | |
36 | 36 | public function __construct(array $data = null) |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
46 | - * @param SlimApp $app |
|
47 | - * @return App Chainable |
|
48 | - */ |
|
46 | + * @param SlimApp $app |
|
47 | + * @return App Chainable |
|
48 | + */ |
|
49 | 49 | public function set_app(SlimApp $app) |
50 | 50 | { |
51 | 51 | $this->app = $app; |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | - * > LoggerAwareInterface > setLogger() |
|
62 | - * |
|
63 | - * Fulfills the PSR-1 style LoggerAwareInterface |
|
64 | - * |
|
65 | - * @param LoggerInterface $logger |
|
66 | - * @return AbstractEngine Chainable |
|
67 | - */ |
|
61 | + * > LoggerAwareInterface > setLogger() |
|
62 | + * |
|
63 | + * Fulfills the PSR-1 style LoggerAwareInterface |
|
64 | + * |
|
65 | + * @param LoggerInterface $logger |
|
66 | + * @return AbstractEngine Chainable |
|
67 | + */ |
|
68 | 68 | public function setLogger(LoggerInterface $logger) |
69 | 69 | { |
70 | 70 | return $this->set_logger($logger); |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | - * @param LoggerInterface $logger |
|
75 | - * @return AbstractEngine Chainable |
|
76 | - */ |
|
74 | + * @param LoggerInterface $logger |
|
75 | + * @return AbstractEngine Chainable |
|
76 | + */ |
|
77 | 77 | public function set_logger(LoggerInterface $logger = null) |
78 | 78 | { |
79 | 79 | $this->logger = $logger; |
@@ -81,18 +81,18 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * @erturn LoggerInterface |
|
85 | - */ |
|
84 | + * @erturn LoggerInterface |
|
85 | + */ |
|
86 | 86 | public function logger() |
87 | 87 | { |
88 | 88 | return $this->logger; |
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
92 | - * The default Template View is a simple GenericView. |
|
93 | - * |
|
94 | - * @return \Charcoal\View\ViewInterface |
|
95 | - */ |
|
92 | + * The default Template View is a simple GenericView. |
|
93 | + * |
|
94 | + * @return \Charcoal\View\ViewInterface |
|
95 | + */ |
|
96 | 96 | public function create_view(array $data = null) |
97 | 97 | { |
98 | 98 | $view = new GenericView([ |
@@ -23,25 +23,25 @@ discard block |
||
23 | 23 | class LanguageManager extends AbstractManager |
24 | 24 | { |
25 | 25 | /** |
26 | - * @var array LanguageInterface |
|
27 | - */ |
|
26 | + * @var array LanguageInterface |
|
27 | + */ |
|
28 | 28 | private $languages; |
29 | 29 | |
30 | 30 | /** |
31 | - * @var TranslationConfig |
|
32 | - */ |
|
31 | + * @var TranslationConfig |
|
32 | + */ |
|
33 | 33 | private $translation_config; |
34 | 34 | |
35 | 35 | /** |
36 | - * @var GenericConfig |
|
37 | - */ |
|
36 | + * @var GenericConfig |
|
37 | + */ |
|
38 | 38 | private static $language_index; |
39 | 39 | |
40 | 40 | /** |
41 | - * Set up the available languages, defaults, and active |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
41 | + * Set up the available languages, defaults, and active |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | 45 | public function setup() |
46 | 46 | { |
47 | 47 | $this->setup_translations(); |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Set up the available languages, defaults, and active |
|
53 | - * |
|
54 | - * Settings: |
|
55 | - * - languages |
|
56 | - * - default_lang |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
52 | + * Set up the available languages, defaults, and active |
|
53 | + * |
|
54 | + * Settings: |
|
55 | + * - languages |
|
56 | + * - default_lang |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | 60 | public function setup_translations() |
61 | 61 | { |
62 | 62 | $config = $this->config(); |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | - * Set up the available languages, defaults, and active |
|
85 | - * |
|
86 | - * @return void |
|
87 | - */ |
|
84 | + * Set up the available languages, defaults, and active |
|
85 | + * |
|
86 | + * @return void |
|
87 | + */ |
|
88 | 88 | public function setup_languages() |
89 | 89 | { |
90 | 90 | $config = $this->config(); |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * Resolve a string identifier for a given Language. |
|
149 | - * |
|
150 | - * @param LanguageInterface &$lang The instance that needs resolution |
|
151 | - * @param mixed $ident Optional key/index of $config in previous method |
|
152 | - * @return void |
|
153 | - * @throws InvalidArgumentException |
|
154 | - */ |
|
148 | + * Resolve a string identifier for a given Language. |
|
149 | + * |
|
150 | + * @param LanguageInterface &$lang The instance that needs resolution |
|
151 | + * @param mixed $ident Optional key/index of $config in previous method |
|
152 | + * @return void |
|
153 | + * @throws InvalidArgumentException |
|
154 | + */ |
|
155 | 155 | public function resolve_ident(LanguageInterface &$lang, $ident = null) |
156 | 156 | { |
157 | 157 | if (is_string($ident)) { |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | - * Set the manager's available languages |
|
182 | - * |
|
183 | - * @param LanguageInterface[] $lang |
|
184 | - * @return self |
|
185 | - * @throws InvalidArgumentException if array has a member that isn't an instance of Language |
|
186 | - */ |
|
181 | + * Set the manager's available languages |
|
182 | + * |
|
183 | + * @param LanguageInterface[] $lang |
|
184 | + * @return self |
|
185 | + * @throws InvalidArgumentException if array has a member that isn't an instance of Language |
|
186 | + */ |
|
187 | 187 | public function set_languages($languages) |
188 | 188 | { |
189 | 189 | $this->languages = []; |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
202 | - * Add or update an available language to the manager |
|
203 | - * |
|
204 | - * @param LanguageInterface $lang |
|
205 | - * @return self |
|
206 | - */ |
|
202 | + * Add or update an available language to the manager |
|
203 | + * |
|
204 | + * @param LanguageInterface $lang |
|
205 | + * @return self |
|
206 | + */ |
|
207 | 207 | public function add_language(LanguageInterface $lang) |
208 | 208 | { |
209 | 209 | $this->languages[$lang->ident()] = $lang; |
@@ -211,21 +211,21 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
214 | - * Get the manager's list of available languages |
|
215 | - * |
|
216 | - * @return LanguageInterface[] |
|
217 | - */ |
|
214 | + * Get the manager's list of available languages |
|
215 | + * |
|
216 | + * @return LanguageInterface[] |
|
217 | + */ |
|
218 | 218 | public function languages() |
219 | 219 | { |
220 | 220 | return $this->languages; |
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Set the manager's translations for TranslationConfig |
|
225 | - * |
|
226 | - * @param array|TranslationConfig $translation |
|
227 | - * @return self |
|
228 | - */ |
|
224 | + * Set the manager's translations for TranslationConfig |
|
225 | + * |
|
226 | + * @param array|TranslationConfig $translation |
|
227 | + * @return self |
|
228 | + */ |
|
229 | 229 | public function set_translation($translation) |
230 | 230 | { |
231 | 231 | if ($translation instanceof TranslationConfig) { |
@@ -237,10 +237,10 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
240 | - * Get the manager's translations |
|
241 | - * |
|
242 | - * @return TranslationConfig |
|
243 | - */ |
|
240 | + * Get the manager's translations |
|
241 | + * |
|
242 | + * @return TranslationConfig |
|
243 | + */ |
|
244 | 244 | public function translation() |
245 | 245 | { |
246 | 246 | return $this->translation_config; |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | class RouteManager extends AbstractManager |
23 | 23 | { |
24 | 24 | /** |
25 | - * Set up the routes |
|
26 | - * |
|
27 | - * There are 3 types of routes: |
|
28 | - * - `templates` |
|
29 | - * - `actions` |
|
30 | - * - `scripts |
|
31 | - * |
|
32 | - * @return void |
|
33 | - */ |
|
25 | + * Set up the routes |
|
26 | + * |
|
27 | + * There are 3 types of routes: |
|
28 | + * - `templates` |
|
29 | + * - `actions` |
|
30 | + * - `scripts |
|
31 | + * |
|
32 | + * @return void |
|
33 | + */ |
|
34 | 34 | public function setup_routes() |
35 | 35 | { |
36 | 36 | if (PHP_SAPI == 'cli') { |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * @throws Exception |
|
46 | - * @return void |
|
47 | - */ |
|
45 | + * @throws Exception |
|
46 | + * @return void |
|
47 | + */ |
|
48 | 48 | protected function setup_template_routes() |
49 | 49 | { |
50 | 50 | $routes = $this->config(); |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $route = new TemplateRoute([ |
77 | - 'app' => $this, |
|
78 | - 'config' => new TemplateRouteConfig($template_config), |
|
79 | - 'logger' => $this->logger |
|
77 | + 'app' => $this, |
|
78 | + 'config' => new TemplateRouteConfig($template_config), |
|
79 | + 'logger' => $this->logger |
|
80 | 80 | ]); |
81 | 81 | // Invoke template route |
82 | 82 | return $route($request, $response); |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * @return void |
|
94 | - */ |
|
93 | + * @return void |
|
94 | + */ |
|
95 | 95 | protected function setup_action_routes() |
96 | 96 | { |
97 | 97 | $routes = $this->config(); |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * @return void |
|
136 | - */ |
|
135 | + * @return void |
|
136 | + */ |
|
137 | 137 | protected function setup_script_routes() |
138 | 138 | { |
139 | 139 | $routes = $this->config(); |
@@ -51,11 +51,11 @@ |
||
51 | 51 | { |
52 | 52 | return $c['response'] |
53 | 53 | ->withStatus(500) |
54 | - ->withHeader('Content-Type', 'text/html') |
|
55 | - ->write( |
|
54 | + ->withHeader('Content-Type', 'text/html') |
|
55 | + ->write( |
|
56 | 56 | sprintf('Something went wrong! (%s)'."\n", $exception->getMessage()) |
57 | 57 | ); |
58 | - }; |
|
58 | + }; |
|
59 | 59 | }; |
60 | 60 | |
61 | 61 | // Slim is the main app |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | // If using PHP's built-in server, return false for existing files on filesystem |
12 | 12 | if (PHP_SAPI === 'cli-server') { |
13 | - $filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']); |
|
13 | + $filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']); |
|
14 | 14 | if (is_file($filename)) { |
15 | 15 | return false; |
16 | 16 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | }; |
34 | 34 | |
35 | 35 | // Handle "404 Not Found" |
36 | -$container['notFoundHandler'] = function ($c) |
|
36 | +$container['notFoundHandler'] = function($c) |
|
37 | 37 | { |
38 | - return function ($request, $response) use ($c) |
|
38 | + return function($request, $response) use ($c) |
|
39 | 39 | { |
40 | 40 | return $c['response'] |
41 | 41 | ->withStatus(404) |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | }; |
46 | 46 | |
47 | 47 | // Handle "500 Server Error" |
48 | -$container['errorHandler'] = function ($c) |
|
48 | +$container['errorHandler'] = function($c) |
|
49 | 49 | { |
50 | - return function ($request, $response, $exception) use ($c) |
|
50 | + return function($request, $response, $exception) use ($c) |
|
51 | 51 | { |
52 | 52 | return $c['response'] |
53 | 53 | ->withStatus(500) |