FolderResource   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 33
Duplicated Lines 39.39 %

Coupling/Cohesion

Components 0
Dependencies 9

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 9
dl 13
loc 33
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getResourceMethodConfiguration() 13 13 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\CopyTrait;
19
use Zibios\WrikePhpLibrary\Resource\Traits\CreateForFolderTrait;
20
use Zibios\WrikePhpLibrary\Resource\Traits\DeleteTrait;
21
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForFolderTrait;
22
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllTrait;
23
use Zibios\WrikePhpLibrary\Resource\Traits\GetByIdsTrait;
24
use Zibios\WrikePhpLibrary\Resource\Traits\GetByIdTrait;
25
use Zibios\WrikePhpLibrary\Resource\Traits\UpdateTrait;
26
27
/**
28
 * Folder Resource.
29
 */
30
class FolderResource extends AbstractResource
31
{
32
    use GetAllTrait;
33
    use GetAllForFolderTrait;
34
    use GetByIdTrait;
35
    use GetByIdsTrait;
36
    use CreateForFolderTrait;
37
    use CopyTrait;
38
    use UpdateTrait;
39
    use DeleteTrait;
40
41
    /**
42
     * Return connection array ResourceMethod => RequestPathFormat.
43
     *
44
     * @see \Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum
45
     * @see \Zibios\WrikePhpLibrary\Enum\Api\RequestPathFormatEnum
46
     *
47
     * @return array
48
     */
49 8 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...
50
    {
51
        return [
52 8
            ResourceMethodEnum::GET_ALL => RequestPathFormatEnum::FOLDERS,
53
            ResourceMethodEnum::GET_ALL_FOR_FOLDER => RequestPathFormatEnum::FOLDERS_FOR_FOLDER,
54
            ResourceMethodEnum::GET_BY_ID => RequestPathFormatEnum::FOLDERS_BY_ID,
55
            ResourceMethodEnum::GET_BY_IDS => RequestPathFormatEnum::FOLDERS_BY_IDS,
56
            ResourceMethodEnum::CREATE_FOR_FOLDER => RequestPathFormatEnum::FOLDERS_FOR_FOLDER,
57
            ResourceMethodEnum::COPY => RequestPathFormatEnum::FOLDERS_COPY,
58
            ResourceMethodEnum::UPDATE => RequestPathFormatEnum::FOLDERS_BY_ID,
59
            ResourceMethodEnum::DELETE => RequestPathFormatEnum::FOLDERS_BY_ID,
60
        ];
61
    }
62
}
63