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

LazyRepositoryFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildRepository() 0 8 1
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