Completed
Pull Request — master (#8)
by
unknown
04:37
created

ActivityRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A findActivityById() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace XApi\Repository\Doctrine\Test;
13
14
use Doctrine\Common\Persistence\ObjectManager;
15
use Xabbuh\XApi\Model\IRI;
16
use XApi\Repository\Api\ActivityRepositoryInterface;
17
18
/**
19
 * Activity repository clearing the object manager between read and write operations.
20
 *
21
 * @author Jérôme Parmentier <[email protected]>
22
 */
23
final class ActivityRepository implements ActivityRepositoryInterface
24
{
25
    private $repository;
26
    private $objectManager;
27
28
    public function __construct(ActivityRepositoryInterface $repository, ObjectManager $objectManager)
29
    {
30
        $this->repository = $repository;
31
        $this->objectManager = $objectManager;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function findActivityById(IRI $activityId)
38
    {
39
        $activity = $this->repository->findActivityById($activityId);
40
        $this->objectManager->clear();
41
42
        return $activity;
43
    }
44
}
45