Completed
Push — master ( 727f83...413b1b )
by Mahmoud
06:06
created

FindSocialUserTask   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 32
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 7 1
1
<?php
2
3
namespace App\Containers\User\Tasks;
4
5
use App\Containers\Authentication\Exceptions\MissingSocialIdException;
6
use App\Containers\User\Contracts\UserRepositoryInterface;
7
use App\Port\Task\Abstracts\Task;
8
9
/**
10
 * Class FindSocialUserTask.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class FindSocialUserTask extends Task
15
{
16
17
    /**
18
     * @var \App\Containers\User\Contracts\UserRepositoryInterface
19
     */
20
    private $userRepository;
21
22
    /**
23
     * FindUserBySocialIdTask constructor.
24
     *
25
     * @param \App\Containers\User\Contracts\UserRepositoryInterface $userRepository
26
     */
27
    public function __construct(UserRepositoryInterface $userRepository)
28
    {
29
        $this->userRepository = $userRepository;
30
    }
31
32
    /**
33
     * @param $socialId
34
     *
35
     * @return  mixed
36
     */
37
    public function run($socialProvider, $socialId)
38
    {
39
        return $this->userRepository->findWhere([
40
            'social_provider' => $socialProvider,
41
            'social_id'       => $socialId,
42
        ])->first();
43
    }
44
45
}
46