GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f70c68...43c393 )
by Amr
05:56
created

Friendship::scopeBetweenUsers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 6
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 10
ccs 6
cts 6
cp 1
crap 1
rs 9.4285
1
<?php
2
3
namespace Merodiro\Friendships;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Friendship extends Model
8
{
9
    protected $fillable = ['requester', 'user_requested', 'status'];
10
11 32
    public function scopeWhereSender($query, $model)
12
    {
13 32
        return $query->where('requester', $model->getKey());
14
    }
15
16 32
    public function scopeWhereRecipient($query, $model)
17
    {
18 32
        return $query->where('user_requested', $model->getKey());
19
    }
20
21 20
    public function scopeAccepted($query, $val)
22
    {
23 20
        return $query->where('status', $val);
24
    }
25
26
    public function scopeBetweenUsers($query, $sender, $recipient)
27
    {
28
        $query->where(function ($queryIn) use ($sender, $recipient) {
29 30
            $queryIn->where(function ($q) use ($sender, $recipient) {
30 30
                $q->whereSender($sender)->whereRecipient($recipient);
31
            })->orWhere(function ($q) use ($sender, $recipient) {
32 30
                $q->whereSender($recipient)->whereRecipient($sender);
33 30
            });
34 30
        });
35 30
    }
36
}
37