UrlProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getUrls() 0 17 2
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * File: UrlProvider.php
6
 *
7
 * @author      Maciej Sławik <[email protected]>
8
 * Github:      https://github.com/maciejslawik
9
 */
10
11
namespace MSlwk\ReactPhpPlayground\Standalone\Http;
12
13
use MSlwk\ReactPhpPlayground\Api\Data\UrlInterface;
14
use MSlwk\ReactPhpPlayground\Model\Data\Url;
15
use MSlwk\TypeSafeArray\ObjectArray;
16
use MSlwk\TypeSafeArray\ObjectArrayFactory;
17
18
/**
19
 * Trait UrlProvider
20
 * @package MSlwk\ReactPhpPlayground\Standalone\Http
21
 */
22
class UrlProvider
23
{
24
    /**
25
     * @var ObjectArrayFactory
26
     */
27
    private $objectArrayFactory;
28
29
    /**
30
     * UrlProvider constructor.
31
     * @param ObjectArrayFactory $objectArrayFactory
32
     */
33
    public function __construct(ObjectArrayFactory $objectArrayFactory)
34
    {
35
        $this->objectArrayFactory = $objectArrayFactory;
36
    }
37
38
    /**
39
     * @return ObjectArray
40
     */
41
    public function getUrls(): ObjectArray
42
    {
43
        $urls = [
44
            'https://magento.com',
45
            'https://marketplace.magento.com',
46
            'https://u.magento.com',
47
            'https://devdocs.magento.com',
48
            'https://github.com/magento/magento2',
49
            'https://pl.meet-magento.com/pl/'
50
        ];
51
52
        $urlObjectArray = $this->objectArrayFactory->create(UrlInterface::class);
53
        foreach ($urls as $url) {
54
            $urlObjectArray->add(new Url($url));
55
        }
56
        return $urlObjectArray;
57
    }
58
}
59