Completed
Push — master ( 025b7c...446b98 )
by
unknown
20:28
created

LoadController::angularAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
namespace Aoe\Imgix\Controller;
3
4
use Aoe\Imgix\TYPO3\Configuration;
5
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
6
7
class LoadController extends ActionController
8
{
9
    /**
10
     * @var Configuration
11
     */
12
    private $configuration;
13
14
    /**
15
     * @param Configuration $configuration
16
     */
17
    public function __construct(Configuration $configuration)
18
    {
19
        $this->configuration = $configuration;
20
        parent::__construct();
21
    }
22
23
    public function jqueryAction()
24
    {
25
        $this->view->assign('enabled', $this->configuration->isEnabled());
26
        $this->view->assign('options', $this->getOptionsAsJson());
27
    }
28
29
    public function angularAction()
30
    {
31
        $this->view->assign('enabled', $this->configuration->isEnabled());
32
        $this->view->assign('options', $this->getOptionsAsJson());
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    private function getOptionsAsJson()
39
    {
40
        $options = [
41
            'host' => $this->configuration->getHost(),
42
            'enableFluid' => $this->configuration->isFluidEnabled(),
43
            'enableObservation' => $this->configuration->isObservationEnabled(),
44
            'imgix' => $this->configuration->getImgixFluidOptions(),
45
        ];
46
        return json_encode($options, JSON_FORCE_OBJECT);
47
    }
48
}
49