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.

Issues (4568)

src/Cache/User.php (26 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
namespace BristolSU\ControlDB\Cache;
4
5
use BristolSU\ControlDB\Contracts\Models\User as UserModel;
6
use BristolSU\ControlDB\Contracts\Repositories\User as UserRepositoryContract;
7
use BristolSU\ControlDB\Contracts\Repositories\User as UserRepository;
8
use Illuminate\Contracts\Cache\Repository;
9
use Illuminate\Support\Collection;
10
11
class User implements UserRepository
0 ignored issues
show
Missing doc comment for class User
Loading history...
12
{
13
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
14
     * @var UserRepositoryContract
15
     */
16
    private $userRepository;
0 ignored issues
show
Private member variable "userRepository" must be prefixed with an underscore
Loading history...
17
    /**
0 ignored issues
show
Missing short description in doc comment
Loading history...
18
     * @var Repository
19
     */
20
    private $cache;
0 ignored issues
show
Private member variable "cache" must be prefixed with an underscore
Loading history...
21
22 54
    public function __construct(UserRepositoryContract $userRepository, Repository $cache)
0 ignored issues
show
Missing doc comment for function __construct()
Loading history...
23
    {
24 54
        $this->userRepository = $userRepository;
25 54
        $this->cache = $cache;
26 54
    }
27
28
    /**
29
     * Get a user by ID
30
     *
31
     * @param int $id ID of the user
32
     * @return UserModel
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
33
     */
34 36
    public function getById(int $id): UserModel
35
    {
36
        return $this->cache->rememberForever(static::class . '@getById:' . $id, function() use ($id) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
37 36
            return $this->userRepository->getById($id);
38 36
        });
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
39
    }
40
41
    /**
42
     * Get a user by its data provider ID
43
     *
44
     * @param int $dataProviderId
0 ignored issues
show
Missing parameter comment
Loading history...
45
     * @return UserModel
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
46
     */
47 3
    public function getByDataProviderId(int $dataProviderId): UserModel
48
    {
49
        return $this->cache->rememberForever(static::class . '@getByDataProviderId:' . $dataProviderId, function() use ($dataProviderId) {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
50 3
            return $this->userRepository->getByDataProviderId($dataProviderId);
51 3
        });
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
52
    }
53
54
    /**
55
     * Get all users
56
     *
57
     * @return Collection|UserModel[]
58
     */
59 2
    public function all(): Collection
60
    {
61 2
        return $this->userRepository->all();
62
    }
63
64
    /**
65
     * Create a new user
66
     *
67
     * @param int $dataProviderId
0 ignored issues
show
Missing parameter comment
Loading history...
68
     * @return UserModel
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
69
     */
70 3
    public function create(int $dataProviderId): UserModel
71
    {
72 3
        return $this->userRepository->create($dataProviderId);
73
    }
74
75
    /**
76
     * Delete a user by ID
77
     *
78
     * @param int $id
0 ignored issues
show
Missing parameter comment
Loading history...
79
     */
0 ignored issues
show
Missing @return tag in function comment
Loading history...
80 2
    public function delete(int $id): void
81
    {
82 2
        $this->userRepository->delete($id);
83 2
    }
84
85
    /**
86
     * Paginate through all the users
87
     *
88
     * @param int $page The page number to return
0 ignored issues
show
Expected 4 spaces after parameter name; 1 found
Loading history...
89
     * @param int $perPage The number of results to return per page
90
     *
91
     * @return Collection|UserModel[]
92
     */
93 3
    public function paginate(int $page, int $perPage): Collection
94
    {
95 3
        return $this->userRepository->paginate($page, $perPage);
96
    }
97
98
    /**
99
     * Get the number of users
100
     *
101
     * @return int
102
     */
103 3
    public function count(): int
104
    {
105
        return $this->cache->rememberForever(static::class . '@count', function() {
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
106 3
            return $this->userRepository->count();
107 3
        });
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
108
    }
109
110
    /**
111
     * Update the user model
112
     *
113
     * @param int $id
0 ignored issues
show
Missing parameter comment
Loading history...
114
     * @param int $dataProviderId New data provider ID
115
     * @return UserModel
0 ignored issues
show
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
116
     */
117 2
    public function update(int $id, int $dataProviderId): UserModel
118
    {
119 2
        return $this->userRepository->update($id, $dataProviderId);
120
    }
121
}