@@ -4,9 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use PDO; |
6 | 6 | |
7 | -use RuntimeException; |
|
8 | -use InvalidArgumentException; |
|
9 | - |
|
10 | 7 | // From Pimple |
11 | 8 | use Pimple\Container; |
12 | 9 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | return ''; |
129 | 129 | } |
130 | 130 | } elseif ($val instanceof Translation) { |
131 | - $propertyValue = (string)$val; |
|
131 | + $propertyValue = (string) $val; |
|
132 | 132 | } else { |
133 | 133 | $propertyValue = $val; |
134 | 134 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $val = $this->val(); |
177 | 177 | if ($this->hasChoice($val)) { |
178 | 178 | $choice = $this->choice($val); |
179 | - $keys = [ 'controller', 'template', 'class' ]; |
|
179 | + $keys = ['controller', 'template', 'class']; |
|
180 | 180 | foreach ($keys as $key) { |
181 | 181 | if (isset($choice[$key])) { |
182 | 182 | return $choice[$key]; |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace Charcoal\Admin\Widget\Cms; |
4 | 4 | |
5 | -use Exception; |
|
6 | 5 | use RuntimeException; |
7 | 6 | |
8 | 7 | // From 'charcoal-core' |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | switch ($sectionType) { |
98 | 98 | case AbstractSection::TYPE_EXTERNAL: |
99 | - $externalUrl = (string)$object->externalUrl(); |
|
99 | + $externalUrl = (string) $object->externalUrl(); |
|
100 | 100 | $linkExcerpt = ''; |
101 | 101 | $tagTemplate = '<span class="glyphicon glyphicon-link" data-toggle="tooltip" '. |
102 | 102 | 'data-placement="auto" title="%1$s"></span>'; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($propertyIdent === 'title') { |
126 | - if (is_callable([ $object, 'navMenu' ]) && $object->navMenu()) { |
|
126 | + if (is_callable([$object, 'navMenu']) && $object->navMenu()) { |
|
127 | 127 | $propertyValue .= sprintf( |
128 | 128 | ' '. |
129 | 129 | '<span class="glyphicon glyphicon-list" data-toggle="tooltip" '. |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ); |
136 | 136 | } |
137 | 137 | |
138 | - if (is_callable([ $object, 'locked' ]) && $object->locked()) { |
|
138 | + if (is_callable([$object, 'locked']) && $object->locked()) { |
|
139 | 139 | $propertyValue .= sprintf( |
140 | 140 | ' '. |
141 | 141 | '<span class="glyphicon glyphicon-lock" data-toggle="tooltip" '. |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use InvalidArgumentException; |
6 | 6 | |
7 | 7 | // From 'charcoal-core' |
8 | -use Charcoal\Model\Collection; |
|
9 | 8 | use Charcoal\Loader\CollectionLoader; |
10 | 9 | |
11 | 10 | // From 'charcoal-object' |
@@ -31,7 +31,7 @@ |
||
31 | 31 | { |
32 | 32 | parent::__construct($data); |
33 | 33 | |
34 | - if (is_callable([ $this, 'defaultData' ])) { |
|
34 | + if (is_callable([$this, 'defaultData'])) { |
|
35 | 35 | $this->setData($this->defaultData()); |
36 | 36 | } |
37 | 37 | } |
@@ -12,13 +12,11 @@ |
||
12 | 12 | use Pimple\ServiceProviderInterface; |
13 | 13 | |
14 | 14 | // Local dependencies |
15 | -use Charcoal\Cms\Config; |
|
16 | 15 | |
17 | 16 | // Cms Loaders |
18 | 17 | use Charcoal\Cms\Service\Loader\SectionLoader; |
19 | 18 | |
20 | 19 | // dependencies from `charcoal-core` |
21 | -use Charcoal\Model\AbstractModel; |
|
22 | 20 | |
23 | 21 | // dependencies from `charcoal-cms` |
24 | 22 | use Charcoal\Cms\SectionInterface; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @param Container $container |
52 | 52 | * @return CmsConfig Website configurations (from cms.json). |
53 | 53 | */ |
54 | - $container['cms/config'] = function (Container $container) { |
|
54 | + $container['cms/config'] = function(Container $container) { |
|
55 | 55 | $appConfig = $container['config']; |
56 | 56 | $cms = $appConfig->get('cms'); |
57 | 57 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param Container $container Pimple DI Container. |
85 | 85 | * @return DateHelper |
86 | 86 | */ |
87 | - $container['cms/date/helper'] = function (Container $container) { |
|
87 | + $container['cms/date/helper'] = function(Container $container) { |
|
88 | 88 | return new DateHelper([ |
89 | 89 | 'date_formats' => $container['cms/config']->get('date_formats'), |
90 | 90 | 'time_formats' => $container['cms/config']->get('time_formats'), |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @param Container $container Pimple DI Container. |
97 | 97 | * @return DateHelper |
98 | 98 | */ |
99 | - $container['date/helper'] = function (Container $container) { |
|
99 | + $container['date/helper'] = function(Container $container) { |
|
100 | 100 | trigger_error(sprintf( |
101 | 101 | '%s is deprecated, use %s instead', |
102 | 102 | '$container[\'date/helper\']', |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param Container $container Pimple DI Container. |
122 | 122 | * @return GenericFactory |
123 | 123 | */ |
124 | - $container['cms/section/factory'] = function (Container $container) { |
|
124 | + $container['cms/section/factory'] = function(Container $container) { |
|
125 | 125 | return new GenericFactory([ |
126 | 126 | 'base_class' => SectionInterface::class, |
127 | 127 | 'arguments' => $container['model/factory']->arguments(), |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param Container $container Pimple DI Container. |
136 | 136 | * @return SectionLoader |
137 | 137 | */ |
138 | - $container['cms/section/loader'] = function (Container $container) { |
|
138 | + $container['cms/section/loader'] = function(Container $container) { |
|
139 | 139 | $sectionLoader = new SectionLoader([ |
140 | 140 | 'loader' => $container['model/collection/loader'], |
141 | 141 | 'factory' => $container['model/factory'], |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param Container $container Pimple DI Container. |
165 | 165 | * @return NewsLoader |
166 | 166 | */ |
167 | - $container['cms/news/loader'] = function (Container $container) { |
|
167 | + $container['cms/news/loader'] = function(Container $container) { |
|
168 | 168 | $newsLoader = new NewsLoader([ |
169 | 169 | 'loader' => $container['model/collection/loader'], |
170 | 170 | 'factory' => $container['model/factory'], |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param Container $container |
186 | 186 | * @return NewsManager |
187 | 187 | */ |
188 | - $container['cms/news/manager'] = function (Container $container) { |
|
188 | + $container['cms/news/manager'] = function(Container $container) { |
|
189 | 189 | |
190 | 190 | $newsManager = new NewsManager([ |
191 | 191 | 'loader' => $container['model/collection/loader'], |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * @param Container $container Pimple DI Container. |
211 | 211 | * @return EventLoader |
212 | 212 | */ |
213 | - $container['cms/event/loader'] = function (Container $container) { |
|
213 | + $container['cms/event/loader'] = function(Container $container) { |
|
214 | 214 | $eventLoader = new EventLoader([ |
215 | 215 | 'loader' => $container['model/collection/loader'], |
216 | 216 | 'factory' => $container['model/factory'], |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param Container $container |
235 | 235 | * @return EventManager |
236 | 236 | */ |
237 | - $container['cms/event/manager'] = function (Container $container) { |
|
237 | + $container['cms/event/manager'] = function(Container $container) { |
|
238 | 238 | |
239 | 239 | $eventManager = new EventManager([ |
240 | 240 | 'loader' => $container['model/collection/loader'], |
@@ -31,7 +31,7 @@ |
||
31 | 31 | { |
32 | 32 | parent::__construct($data); |
33 | 33 | |
34 | - if (is_callable([ $this, 'defaultData' ])) { |
|
34 | + if (is_callable([$this, 'defaultData'])) { |
|
35 | 35 | $this->setData($this->defaultData()); |
36 | 36 | } |
37 | 37 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $now = new DateTime(); |
56 | 56 | $loader = $this->all(); |
57 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
57 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
58 | 58 | ->addOrder('start_date', 'asc'); |
59 | 59 | |
60 | 60 | return $loader; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $date = $this->parseAsDate($date); |
97 | 97 | $loader = $this->published(); |
98 | - $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
98 | + $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), ['operator' => '>=']); |
|
99 | 99 | |
100 | 100 | return $loader; |
101 | 101 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | $date = $this->parseAsDate($date); |
113 | 113 | $loader = $this->published(); |
114 | - $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), [ 'operator' => '<' ]); |
|
114 | + $loader->addFilter('end_date', $date->format('Y-m-d H:i:s'), ['operator' => '<']); |
|
115 | 115 | |
116 | 116 | return $loader; |
117 | 117 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | { |
48 | 48 | $now = new DateTime(); |
49 | 49 | $loader = $this->all(); |
50 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
51 | - ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '>=' ]); |
|
50 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
51 | + ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), ['operator' => '>=']); |
|
52 | 52 | |
53 | 53 | return $loader; |
54 | 54 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | { |
61 | 61 | $now = new DateTime(); |
62 | 62 | $loader = $this->all(); |
63 | - $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]) |
|
64 | - ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), [ 'operator' => '<=' ]); |
|
63 | + $loader->addFilter('publish_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']) |
|
64 | + ->addFilter('expiry_date', $now->format('Y-m-d H:i:s'), ['operator' => '<=']); |
|
65 | 65 | |
66 | 66 | return $loader; |
67 | 67 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | if ($this->category()) { |
219 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
219 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | if ($this->numPerPage()) { |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | |
322 | 322 | $ids = explode(',', $ids); |
323 | 323 | |
324 | - $loader->addFilter('id', $ids, [ 'operator' => 'in' ]) |
|
325 | - ->addOrder('id', 'values', [ 'values' => $ids ]); |
|
324 | + $loader->addFilter('id', $ids, ['operator' => 'in']) |
|
325 | + ->addOrder('id', 'values', ['values' => $ids]); |
|
326 | 326 | |
327 | 327 | if (count($options) > 0) { |
328 | 328 | foreach ($options as $key => $option) { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $loader = $this->loader()->archive(); |
370 | 370 | |
371 | 371 | if ($this->category()) { |
372 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
372 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
373 | 373 | } |
374 | 374 | if ($this->numPerPage()) { |
375 | 375 | $loader->setPage($this->page()); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $loader->addOrder('news_date', 'desc'); |
123 | 123 | |
124 | 124 | if ($this->category()) { |
125 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
125 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
126 | 126 | } |
127 | 127 | if ($this->numPerPage()) { |
128 | 128 | $loader->setPage($this->page()); |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | |
224 | 224 | $ids = explode(',', $ids); |
225 | 225 | |
226 | - $loader->addFilter('id', $ids, [ 'operator' => 'in' ]) |
|
227 | - ->addOrder('id', 'values', [ 'values' => $ids ]); |
|
226 | + $loader->addFilter('id', $ids, ['operator' => 'in']) |
|
227 | + ->addOrder('id', 'values', ['values' => $ids]); |
|
228 | 228 | |
229 | 229 | if (count($options) > 0) { |
230 | 230 | foreach ($options as $key => $option) { |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $loader->addOrder('news_date', 'desc'); |
273 | 273 | |
274 | 274 | if ($this->category()) { |
275 | - $loader->addFilter('category', $this->category(), [ 'operator' => 'in' ]); |
|
275 | + $loader->addFilter('category', $this->category(), ['operator' => 'in']); |
|
276 | 276 | } |
277 | 277 | if ($this->numPerPage()) { |
278 | 278 | $loader->setPage($this->page()); |