Code Duplication    Length = 20-22 lines in 2 locations

src/Examples/NytPlugin.php 1 location

@@ 22-43 (lines=22) @@
19
    private $rssService;
20
    private $giphyService;
21
22
    public function __construct(
23
        LoggerInterface $logger,
24
        RssService $rssService,
25
        GiphyService $giphyService,
26
        array $config = [])
27
    {
28
        $this->setLog($logger);
29
        $this->rssService = $rssService;
30
        $this->giphyService = $giphyService;
31
        $this->setConfig(array_merge(
32
            [
33
                'help' => '<prefix> number-of-items',
34
                'prefix' => 'nyt',
35
                'matchers' => [
36
                    'nyt' => "/^(?:(?'n'\\d\\d?)|)$/",
37
                ],
38
                'url' => 'http://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml',
39
                'format' => 'fixed_height_downsampled',
40
            ],
41
            $config
42
        ));
43
    }
44
45
    public function nyt(Message $msg, array $matches)
46
    {

src/Giphy/GiphyPlugin.php 1 location

@@ 21-40 (lines=20) @@
18
19
    private $giphyService;
20
21
    public function __construct(
22
        LoggerInterface $logger,
23
        GiphyService $giphyService,
24
        array $config = [])
25
    {
26
        $this->setLog($logger);
27
        $this->giphyService = $giphyService;
28
        $this->setConfig(array_merge(
29
            [
30
                'help' => '<prefix> [search terms] [optional format] (giphy formats to list available)',
31
                'prefix' => 'giphy',
32
                'matchers' => [
33
                    'each' => '/^\*\s+(.*)/',
34
                    'search' => '/^(.*)/',
35
                ],
36
                'format' => 'fixed_width',
37
            ],
38
            $config
39
        ));
40
    }
41
42
    public function each(Message $msg, array $matches)
43
    {