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

SchemaException::forInvalidEntityClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
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