Passed
Push — main ( 491aa8...6a8c3e )
by James Ekow Abaka
01:50
created

Begin::buildDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
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;
12
13
    public function __construct(Schema $defaultSchema, EncapsulatedStack $encapsulatedStack)
14
    {
15
        $this->defaultSchema = $defaultSchema;
16
        $this->encapsulatedStack = $encapsulatedStack;
17
    }
18
19
    public function table(string $name): Table
20
    {
21
        return $this->factory->create(ItemType::Table, $name, $this);
1 ignored issue
show
Bug Best Practice introduced by
The expression return $this->factory->c...e::Table, $name, $this) returns the type yentu\database\DatabaseItem which includes types incompatible with the type-hinted return yentu\database\Table.
Loading history...
22
    }
23
24
    public function schema(string $name): Schema
25
    {
26
        return $this->create('schema', $name, $this);
0 ignored issues
show
Bug introduced by
The method create() does not exist on yentu\database\Begin. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

26
        return $this->/** @scrutinizer ignore-call */ create('schema', $name, $this);
Loading history...
27
    }
28
29
    public function view(string $name): View
30
    {
31
        return $this->create('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->encapsulatedStack->purge();
42
    }
43
44
    public function query(string $query, $bindData = array()): Query
45
    {
46
        return $this->create('query', $query, $bindData);
47
    }
48
49
    #[\Override]
50
    public function init()
51
    {
52
        
53
    }
54
}
55