These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | require "vendor/autoload.php"; |
||
4 | |||
5 | $config = 'config.local.php'; |
||
6 | |||
7 | /** @var \Marek\Toggable\TogglInterface $toggl */ |
||
8 | $toggl = \Marek\Toggable\Factory\TogglFactory::buildToggable($config); |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | /** @var \Marek\Toggable\API\Toggl\WorkspaceServiceInterface $workspaceService */ |
||
11 | $workspaceService = $toggl->getWorkspaceService(); |
||
12 | /** @var \Marek\Toggable\API\Toggl\ClientServiceInterface $clientService */ |
||
13 | $clientService = $toggl->getClientService(); |
||
14 | /** @var \Marek\Toggable\API\Toggl\AuthenticationServiceInterface $authenticationService */ |
||
15 | $authenticationService = $toggl->getAuthenticationService(); |
||
16 | /** @var \Marek\Toggable\API\Toggl\DashboardServiceInterface $dashboardService */ |
||
17 | $dashboardService = $toggl->getDashboardService(); |
||
18 | |||
19 | $response = $workspaceService->getWorkspaces(); |
||
20 | |||
21 | $workspaceId = null; |
||
22 | foreach ($response->workspaces as $workspace) { |
||
23 | $workspaceId = $workspace->id; |
||
24 | echo $workspace->id . "\n"; |
||
25 | } |
||
26 | |||
27 | $response = $dashboardService->getDashboardData($workspaceId); |
||
28 | |||
29 | $dashboard = $response->dashboard; |
||
30 | |||
31 | echo "5 users who have tracked the most time during last 7 days:\n"; |
||
32 | /** @var \Marek\Toggable\API\Toggl\Values\Dashboard\MostActiveUser $mostActiveUser */ |
||
33 | foreach ($dashboard->mostActiveUser as $mostActiveUser) { |
||
34 | echo "Most active user id: $mostActiveUser->user_id, with duration: $mostActiveUser->duration\n"; |
||
35 | } |
||
36 | |||
37 | echo "\n"; |
||
38 | echo "10 latest actions in the workspace:\n"; |
||
39 | /** @var \Marek\Toggable\API\Toggl\Values\Dashboard\Activity $activity */ |
||
40 | foreach ($dashboard->activity as $activity) { |
||
41 | echo "Activity on project: $activity->project_id, by user: $activity->user_id, with description: $activity->description\n"; |
||
42 | } |
||
43 | |||
44 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: