Passed
Pull Request — master (#9)
by Daniel
03:07
created

DevAuthenticator   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 9
c 2
b 0
f 1
dl 0
loc 52
rs 10
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A supports() 0 3 1
A onAuthenticationFailure() 0 2 1
A supportsRememberMe() 0 3 1
A getCredentials() 0 4 1
A start() 0 2 1
A checkCredentials() 0 3 1
A getUser() 0 3 1
A onAuthenticationSuccess() 0 2 1
1
<?php
2
3
namespace CodeCloud\Bundle\ShopifyBundle\Security;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...on\Token\TokenInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Symfony\Component\Security\Core\Exception\AuthenticationException;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...AuthenticationException was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Symfony\Component\Security\Core\User\UserInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Security\Core\User\UserInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Symfony\Component\Security\Core\User\UserProviderInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...r\UserProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Symfony\Component\Security\Guard\AbstractGuardAuthenticator;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Securi...tractGuardAuthenticator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
12
class DevAuthenticator extends AbstractGuardAuthenticator
13
{
14
    /**
15
     * @var string
16
     */
17
    private $storeName;
18
19
    /**
20
     * @param string $storeName
21
     */
22
    public function __construct($storeName)
23
    {
24
        $this->storeName = $storeName;
25
    }
26
27
    public function supports(Request $request)
28
    {
29
        return true;
30
    }
31
32
    public function getCredentials(Request $request)
33
    {
34
        return [
35
            'shop' => $this->storeName,
36
        ];
37
    }
38
39
    public function getUser($credentials, UserProviderInterface $userProvider)
40
    {
41
        return $userProvider->loadUserByUsername($credentials['shop']);
42
    }
43
44
    public function checkCredentials($credentials, UserInterface $user)
45
    {
46
        return true;
47
    }
48
49
    public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
50
    {
51
    }
52
53
    public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey)
54
    {
55
    }
56
57
    public function supportsRememberMe()
58
    {
59
        return false;
60
    }
61
62
    public function start(Request $request, AuthenticationException $authException = null)
63
    {
64
    }
65
}
66