Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
31 | 5 | public function findAndUpdate($source) |
|
32 | { |
||
33 | /** @var Redirect|null $redirect */ |
||
34 | 5 | $redirect = $this->om->getRepository($this->class)->findOneBy(['source' => $source]); |
|
35 | |||
36 | 5 | if (null === $redirect) { |
|
37 | 2 | return null; |
|
38 | } |
||
39 | |||
40 | 3 | $redirect->increaseCount(); |
|
41 | 3 | $redirect->updateLastAccessed(); |
|
42 | 3 | $this->om->flush(); |
|
43 | |||
44 | 3 | return $redirect; |
|
45 | } |
||
46 | } |
||
47 |