Code Duplication    Length = 80-80 lines in 3 locations

src/Adaptors/Generic/PassportServerIntegration.php 1 location

@@ 31-110 (lines=80) @@
28
/**
29
 * @package Limoncello\Passport
30
 */
31
class PassportServerIntegration extends BasePassportServerIntegration
32
{
33
    /**
34
     * @var ClientRepositoryInterface|null
35
     */
36
    private $clientRepo;
37
38
    /**
39
     * @var TokenRepositoryInterface|null
40
     */
41
    private $tokenRepo;
42
43
    /**
44
     * @var ScopeRepositoryInterface|null
45
     */
46
    private $scopeRepo;
47
48
    /**
49
     * @var RedirectUriRepositoryInterface|null
50
     */
51
    private $uriRepo;
52
53
    /**
54
     * @inheritdoc
55
     */
56
    public function getClientRepository(): ClientRepositoryInterface
57
    {
58
        if ($this->clientRepo === null) {
59
            $this->clientRepo = new ClientRepository($this->getConnection(), $this->getDatabaseSchema());
60
        }
61
62
        return $this->clientRepo;
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function getScopeRepository(): ScopeRepositoryInterface
69
    {
70
        if ($this->scopeRepo === null) {
71
            $this->scopeRepo = new ScopeRepository($this->getConnection(), $this->getDatabaseSchema());
72
        }
73
74
        return $this->scopeRepo;
75
    }
76
77
    /**
78
     * @inheritdoc
79
     */
80
    public function getRedirectUriRepository(): RedirectUriRepositoryInterface
81
    {
82
        if ($this->uriRepo === null) {
83
            $this->uriRepo = new RedirectUriRepository($this->getConnection(), $this->getDatabaseSchema());
84
        }
85
86
        return $this->uriRepo;
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92
    public function getTokenRepository(): TokenRepositoryInterface
93
    {
94
        if ($this->tokenRepo === null) {
95
            $this->tokenRepo = new TokenRepository($this->getConnection(), $this->getDatabaseSchema());
96
        }
97
98
        return $this->tokenRepo;
99
    }
100
101
    /**
102
     * @inheritdoc
103
     */
104
    public function createTokenInstance(): TokenInterface
105
    {
106
        $token = new Token();
107
108
        return $token;
109
    }
110
}
111

src/Adaptors/MySql/PassportServerIntegration.php 1 location

@@ 31-110 (lines=80) @@
28
/**
29
 * @package Limoncello\Passport
30
 */
31
class PassportServerIntegration extends BasePassportServerIntegration
32
{
33
    /**
34
     * @var ClientRepositoryInterface|null
35
     */
36
    private $clientRepo;
37
38
    /**
39
     * @var TokenRepositoryInterface|null
40
     */
41
    private $tokenRepo;
42
43
    /**
44
     * @var ScopeRepositoryInterface|null
45
     */
46
    private $scopeRepo;
47
48
    /**
49
     * @var RedirectUriRepositoryInterface|null
50
     */
51
    private $uriRepo;
52
53
    /**
54
     * @inheritdoc
55
     */
56
    public function getClientRepository(): ClientRepositoryInterface
57
    {
58
        if ($this->clientRepo === null) {
59
            $this->clientRepo = new ClientRepository($this->getConnection(), $this->getDatabaseSchema());
60
        }
61
62
        return $this->clientRepo;
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function getScopeRepository(): ScopeRepositoryInterface
69
    {
70
        if ($this->scopeRepo === null) {
71
            $this->scopeRepo = new ScopeRepository($this->getConnection(), $this->getDatabaseSchema());
72
        }
73
74
        return $this->scopeRepo;
75
    }
76
77
    /**
78
     * @inheritdoc
79
     */
80
    public function getRedirectUriRepository(): RedirectUriRepositoryInterface
81
    {
82
        if ($this->uriRepo === null) {
83
            $this->uriRepo = new RedirectUriRepository($this->getConnection(), $this->getDatabaseSchema());
84
        }
85
86
        return $this->uriRepo;
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92
    public function getTokenRepository(): TokenRepositoryInterface
93
    {
94
        if ($this->tokenRepo === null) {
95
            $this->tokenRepo = new TokenRepository($this->getConnection(), $this->getDatabaseSchema());
96
        }
97
98
        return $this->tokenRepo;
99
    }
100
101
    /**
102
     * @inheritdoc
103
     */
104
    public function createTokenInstance(): TokenInterface
105
    {
106
        $token = new Token();
107
108
        return $token;
109
    }
110
}
111

src/Adaptors/PostgreSql/PassportServerIntegration.php 1 location

@@ 31-110 (lines=80) @@
28
/**
29
 * @package Limoncello\Passport
30
 */
31
class PassportServerIntegration extends BasePassportServerIntegration
32
{
33
    /**
34
     * @var ClientRepositoryInterface|null
35
     */
36
    private $clientRepo;
37
38
    /**
39
     * @var TokenRepositoryInterface|null
40
     */
41
    private $tokenRepo;
42
43
    /**
44
     * @var ScopeRepositoryInterface|null
45
     */
46
    private $scopeRepo;
47
48
    /**
49
     * @var RedirectUriRepositoryInterface|null
50
     */
51
    private $uriRepo;
52
53
    /**
54
     * @inheritdoc
55
     */
56
    public function getClientRepository(): ClientRepositoryInterface
57
    {
58
        if ($this->clientRepo === null) {
59
            $this->clientRepo = new ClientRepository($this->getConnection(), $this->getDatabaseSchema());
60
        }
61
62
        return $this->clientRepo;
63
    }
64
65
    /**
66
     * @inheritdoc
67
     */
68
    public function getScopeRepository(): ScopeRepositoryInterface
69
    {
70
        if ($this->scopeRepo === null) {
71
            $this->scopeRepo = new ScopeRepository($this->getConnection(), $this->getDatabaseSchema());
72
        }
73
74
        return $this->scopeRepo;
75
    }
76
77
    /**
78
     * @inheritdoc
79
     */
80
    public function getRedirectUriRepository(): RedirectUriRepositoryInterface
81
    {
82
        if ($this->uriRepo === null) {
83
            $this->uriRepo = new RedirectUriRepository($this->getConnection(), $this->getDatabaseSchema());
84
        }
85
86
        return $this->uriRepo;
87
    }
88
89
    /**
90
     * @inheritdoc
91
     */
92
    public function getTokenRepository(): TokenRepositoryInterface
93
    {
94
        if ($this->tokenRepo === null) {
95
            $this->tokenRepo = new TokenRepository($this->getConnection(), $this->getDatabaseSchema());
96
        }
97
98
        return $this->tokenRepo;
99
    }
100
101
    /**
102
     * @inheritdoc
103
     */
104
    public function createTokenInstance(): TokenInterface
105
    {
106
        $token = new Token();
107
108
        return $token;
109
    }
110
}
111