Completed
Push — EZP-31644 ( 2e0a1e...93bb44 )
by
unknown
19:12
created

LazyRepositoryFactory::buildRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the LazyRepositoryFactory class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishCoreBundle\ApiLoader;
10
11
use eZ\Publish\API\Repository\Repository;
12
13
/**
14
 * @deprecated This factory is not needed any more as ProxyManager is now used for lazy loading. Use ezpublish.api.repository instead.
15
 */
16
class LazyRepositoryFactory
17
{
18
    /**
19
     * @var \eZ\Publish\API\Repository\Repository
20
     */
21
    protected $repository;
22
23
    public function __construct(Repository $repository)
24
    {
25
        $this->repository = $repository;
26
    }
27
28
    /**
29
     * Returns a closure which returns ezpublish.api.repository when called.
30
     *
31
     * To be used when lazy loading is needed.
32
     *
33
     * @return \Closure
34
     */
35
    public function buildRepository()
36
    {
37
        $repository = $this->repository;
38
39
        return function () use ($repository) {
40
            return $repository;
41
        };
42
    }
43
}
44