SocialiteAuthUserCriteria::apply()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yeelight\Repositories\Criteria;
4
5
use Prettus\Repository\Contracts\CriteriaInterface;
6
use Prettus\Repository\Contracts\RepositoryInterface;
7
use Yeelight\Http\Requests\Api\SocialiteAuthRequest;
8
9
/**
10
 * Class SocialiteAuthUserCriteria
11
 *
12
 * @category Yeelight
13
 *
14
 * @package Yeelight\Repositories\Criteria
15
 *
16
 * @author Sheldon Lee <[email protected]>
17
 *
18
 * @license https://opensource.org/licenses/MIT MIT
19
 *
20
 * @link https://www.yeelight.com
21
 */
22
class SocialiteAuthUserCriteria implements CriteriaInterface
23
{
24
    /**
25
     * @var \Illuminate\Http\Request
26
     */
27
    protected $request;
28
29
    public function __construct(SocialiteAuthRequest $request)
30
    {
31
        $this->request = $request;
32
    }
33
34
    public function apply($model, RepositoryInterface $repository)
35
    {
36
        $model = $model
37
            ->where('provider', '=', $this->request->provider)
38
            ->where('provider_user_id', '=', $this->request->provider_user_id);
39
40
        return $model;
41
    }
42
}
43