MappingException::classNotFound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
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 invalidMapping($className, $fileName)
64
    {
65
        return new static(sprintf(
66
            'Invalid mapping file %s for class %s.',
67
            $fileName,
68
            $className
69
        ));
70
    }
71
}
72