Completed
Push — master ( 5aa8b4...39ef33 )
by Arman
20s queued 16s
created

ServiceException::notServiceInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.7
13
 */
14
15
namespace Quantum\Service\Exceptions;
16
17
use Quantum\Exceptions\BaseException;
18
19
/**
20
 * Class ServiceException
21
 * @package Quantum\Service
22
 */
23
class ServiceException extends BaseException
24
{
25
    /**
26
     * @param string $name
27
     * @return ServiceException
28
     */
29
    public static function serviceNotFound(string $name): ServiceException
30
    {
31
        return new static(t('service_not_found', $name), E_ERROR);
32
    }
33
34
    /**
35
     * @param array $names
36
     * @return ServiceException
37
     */
38
    public static function notServiceInstance(array $names): ServiceException
39
    {
40
        return new static(t('not_instance_of_service', $names), E_ERROR);
41
    }
42
43
    /**
44
     * @param string $name
45
     * @return ServiceException
46
     */
47
    public static function undefinedMethod(string $name): ServiceException
48
    {
49
        return new static(t('exception.undefined_method', $name), E_ERROR);
50
    }
51
}