Completed
Push — master ( 7888fa...8e3a44 )
by Ivannis Suárez
04:39
created

MappingException::invalidMappingFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Metadata\Exception;
13
14
use RuntimeException;
15
16
/**
17
 * MappingException class.
18
 *
19
 * @author Ivannis Suárez Jerez <[email protected]>
20
 */
21
class MappingException extends RuntimeException
22
{
23
    /**
24
     * @return MappingException
25
     */
26
    public static function pathRequired()
27
    {
28
        return new static('The paths is required to retrieve all class names.');
29
    }
30
31
    /**
32
     * @param string $path
33
     *
34
     * @return MappingException
35
     */
36
    public static function invalidDirectory($path)
37
    {
38
        return new static(sprintf(
39
            'The given path %s must have a valid directory.',
40
            $path
41
        ));
42
    }
43
44
    /**
45
     * @param string $className
46
     *
47
     * @return MappingException
48
     */
49
    public static function classNotFound($className)
50
    {
51
        return new static(sprintf(
52
            'The class %s was not found in the chain configured drivers.',
53
            $className
54
        ));
55
    }
56
57
    /**
58
     * @param string $className
59
     * @param string $fileName
60
     *
61
     * @return MappingException
62
     */
63
    public static function mappingNotFound($className, $fileName)
64
    {
65
        return new static(sprintf(
66
            'No mapping found for class %s in file %s.',
67
            $className,
68
            $fileName
69
        ));
70
    }
71
72
    /**
73
     * @param string $className
74
     * @param string $fileName
75
     *
76
     * @return MappingException
77
     */
78
    public static function invalidMapping($className, $fileName)
79
    {
80
        return new static(sprintf(
81
            'Invalid mapping for class %s in file %s.',
82
            $className,
83
            $fileName
84
        ));
85
    }
86
}
87