Test Failed
Push — master ( 34c614...ede9b5 )
by Dawid
05:49
created

SchemaException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 25
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Igni\Storage\Exception;
4
5
class SchemaException extends MappingException
6
{
7
    public static function forInvalidEntityClass(string $type): SchemaException
8
    {
9
        return new self("Cannot initialize schema for the class ${type}. ${type} must be instance of Entity class.");
10
    }
11
12
    public static function forMissingSchema(string $entity): SchemaException
13
    {
14
        return new self("There is no schema defined for ${entity}.");
15
    }
16
17
    public static function forSchemaMutation(): SchemaException
18
    {
19
        return new self('Schema is read only.');
20
    }
21
22
    public static function forEmptySchemaDefinition(): SchemaException
23
    {
24
        return new self('Schema defines no properties, have you forgot to use Schema::property() method.');
25
    }
26
27
    public static function forUndefinedSource(): SchemaException
28
    {
29
        return new self('Schema defines no source, thus entity can be persisted only as embed entity.');
30
    }
31
}
32