TaskResource   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 38.71 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 12
loc 31
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResourceMethodConfiguration() 12 12 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
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/wrike-php-library package.
7
 *
8
 * (c) Zbigniew Ślązak
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zibios\WrikePhpLibrary\Resource;
15
16
use Zibios\WrikePhpLibrary\Enum\Api\RequestPathFormatEnum;
17
use Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum;
18
use Zibios\WrikePhpLibrary\Resource\Traits\CreateForFolderTrait;
19
use Zibios\WrikePhpLibrary\Resource\Traits\DeleteTrait;
20
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForFolderTrait;
21
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllTrait;
22
use Zibios\WrikePhpLibrary\Resource\Traits\GetByIdsTrait;
23
use Zibios\WrikePhpLibrary\Resource\Traits\GetByIdTrait;
24
use Zibios\WrikePhpLibrary\Resource\Traits\UpdateTrait;
25
26
/**
27
 * Task Resource.
28
 */
29
class TaskResource extends AbstractResource
30
{
31
    use GetAllTrait;
32
    use GetAllForFolderTrait;
33
    use GetByIdTrait;
34
    use GetByIdsTrait;
35
    use CreateForFolderTrait;
36
    use UpdateTrait;
37
    use DeleteTrait;
38
39
    /**
40
     * Return connection array ResourceMethod => RequestPathFormat.
41
     *
42
     * @see \Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum
43
     * @see \Zibios\WrikePhpLibrary\Enum\Api\RequestPathFormatEnum
44
     *
45
     * @return array
46
     */
47 7 View Code Duplication
    protected function getResourceMethodConfiguration(): array
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        return [
50 7
            ResourceMethodEnum::GET_ALL => RequestPathFormatEnum::TASKS,
51
            ResourceMethodEnum::GET_ALL_FOR_FOLDER => RequestPathFormatEnum::TASKS_FOR_FOLDER,
52
            ResourceMethodEnum::GET_BY_ID => RequestPathFormatEnum::TASKS_BY_ID,
53
            ResourceMethodEnum::GET_BY_IDS => RequestPathFormatEnum::TASKS_BY_IDS,
54
            ResourceMethodEnum::CREATE_FOR_FOLDER => RequestPathFormatEnum::TASKS_FOR_FOLDER,
55
            ResourceMethodEnum::UPDATE => RequestPathFormatEnum::TASKS_BY_ID,
56
            ResourceMethodEnum::DELETE => RequestPathFormatEnum::TASKS_BY_ID,
57
        ];
58
    }
59
}
60