Passed
Push — main ( 3f5d4e...df4575 )
by James Ekow Abaka
01:53
created

Yentu::setup()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
namespace yentu;
3
4
use yentu\factories\DatabaseItemFactory;
5
use yentu\database\ItemType;
6
use yentu\database\Schema;
7
8
class Yentu
9
{
10
    private static DatabaseItemFactory $factory;
11
    private static Schema $defaultSchema;
12
    
13
    public static function setup(DatabaseItemFactory $factory, string $defaultSchema)
14
    {
15
        self::$defaultSchema = $factory->create(ItemType::Schema, $defaultSchema);
16
        self::$factory = $factory;
17
    }
18
    
19
    public static function begin() {
20
        return self::$factory->create(ItemType::Begin, self::$defaultSchema);
21
    }
22
23
    public static function refschema($name) {
24
        $schema = self::$factory->create(ItemType::Schema, $name);
25
        $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

25
        $schema->/** @scrutinizer ignore-call */ 
26
                 setIsReference(true);
Loading history...
26
        return $schema;
27
    }
28
29
    public static function reftable($name) {
30
        $table = self::$factory->create(ItemType::Table, $name, self::$defaultSchema);
31
        $table->setIsReference(true);
32
        return $table;
33
    }
34
}
35
36