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

ActivityRepository::findActivityById()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 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