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

Yentu   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 8
Bugs 0 Features 0
Metric Value
eloc 14
c 8
b 0
f 0
dl 0
loc 31
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A begin() 0 2 1
A refschema() 0 4 1
A setup() 0 4 1
A reftable() 0 4 1
A setStack() 0 3 1
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