Completed
Push — master ( 798ea2...ca82f2 )
by Steevan
07:09
created

MessageCatalogue   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A has() 0 13 4
1
<?php
2
3
namespace steevanb\DevBundle\Translation;
4
5
use Symfony\Component\Translation\MessageCatalogue as BaseMessageCatalogue;
6
7
/**
8
 * MessageCatalogue.
9
 *
10
 * @author Fabien Potencier <[email protected]>
11
 */
12
class MessageCatalogue extends BaseMessageCatalogue
13
{
14
    /**
15
     * @param string $id
16
     * @param string $domain
17
     * @param bool $allowFallbacks
18
     * @return bool
19
     */
20
    public function has($id, $domain = 'messages', $allowFallbacks = true)
21
    {
22
        $messages = $this->all($domain);
23
        if (isset($messages[$id])) {
24
            return true;
25
        }
26
27
        if ($allowFallbacks && null !== $this->getFallbackCatalogue()) {
28
            return $this->getFallbackCatalogue()->has($id, $domain);
29
        }
30
31
        return false;
32
    }
33
}
34