Completed
Pull Request — master (#4)
by
unknown
09:38 queued 20s
created

PhiberException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 31
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 6 1
1
<?php
2
/**
3
 * Copyright (c) 2017. Este código foi feito por @marciioluucas, sob licença MIT
4
 */
5
6
namespace Phiber\ORM\Exceptions;
7
8
use Exception;
9
use Phiber\Util\Internationalization;
10
11
/**
12
 * Classe reponsável por fazer as exceções personalizadas.
13
 * @package bin
14
 */
15
class PhiberException extends Exception
16
{
17
    /**
18
     * Referencia da mensagem a ser traduzida.
19
     * 
20
     * @var string
21
     */
22
    private $msgTranslateRef;
23
24
    /**
25
     * PhiberException constructor.
26
     * 
27
     * @param string $msgTranslateRef
28
     */
29
    public function __construct($msgTranslateRef)
30
    {
31
        $this->msgTranslateRef = $msgTranslateRef;
32
    }
33
34
    /**
35
     * Retorna a exceção personalizada, sobrescrevendo o metodo __toString
36
     * 
37
     * @return string
38
     */
39
    public function __toString()
40
    {
41
        return strtoupper(new Internationalization('phiber_exception')) .
42
            ": " . new Internationalization('line') . ": " . $this->getLine() . " " .
43
            new Internationalization('message') . ": " . new Internationalization($this->msgTranslateRef);
44
    }
45
}