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

Yentu::setStack()   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 1
dl 0
loc 3
rs 10
1
<?php
2
namespace yentu;
3
4
use yentu\factories\DatabaseItemFactory;
5
use yentu\database\ItemType;
6
use yentu\database\Schema;
7
use yentu\database\EncapsulatedStack;
8
9
class Yentu
10
{
11
    private static DatabaseItemFactory $factory;
12
    private static Schema $defaultSchema;
13
    private static EncapsulatedStack $stack;
14
    
15
    public static function setup(DatabaseItemFactory $factory, string $defaultSchema)
16
    {
17
        self::$defaultSchema = $factory->create(ItemType::Schema, $defaultSchema);
18
        self::$factory = $factory;
19
    }
20
    
21
    public static function setStack(EncapsulatedStack $stack)
22
    {
23
        self::$stack = $stack;
24
    }
25
    
26
    public static function begin() {
27
        return self::$factory->create(ItemType::Begin, self::$defaultSchema, self::$stack);
28
    }
29
30
    public static function refschema($name) {
31
        $schema = self::$factory->create(ItemType::Schema, $name);
32
        $schema->setIsReference(true);
0 ignored issues
show
Bug introduced by
The method setIsReference() does not exist on yentu\database\DatabaseItem. 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

32
        $schema->/** @scrutinizer ignore-call */ 
33
                 setIsReference(true);
Loading history...
33
        return $schema;
34
    }
35
36
    public static function reftable($name) {
37
        $table = self::$factory->create(ItemType::Table, $name, self::$defaultSchema);
38
        $table->setIsReference(true);
39
        return $table;
40
    }
41
}
42
43