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

FindSocialUserTask::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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