Code Duplication    Length = 8-8 lines in 3 locations

src/Repositories/ClientRepository.php 1 location

@@ 63-70 (lines=8) @@
60
        ];
61
62
        $identifier = $client->getIdentifier();
63
        if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) {
64
            $this->createResource($values);
65
        } else {
66
            $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) {
67
                $this->createResource($values);
68
                $this->bindScopeIdentifiers($identifier, $scopeIdentifiers);
69
            });
70
        }
71
        $client->setCreatedAt($now);
72
73
        return $client;

src/Repositories/TokenRepository.php 2 locations

@@ 52-59 (lines=8) @@
49
        ];
50
51
        $tokenIdentifier = null;
52
        if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) {
53
            $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
54
                $tokenIdentifier = $this->createResource($values);
55
                $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
56
            });
57
        } else {
58
            $tokenIdentifier = $this->createResource($values);
59
        }
60
61
        $code->setIdentifier($tokenIdentifier)->setCodeCreatedAt($now);
62
@@ 128-135 (lines=8) @@
125
        ];
126
127
        $tokenIdentifier = null;
128
        if (empty($scopeIdentifiers = $token->getScopeIdentifiers()) === false) {
129
            $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
130
                $tokenIdentifier = $this->createResource($values);
131
                $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
132
            });
133
        } else {
134
            $tokenIdentifier = $this->createResource($values);
135
        }
136
137
        $token->setIdentifier($tokenIdentifier)->setValueCreatedAt($now);
138
        if ($hasRefresh === true) {