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

ConfsTechParserFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A createParser() 0 11 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