YouTubeConfiguration   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 71
Duplicated Lines 18.31 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 2
c 2
b 0
f 1
lcom 0
cbo 1
dl 13
loc 71
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 13 13 1
A getCategoryMap() 0 48 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Libcast\AssetDistributor\YouTube;
4
5
use Libcast\AssetDistributor\Configuration\AbstractConfiguration;
6
use Libcast\AssetDistributor\Configuration\Configuration;
7
use Psr\Log\LoggerInterface;
8
9
class YouTubeConfiguration extends AbstractConfiguration implements Configuration
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14 View Code Duplication
    public function __construct(array $configuration, LoggerInterface $logger = null)
15
    {
16
        $configuration = array_merge($configuration, [
17
            'access_type' => 'offline',
18
            'scopes'      => [
19
                'https://www.googleapis.com/auth/youtube',
20
                'https://www.googleapis.com/auth/youtube.readonly',
21
                'https://www.googleapis.com/auth/youtube.upload',
22
            ],
23
        ]);
24
25
        parent::__construct($configuration, $logger);
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function getCategoryMap()
32
    {
33
        return [
34
            'film'          => 1,
35
            'animation'     => 1,
36
            'autos'         => 2,
37
            'vehicles'      => 2,
38
            'music'         => 10,
39
            'pets'          => 15,
40
            'animals'       => 15,
41
            'sports'        => 17,
42
            'clips'         => 18,
43
            'travel'        => 19,
44
            'events'        => 19,
45
            'gaming'        => 20,
46
            'videoblogging' => 21,
47
            'people'        => 22,
48
            'blogs'         => 22,
49
            'comedians'     => 23,
50
            'entertainment' => 24,
51
            'news'          => 25,
52
            'politics'      => 25,
53
            'howto'         => 26,
54
            'style'         => 26,
55
            'education'     => 27,
56
            'science'       => 28,
57
            'technology'    => 28,
58
            'nonprofits'    => 29,
59
            'activism'      => 29,
60
            'movies'        => 30,
61
            'anime'         => 31,
62
            'action'        => 32,
63
            'adventure'     => 32,
64
            'classics'      => 33,
65
            'comedy'        => 34,
66
            'documentary'   => 35,
67
            'drama'         => 36,
68
            'family'        => 37,
69
            'foreign'       => 38,
70
            'horror'        => 39,
71
            'sci-fi'        => 40,
72
            'fantasy'       => 40,
73
            'thriller'      => 41,
74
            'shorts'        => 42,
75
            'shows'         => 43,
76
            'trailers'      => 44,
77
        ];
78
    }
79
}
80