| Total Complexity | 7 |
| Total Lines | 72 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class Source implements SourceInterface |
||
| 17 | { |
||
| 18 | /** @var DatabaseInterface */ |
||
| 19 | private $database; |
||
| 20 | |||
| 21 | /** @var string */ |
||
| 22 | private $table; |
||
| 23 | |||
| 24 | /** @var ScopeInterface|null */ |
||
| 25 | private $scope = null; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param DatabaseInterface $database |
||
| 29 | * @param string $table |
||
| 30 | */ |
||
| 31 | public function __construct(DatabaseInterface $database, string $table) |
||
| 32 | { |
||
| 33 | $this->database = $database; |
||
| 34 | $this->table = $table; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @inheritdoc |
||
| 39 | */ |
||
| 40 | public function getDatabase(): DatabaseInterface |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @inheritdoc |
||
| 47 | */ |
||
| 48 | public function getTable(): string |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @inheritdoc |
||
| 55 | */ |
||
| 56 | public function withScope(?ScopeInterface $scope): SourceInterface |
||
| 57 | { |
||
| 58 | $source = clone $this; |
||
| 59 | $source->scope = $scope; |
||
| 60 | |||
| 61 | return $source; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @inheritdoc |
||
| 66 | */ |
||
| 67 | public function getScope(): ?ScopeInterface |
||
| 68 | { |
||
| 69 | return $this->scope; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @inheritdoc |
||
| 74 | * @deprecated Use {@see withScope()} instead. |
||
| 75 | */ |
||
| 76 | public function withConstrain(?ConstrainInterface $constrain): SourceInterface |
||
| 77 | { |
||
| 78 | return $this->withScope($constrain); |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @inheritdoc |
||
| 83 | * @deprecated Use {@see getScope()} instead. |
||
| 84 | */ |
||
| 85 | public function getConstrain(): ?ConstrainInterface |
||
| 88 | } |
||
| 89 | } |
||
| 90 |