CheckMailService::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 2
dl 7
loc 7
ccs 0
cts 7
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Laravel Platfourm package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\Platfourm\Auth\Services;
12
13
use App\Contracts\Services\Auth\AuthUserService as AuthUserServiceContract;
14
use App\Exceptions\RepositoryNotFoundException;
15
use App\Repositories\Identity\UserRepository;
16
use App\Repositories\Repository;
17
use App\Services\EntityService;
18
use App\Services\ServiceDispatcher;
19
20 View Code Duplication
class CheckMailService extends EntityService
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
21
{
22
    protected $repository;
23
    protected $authUserService;
24
25
    public function __construct(
26
        AuthUserServiceContract $authUserService,
27
        UserRepository $repository
28
    ) {
29
        $this->authUserService = $authUserService;
30
        $this->repository      = $repository;
31
    }
32
33
    public function run($mail)
34
    {
35
        if (!($this->repository instanceof Repository)) {
0 ignored issues
show
Bug introduced by
The class App\Repositories\Repository does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
36
            throw new RepositoryNotFoundException;
37
        }
38
39
        $item = $this->repository->findBy('email', $mail);
40
41
        return $item;
42
    }
43
}
44