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 ( d9d5ed...b105dd )
by Ryun
03:15 queued 30s
created

SocialConnection::scopeOfProvider()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 2
eloc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Humweb\Sociable\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Class SocialAuth
9
 *
10
 * @package Humweb\SociableConnection\Models
11
 */
12
class SocialConnection extends Model
13
{
14
15
    protected $table = 'social_connections';
16
17
    protected $fillable = ['provider', 'user_id', 'social_id', 'oauth_version', 'data'];
18
19
    protected $casts = [
20
        'data' => 'json'
21
    ];
22
23
    /**
24
     * The users model name.
25
     *
26
     * @var string
27
     */
28
    protected static $userModel = 'LGL\Core\Auth\Users\EloquentUser';
29
30
31 3
    public function user()
32
    {
33 3
        return $this->belongsTo(static::$userModel, 'user_id');
34
    }
35
36
37 3
    public function scopeOfProvider($query, $provider)
38
    {
39 3
        return is_array($provider) ? $query->whereIn('provider', $provider) : $query->where('provider', $provider);
40
    }
41
42
43 3
    public function scopeOfProviderId($query, $socialId)
44
    {
45 3
        return is_array($socialId) ? $query->whereIn('social_id', $socialId) : $query->where('social_id', $socialId);
46
    }
47
48
49 3
    public function scopeOfCredentials($query, $provider, $socialId)
50
    {
51 3
        return $query->where('provider', $provider)->where('social_id', $socialId);
52
    }
53
54
55 3
    public function getUser()
56
    {
57 3
        return $this->user;
0 ignored issues
show
Documentation introduced by
The property user does not exist on object<Humweb\Sociable\Models\SocialConnection>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
58
    }
59
60
61
    /**
62
     * @param $user
63
     */
64 3
    public function setUser($user)
65
    {
66 3
        $this->user()->associate($user);
67
68 3
        $this->save();
69 3
    }
70
71
72
    /**
73
     * Get the users model.
74
     *
75
     * @return string
76
     */
77 3
    public static function getUsersModel()
78
    {
79 3
        return static::$userModel;
80
    }
81
82
83
    /**
84
     * Set the users model.
85
     *
86
     * @param  string $usersModel
87
     *
88
     * @return void
89
     */
90 27
    public static function setUsersModel($usersModel)
91
    {
92 27
        static::$userModel = $usersModel;
93 27
    }
94
95
}