Completed
Push — master ( c2375b...0b658a )
by
unknown
09:35
created

ContactEntityNameProvider::getName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 3
1
<?php
2
3
namespace OroCRM\Bundle\ContactBundle\Provider;
4
5
use Oro\Bundle\LocaleBundle\Provider\EntityNameProvider;
6
7
class ContactEntityNameProvider extends EntityNameProvider
8
{
9
    const CLASS_NAME = 'OroCRM\Bundle\ContactBundle\Entity\Contact';
10
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function getName($format, $locale, $entity)
15
    {
16
        return is_a($entity, static::CLASS_NAME) ? parent::getName($format, $locale, $entity) : false;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression is_a($entity, static::CL...cale, $entity) : false; of type string|false adds false to the return on line 16 which is incompatible with the return type declared by the interface Oro\Bundle\EntityBundle\...viderInterface::getName of type string. It seems like you forgot to handle an error condition.
Loading history...
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function getNameDQL($format, $locale, $className, $alias)
23
    {
24
        return $className === self::CLASS_NAME ? parent::getNameDQL($format, $locale, $className, $alias) : false;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression $className === self::CLA...sName, $alias) : false; of type string|false adds false to the return on line 24 which is incompatible with the return type declared by the interface Oro\Bundle\EntityBundle\...erInterface::getNameDQL of type string. It seems like you forgot to handle an error condition.
Loading history...
25
    }
26
}
27