Code Duplication    Length = 80-80 lines in 3 locations

src/Adaptors/Generic/PassportServerIntegration.php 1 location

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

src/Adaptors/MySql/PassportServerIntegration.php 1 location

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

src/Adaptors/PostgreSql/PassportServerIntegration.php 1 location

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