Completed
Push — master ( 1ee05e...99144a )
by Gaetano
05:13
created

FlexibleKeyMatcherTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 21
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
getConditionsFromKey() 0 1 ?
A matchOneByKey() 0 4 2
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\Core\Matcher;
4
5
trait FlexibleKeyMatcherTrait
6
{
7
    /**
8
     * Given a key, return the correct array of conditions to be used in a Match call
9
     *
10
     * @param string|int $key
11
     * @return array
12
     * @throws \Exception if the key can not be positively identified (eg. a string which could be an identifier or a remote_id)
13
     */
14
    abstract protected function getConditionsFromKey($key);
15
16
    /**
17
     * @param string|int|array $key We go overboard with flexibility and accept an array of conditions, besides the single key.
18
     *                              This allow us to do some funky stuff when users have to specify location ids
19
     * @return mixed
20
     */
21
    public function matchOneByKey($key)
22
    {
23
        return is_array($key) ? $this->matchOne($key) : $this->matchOne($this->getConditionsFromKey($key));
0 ignored issues
show
Bug introduced by
The method matchOne() does not exist on Kaliop\eZMigrationBundle...FlexibleKeyMatcherTrait. Did you maybe mean matchOneByKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
24
    }
25
}
26