Code Duplication    Length = 17-21 lines in 3 locations

src/Repositories/RedirectUriRepository.php 1 location

@@ 108-125 (lines=18) @@
105
     *
106
     * @throws RepositoryException
107
     */
108
    public function update(RedirectUriInterface $redirectUri): void
109
    {
110
        try {
111
            $now    = $this->ignoreException(function (): DateTimeImmutable {
112
                return new DateTimeImmutable();
113
            });
114
            $schema = $this->getDatabaseSchema();
115
            $this->updateResource($redirectUri->getIdentifier(), [
116
                $schema->getRedirectUrisClientIdentityColumn() => $redirectUri->getClientIdentifier(),
117
                $schema->getRedirectUrisValueColumn()          => $redirectUri->getValue(),
118
                $schema->getRedirectUrisUpdatedAtColumn()      => $now,
119
            ]);
120
            $redirectUri->setUpdatedAt($now);
121
        } catch (RepositoryException $exception) {
122
            $message = 'Client redirect URI update failed.';
123
            throw new RepositoryException($message, 0, $exception);
124
        }
125
    }
126
127
    /**
128
     * @inheritdoc

src/Repositories/ScopeRepository.php 2 locations

@@ 51-71 (lines=21) @@
48
     *
49
     * @throws RepositoryException
50
     */
51
    public function create(ScopeInterface $scope): ScopeInterface
52
    {
53
        try {
54
            $now    = $this->ignoreException(function (): DateTimeImmutable {
55
                return new DateTimeImmutable();
56
            });
57
            $schema = $this->getDatabaseSchema();
58
            $this->createResource([
59
                $schema->getScopesIdentityColumn()    => $scope->getIdentifier(),
60
                $schema->getScopesDescriptionColumn() => $scope->getDescription(),
61
                $schema->getScopesCreatedAtColumn()   => $now,
62
            ]);
63
64
            $scope->setCreatedAt($now);
65
66
            return $scope;
67
        } catch (RepositoryException $exception) {
68
            $message = 'Scope creation failed.';
69
            throw new RepositoryException($message, 0, $exception);
70
        }
71
    }
72
73
    /**
74
     * @inheritdoc
@@ 93-109 (lines=17) @@
90
     *
91
     * @throws RepositoryException
92
     */
93
    public function update(ScopeInterface $scope): void
94
    {
95
        try {
96
            $now    = $this->ignoreException(function (): DateTimeImmutable {
97
                return new DateTimeImmutable();
98
            });
99
            $schema = $this->getDatabaseSchema();
100
            $this->updateResource($scope->getIdentifier(), [
101
                $schema->getScopesDescriptionColumn() => $scope->getDescription(),
102
                $schema->getScopesUpdatedAtColumn()   => $now,
103
            ]);
104
            $scope->setUpdatedAt($now);
105
        } catch (RepositoryException $exception) {
106
            $message = 'Scope update failed.';
107
            throw new RepositoryException($message, 0, $exception);
108
        }
109
    }
110
111
    /**
112
     * @inheritdoc