Passed
Push — main ( c93099...0e69d1 )
by James Ekow Abaka
17:15
created

Begin::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace yentu\database;
4
5
use yentu\database\ItemType;
6
7
8
class Begin extends DatabaseItem
9
{
10
    private Schema $defaultSchema;
11
    private EncapsulatedStack $encapsulatedStack;
0 ignored issues
show
introduced by
The private property $encapsulatedStack is not used, and could be removed.
Loading history...
12
13
    public function __construct(Schema $defaultSchema)
14
    {
15
        $this->defaultSchema = $defaultSchema;
16
//        $this->encapsulatedStack = $encapsulatedStack;
17
    }
18
19
    public function table(string $name): DatabaseItem
20
    {
21
        return $this->factory->create(ItemType::Table, $name, $this);
22
    }
23
24
    public function schema(string $name): DatabaseItem
25
    {
26
        return $this->factory->create(ItemType::Schema, $name, $this);
27
    }
28
29
    public function view(string $name): DatabaseItem
30
    {
31
        return $this->factory->create(ItemType::View, $name, $this);
32
    }
33
34
    public function getName(): string
35
    {
36
        return $this->defaultSchema->getName();
37
    }
38
39
    public function end(): void
40
    {
41
        $this->getStack()->purge();
42
    }
43
44
    public function query(string $query, $bindData = array()): DatabaseItem
45
    {
46
        return $this->factory->create(ItemType::Query, $query, $bindData);
47
    }
48
}
49