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

ConfsTechParserFactory::createParser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
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\Service;
11
12
use Callingallpapers\Parser\ConfsTech\CategoryParser;
13
use Callingallpapers\Parser\ConfsTech\ConferenceParser;
14
use Callingallpapers\Parser\ConfsTech\MainParser;
15
use Callingallpapers\Parser\ConfsTech\YearParser;
16
use Callingallpapers\Writer\WriterInterface;
17
use DateTimeImmutable;
18
use GuzzleHttp\Client;
19
use Symfony\Component\Console\Output\OutputInterface;
20
21
class ConfsTechParserFactory
22
{
23
    private $client;
24
25
    private $conferenceParser;
26
27
    private $output;
28
29
    public function __construct(
30
        ConferenceParser $conferenceParser,
31
        Client $client,
32
        WriterInterface $output
33
    ) {
34
        $this->client = $client;
35
        $this->conferenceParser = $conferenceParser;
36
        $this->output = $output;
37
    }
38
39
    public function createParser(WriterInterface $writer) : MainParser
0 ignored issues
show
Unused Code introduced by
The parameter $writer is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        $catParser  = new CategoryParser($this->conferenceParser, $this->client, $this->output);
42
        $yearParser = new YearParser($catParser, $this->client);
43
44
        return new MainParser(
45
            $yearParser,
46
            $this->client,
47
            (new DateTimeImmutable())->format('Y')
48
        );
49
    }
50
}
51