Completed
Push — master ( 796f18...c2ba48 )
by Markus
20s
created

FeedServiceProvider::createRunFeedReaderCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Jellyfish\Feed;
4
5
use Jellyfish\Feed\Command\RunFeedReaderCommand;
6
use Pimple\Container;
7
use Pimple\ServiceProviderInterface;
8
9
class FeedServiceProvider implements ServiceProviderInterface
10
{
11
    /**
12
     * @param \Pimple\Container $pimple
13
     */
14
    public function register(Container $pimple)
15
    {
16
        $self = $this;
17
18
        $pimple->offsetSet('feed_reader_manager', function ($container) use ($self) {
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

18
        $pimple->offsetSet('feed_reader_manager', function (/** @scrutinizer ignore-unused */ $container) use ($self) {

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

Loading history...
19
            return $self->createFeedReaderManager();
20
        });
21
22
        $pimple->extend('commands', function ($commands, $container) use ($self) {
23
            $commands[] = $self->createRunFeedReaderCommand($container->offsetGet('feed_reader_manager'));
24
25
            return $commands;
26
        });
27
    }
28
29
    /**
30
     * @return \Jellyfish\Feed\FeedReaderManagerInterface
31
     */
32
    protected function createFeedReaderManager(): FeedReaderManagerInterface
33
    {
34
        return new FeedReaderManager();
35
    }
36
37
    /**
38
     * @param \Jellyfish\Feed\FeedReaderManagerInterface $feedReaderManager
39
     *
40
     * @return \Jellyfish\Feed\Command\RunFeedReaderCommand
41
     */
42
    protected function createRunFeedReaderCommand(FeedReaderManagerInterface $feedReaderManager): RunFeedReaderCommand
43
    {
44
        return new RunFeedReaderCommand($feedReaderManager);
45
    }
46
}
47