Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

AdminBundle/Twig/GoogleSignInTwigExtension.php (2 issues)

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\Twig;
4
5
use Twig\Extension\AbstractExtension;
6
use Twig\TwigFunction;
7
8
/**
9
 * Class GoogleSignInTwigExtension
10
 *
11
 * @final since 5.4
12
 */
13
class GoogleSignInTwigExtension extends AbstractExtension
14
{
15
    private $enabled;
16
17
    private $clientId;
18
19
    public function __construct($enabled, $clientId)
20
    {
21
        $this->enabled = $enabled;
22
        $this->clientId = $clientId;
23
    }
24
25
    /**
26
     * Returns a list of functions to add to the existing list.
27
     *
28
     * @return array An array of functions
0 ignored issues
show
Consider making the return type a bit more specific; maybe use TwigFunction[].

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...
29
     */
30
    public function getFunctions()
31
    {
32
        return [
33
            new TwigFunction('google_signin_enabled', [$this, 'isGoogleSignInEnabled']),
34
            new TwigFunction('google_signin_client_id', [$this, 'getClientId']),
35
        ];
36
    }
37
38
    public function isGoogleSignInEnabled()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
39
    {
40
        return $this->enabled;
41
    }
42
43
    /**
44
     * @return mixed
45
     */
46
    public function getClientId()
47
    {
48
        return $this->clientId;
49
    }
50
}
51