ScopeRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Limoncello\Passport\Adaptors\MySql;
4
5
/**
6
 * Copyright 2015-2019 [email protected]
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
use Doctrine\DBAL\Connection;
22
use Limoncello\Passport\Contracts\Entities\DatabaseSchemaInterface;
23
24
/**
25
 * @package Limoncello\Passport
26
 */
27 View Code Duplication
class ScopeRepository extends \Limoncello\Passport\Repositories\ScopeRepository
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
28
{
29
    /**
30
     * @var string
31
     */
32
    private $modelClass;
33
34
    /**
35
     * @param Connection              $connection
36
     * @param DatabaseSchemaInterface $databaseSchema
37
     * @param string                  $modelClass
38
     */
39 2
    public function __construct(
40
        Connection $connection,
41
        DatabaseSchemaInterface $databaseSchema,
42
        string $modelClass = Scope::class
43
    ) {
44 2
        $this->setConnection($connection)->setDatabaseSchema($databaseSchema);
45 2
        $this->modelClass = $modelClass;
46
    }
47
48
    /**
49
     * @inheritdoc
50
     */
51 1
    protected function getClassName(): string
52
    {
53 1
        return $this->modelClass;
54
    }
55
56
    /**
57
     * @inheritdoc
58
     */
59 1
    protected function getTableNameForReading(): string
60
    {
61 1
        return $this->getTableNameForWriting();
62
    }
63
}
64