GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 6fc5c2...bd52da )
by Andrey
12:38
created

ValidationException   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 40
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getMessages() 0 4 1
A getTranslatedMessages() 0 9 2
1
<?php
2
3
/**
4
 * (c) itmedia.by <[email protected]>
5
 */
6
7
namespace Itmedia\CommandBusBundle\Exception;
8
9
use Symfony\Component\Translation\TranslatorInterface;
10
11
class ValidationException extends \RuntimeException
12
{
13
    protected $messages = [];
14
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function __construct(array $messages, $code = 400, \Exception $previous = null)
19
    {
20
        $this->messages = $messages;
21
        parent::__construct(count($messages) ? reset($this->messages) : '', $code, $previous);
22
    }
23
24
    /**
25
     * @return array
26
     */
27
    public function getMessages()
28
    {
29
        return $this->messages;
30
    }
31
32
33
    /**
34
     * Переведенные сообщения об ошибках
35
     *
36
     * @param TranslatorInterface $translator
37
     * @return array
38
     *
39
     * @throws \Exception
40
     */
41
    public function getTranslatedMessages(TranslatorInterface $translator)
42
    {
43
        $result = [];
44
        foreach ($this->messages as $key => $message) {
45
            $result[$key] = $translator->trans($message);
46
        }
47
48
        return $result;
49
    }
50
}
51