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\CreateForTaskTrait; |
19
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\DeleteTrait; |
20
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForContactTrait; |
21
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForFolderTrait; |
22
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForTaskTrait; |
23
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllForTimelogCategoryTrait; |
24
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetAllTrait; |
25
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\GetByIdTrait; |
26
|
|
|
use Zibios\WrikePhpLibrary\Resource\Traits\UpdateTrait; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Timelog Resource. |
30
|
|
|
*/ |
31
|
|
View Code Duplication |
class TimelogResource extends AbstractResource |
|
|
|
|
32
|
|
|
{ |
33
|
|
|
use GetAllTrait; |
34
|
|
|
use GetAllForContactTrait; |
35
|
|
|
use GetAllForFolderTrait; |
36
|
|
|
use GetAllForTaskTrait; |
37
|
|
|
use GetAllForTimelogCategoryTrait; |
38
|
|
|
use GetByIdTrait; |
39
|
|
|
use CreateForTaskTrait; |
40
|
|
|
use UpdateTrait; |
41
|
|
|
use DeleteTrait; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Return connection array ResourceMethod => RequestPathFormat. |
45
|
|
|
* |
46
|
|
|
* @see \Zibios\WrikePhpLibrary\Enum\Api\ResourceMethodEnum |
47
|
|
|
* @see \Zibios\WrikePhpLibrary\Enum\Api\RequestPathFormatEnum |
48
|
|
|
* |
49
|
|
|
* @return array |
50
|
|
|
*/ |
51
|
9 |
|
protected function getResourceMethodConfiguration(): array |
52
|
|
|
{ |
53
|
|
|
return [ |
54
|
9 |
|
ResourceMethodEnum::GET_ALL => RequestPathFormatEnum::TIMELOGS, |
55
|
|
|
ResourceMethodEnum::GET_ALL_FOR_CONTACT => RequestPathFormatEnum::TIMELOGS_FOR_CONTACT, |
56
|
|
|
ResourceMethodEnum::GET_ALL_FOR_FOLDER => RequestPathFormatEnum::TIMELOGS_FOR_FOLDER, |
57
|
|
|
ResourceMethodEnum::GET_ALL_FOR_TASK => RequestPathFormatEnum::TIMELOGS_FOR_TASK, |
58
|
|
|
ResourceMethodEnum::GET_ALL_FOR_TIMELOG_CATEGORY => RequestPathFormatEnum::TIMELOGS_FOR_TIMELOG_CATEGORY, |
59
|
|
|
ResourceMethodEnum::GET_BY_ID => RequestPathFormatEnum::TIMELOGS_BY_ID, |
60
|
|
|
ResourceMethodEnum::CREATE_FOR_TASK => RequestPathFormatEnum::TIMELOGS_FOR_TASK, |
61
|
|
|
ResourceMethodEnum::UPDATE => RequestPathFormatEnum::TIMELOGS_BY_ID, |
62
|
|
|
ResourceMethodEnum::DELETE => RequestPathFormatEnum::TIMELOGS_BY_ID, |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
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.