Completed
Push — master ( 0dd64c...9ed0b2 )
by Adam
08:02 queued 02:35
created

NewsBoxController::getNewsRequestStorage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * WellCommerce Open-Source E-Commerce Platform
4
 *
5
 * This file is part of the WellCommerce package.
6
 *
7
 * (c) Adam Piotrowski <[email protected]>
8
 *
9
 * For the full copyright and license information,
10
 * please view the LICENSE file that was distributed with this source code.
11
 */
12
13
namespace WellCommerce\Bundle\CmsBundle\Controller\Box;
14
15
use Symfony\Component\HttpFoundation\Response;
16
use WellCommerce\Bundle\CmsBundle\Request\NewsRequestStorage;
17
use WellCommerce\Bundle\CoreBundle\Controller\Box\AbstractBoxController;
18
use WellCommerce\Component\Layout\Collection\LayoutBoxSettingsCollection;
19
20
/**
21
 * Class NewsBoxController
22
 *
23
 * @author  Adam Piotrowski <[email protected]>
24
 */
25
class NewsBoxController extends AbstractBoxController
26
{
27
    public function indexAction(LayoutBoxSettingsCollection $boxSettings): Response
28
    {
29
        $news = $this->getNewsRequestStorage()->getCurrentNews();
30
31
        return $this->displayTemplate('index', [
32
            'news'        => $news,
33
            'boxSettings' => $boxSettings,
34
        ]);
35
    }
36
37
    private function getNewsRequestStorage(): NewsRequestStorage
38
    {
39
        /** @var $newsRequestStorage NewsRequestStorage  */
40
41
        $newsRequestStorage = $this->get('news.request.storage');
42
        return $newsRequestStorage;
43
    }
44
}
45