Completed
Push — master ( ec2395...0dfd17 )
by Sherif
02:09
created

OauthClientRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A revoke() 0 6 1
A unRevoke() 0 4 1
1
<?php namespace App\Modules\OauthClients\Repositories;
2
3
use App\Modules\Core\BaseClasses\BaseRepository;
4
use App\Modules\OauthClients\OauthClient;
5
6
class OauthClientRepository extends BaseRepository
7
{
8
    /**
9
     * Init new object.
10
     *
11
     * @param   OauthClient $model
12
     * @return  void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
13
     */
14
    public function __construct(OauthClient $model)
15
    {
16
        parent::__construct($model);
17
    }
18
19
    /**
20
     * Revoke the given client.
21
     *
22
     * @param  integer  $clientId
23
     * @return void
24
     */
25
    public function revoke($clientId)
26
    {
27
        $client = $this->find($clientId);
28
        $client->tokens()->update(['revoked' => true]);
29
        $this->save(['id'=> $clientId, 'revoked' => true]);
30
    }
31
32
    /**
33
     * Un revoke the given client.
34
     *
35
     * @param  integer  $clientId
36
     * @return void
37
     */
38
    public function unRevoke($clientId)
39
    {
40
        $this->save(['id'=> $clientId, 'revoked' => false]);
41
    }
42
}
43