Begin   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 39
rs 10
c 2
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A schema() 0 3 1
A getName() 0 3 1
A table() 0 3 1
A view() 0 3 1
A query() 0 3 1
A end() 0 3 1
A __construct() 0 3 1
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