FacebookConnectController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A connectAction() 0 4 1
A returnAction() 0 4 1
A __construct() 0 12 1
1
<?php
2
3
namespace ControleOnline\Controller\Oauth\Facebook;
4
5
use ControleOnline\Controller\Oauth\DefaultClientController;
6
use ControleOnline\Service\DomainService;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Service\DomainService 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 ControleOnline\Service\UserService;
8
use Doctrine\ORM\EntityManagerInterface;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\EntityManagerInterface 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\HttpFoundation\Request;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\Request 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\Routing\Attribute\Route;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Routing\Attribute\Route 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
use Symfony\Component\HttpFoundation\JsonResponse;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\HttpFoundation\JsonResponse 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...
12
use League\OAuth2\Client\Provider\Facebook;
0 ignored issues
show
Bug introduced by
The type League\OAuth2\Client\Provider\Facebook 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...
13
14
class FacebookConnectController extends DefaultClientController
15
{
16
    public function __construct(
17
        protected EntityManagerInterface $manager,
18
        protected UserService $userService,
19
        private DomainService $domainService
20
    ) {
21
        $this->clientId       = $_ENV['OAUTH_FACEBOOK_CLIENT_ID'];
22
        $this->clientSecret   = $_ENV['OAUTH_FACEBOOK_CLIENT_SECRET'];
23
24
        $this->provider = new Facebook([
25
            'clientId'     => $this->clientId,
26
            'clientSecret' => $this->clientSecret,
27
            'redirectUri'  => 'https://' . $this->domainService->getMainDomain() . '/oauth/facebook/return',
28
        ]);
29
    }
30
31
    #[Route('/oauth/facebook/connect', name: 'connect_facebook_start')]
32
    public function connectAction()
33
    {
34
        return parent::connectAction();
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::connectAction() targeting ControleOnline\Controlle...roller::connectAction() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
35
    }
36
37
    #[Route('/oauth/facebook/return', name: 'connect_facebook_return', methods: ['GET', 'POST'])]
38
    public function returnAction(Request $request): JsonResponse
39
    {
40
        return parent::returnAction($request);
41
    }
42
}