Completed
Push — master ( 6a0ab6...96f47f )
by Mārtiņš
02:11
created

Search   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A retrieveIdenityByToken() 0 9 1
1
<?php
2
3
namespace Palladium\Service;
4
5
6
/**
7
 * Class for finding indentities based on various conditions
8
 */
9
10
use Palladium\Mapper as Mapper;
11
use Palladium\Entity as Entity;
12
use Palladium\Exception\UserNotFound;
13
use Palladium\Exception\IdentityNotFound;
14
use Palladium\Exception\TokenNotFound;
15
16
use Palladium\Contract\CanCreateMapper;
17
use Psr\Log\LoggerInterface;
18
19
20
class Search
21
{
22
23
    private $mapperFactory;
24
    private $logger;
25
26
27
    public function __construct(CanCreateMapper $mapperFactory, LoggerInterface $logger)
28
    {
29
        $this->mapperFactory = $mapperFactory;
30
        $this->logger = $logger;
31
    }
32
33
34
    public function retrieveIdenityByToken(Entity\Identity $identity)
35
    {
36
        $identity->setTokenEndOfLife(time());
37
38
        $mapper = $this->mapperFactory->create(Mapper\Identity::class);
39
        $mapper->fetch($identity);
40
41
        return $identity;
42
    }
43
}
44