Completed
Push — master ( 3560db...6e658b )
by
unknown
08:14
created

ContactEmailDeleteValidator::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 2
eloc 2
nc 2
nop 1
1
<?php
2
3
namespace OroCRM\Bundle\ContactBundle\Validator;
4
5
use OroCRM\Bundle\ContactBundle\Entity\ContactEmail;
6
7
class ContactEmailDeleteValidator
8
{
9
    /**
10
     * {@inheritdoc}
11
     *
12
     * @param ContactEmail $value
13
     */
14
    public function validate(ContactEmail $value)
15
    {
16
        return $value->isPrimary() && $value->getOwner()->getEmails()->count() === 1;
17
    }
18
}
19