Completed
Push — master ( 91fdab...75a7b9 )
by
unknown
13:37
created

AdminBundle/Controller/SettingsController.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
7
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
8
9
/**
10
 * Main settings controller
11
 */
12
class SettingsController extends BaseSettingsController
13
{
14
    /**
15
     * Index page for the settings
16
     *
17
     * @Route("/", name="KunstmaanAdminBundle_settings")
18
     * @Template()
19
     *
20
     * @throws AccessDeniedException
21
     * @return array
22
     */
23
    public function indexAction()
24
    {
25
        $this->denyAccessUnlessGranted('ROLE_ADMIN');
26
27
        return array();
28
    }
29
30
    /**
31
     * Show bundles version update information
32
     *
33
     * @Route("/bundle-version", name="KunstmaanAdminBundle_settings_bundle_version")
34
     * @Template("KunstmaanAdminBundle:Settings:bundleVersion.html.twig")
35
     *
36
     * @throws AccessDeniedException
37
     * @return array
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,null>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
38
     */
39
    public function bundleVersionAction()
40
    {
41
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');
42
43
        $versionChecker = $this->container->get('kunstmaan_admin.versionchecker');
44
        if (!$versionChecker->isEnabled()) {
45
            return array('data' => null);
46
        }
47
48
        $data = null;
49
        try {
50
            $data = $versionChecker->check();
51
        } catch (\Exception $e) {
52
            $this->container->get('logger')->error(
53
                $e->getMessage(),
54
                array('exception' => $e)
55
            );
56
        }
57
58
        return array(
59
            'data' => $data
60
        );
61
    }
62
}
63