Completed
Push — master ( d89681...8e123d )
by Andreas
20s
created

YearParser::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/*
4
 * Copyright (c) Andreas Heigl<[email protected]
5
 *
6
 * Licensed under the MIT License. See LICENSE.md file in the project root
7
 * for full license information.
8
 */
9
10
namespace Callingallpapers\Parser\ConfsTech;
11
12
use GuzzleHttp\Client;
13
14
class YearParser
15
{
16
    private $client;
17
18
    private $parser;
19
20
    public function __construct(
21
        CategoryParser $parser,
22
        Client $client
23
    ) {
24
        $this->client = $client;
25
        $this->parser = $parser;
26
    }
27
28 View Code Duplication
    public function __invoke(string $url)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $categories = $this->client->request('GET', $url);
31
32
        $categories = json_decode($categories->getBody()->getContents(), true);
33
        foreach ($categories as $category) {
34
            ($this->parser)(
35
                str_replace('.json', '', $category['name']),
36
                $category['git_url']
37
            );
38
        }
39
    }
40
}
41