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

Yentu   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 8
Bugs 0 Features 0
Metric Value
eloc 12
c 8
b 0
f 0
dl 0
loc 25
rs 10
wmc 4

4 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
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