Completed
Push — ezp26381-content_view_default_... ( 148f87...a8621d )
by
unknown
35:11
created

SudoMainLocationLoader::loadLocation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
rs 9.4285
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
namespace eZ\Publish\Core\Helper\ContentInfoLocationLoader;
7
8
use eZ\Publish\API\Repository\Values\Content\ContentInfo;
9
use eZ\Publish\Core\Helper\ContentInfoLocationLoader;
10
use eZ\Publish\API\Repository\Repository;
11
12
/**
13
 * Loads the main location of a given ContentInfo using sudo().
14
 */
15
class SudoMainLocationLoader implements ContentInfoLocationLoader
16
{
17
    /**
18
     * @var \eZ\Publish\API\Repository\Repository|\eZ\Publish\Core\Repository\Repository
19
     */
20
    private $repository;
21
22
    public function __construct(Repository $repository)
23
    {
24
        $this->repository = $repository;
25
    }
26
27
    public function loadLocation(ContentInfo $contentInfo)
28
    {
29
        return $this->repository->sudo(
30
            function(Repository $repository) use ($contentInfo) {
31
                return $repository->loadLocation($contentInfo->mainLocationId);
0 ignored issues
show
Bug introduced by
The method loadLocation() does not seem to exist on object<eZ\Publish\API\Repository\Repository>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
32
            }
33
        );
34
    }
35
}
36