Completed
Pull Request — develop (#386)
by Wachter
20:57
created

WebspaceSelect   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValues() 0 12 2
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) Sulu GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Bundle\ArticleBundle\Admin\Helper;
13
14
use Sulu\Component\Webspace\Manager\WebspaceManagerInterface;
15
16
class WebspaceSelect
17
{
18
    /**
19
     * @var WebspaceManagerInterface
20
     */
21
    private $webspaceManager;
22
23
    public function __construct(WebspaceManagerInterface $webspaceManager)
24
    {
25
        $this->webspaceManager = $webspaceManager;
26
    }
27
28
    public function getValues(): array
29
    {
30
        $values = [];
31
        foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
32
            $values[] = [
33
                'name' => $webspace->getKey(),
34
                'title' => $webspace->getName(),
35
            ];
36
        }
37
38
        return $values;
39
    }
40
}
41