Passed
Push — master ( 913c0a...fd8403 )
by Ondřej
05:45
created

EqualableWithPhpOperators::equals()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
declare(strict_types=1);
3
namespace Ivory\Value\Alg;
4
5
/**
6
 * Provides an implementation of the {@link IEqualable} interface, comparing objects using the PHP `==` operator.
7
 */
8
trait EqualableWithPhpOperators
9
{
10
    final public function equals($other): bool
11
    {
12
        return (
13
            $other !== null &&
14
            get_class($this) == get_class($other) &&
15
            $this == $other
16
        );
17
    }
18
}
19