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 |
|
|
|
|
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
|
|
|
|
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.