Issues (47)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Service/ProjectUsers/ProjectUsersService.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Marek\Toggable\Service\ProjectUsers;
4
5
use Marek\Toggable\API\Http\Request\ProjectUsers\BulkDeleteProjectUsers;
6
use Marek\Toggable\API\Http\Request\ProjectUsers\BulkUpdateProjectUsers;
7
use Marek\Toggable\API\Http\Request\ProjectUsers\CreateMultipleProjectUsers;
8
use Marek\Toggable\API\Http\Request\ProjectUsers\CreateProjectUser;
9
use Marek\Toggable\API\Http\Request\ProjectUsers\DeleteProjectUser;
10
use Marek\Toggable\API\Http\Request\ProjectUsers\UpdateProjectUser;
11
use Marek\Toggable\API\Http\Response\ProjectUsers\ProjectUser;
12
use Marek\Toggable\API\Http\Response\ProjectUsers\ProjectUsers as ProjectUsersResponse;
13
use Marek\Toggable\API\Toggl\Values\Project\User;
14
use Marek\Toggable\Service\AbstractService;
15
16
/**
17
 * Class ProjectUsersService
18
 * @package Marek\Toggable\Service\ProjectUsers
19
 */
20
class ProjectUsersService extends AbstractService implements \Marek\Toggable\API\Toggl\ProjectUsersServiceInterface
21
{
22
    /**
23
     * @inheritDoc
24
     */
25 1
    public function createProjectUser(\Marek\Toggable\API\Toggl\Values\Project\User $user)
0 ignored issues
show
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...
26
    {
27 1
        $request = new CreateProjectUser(
28
            array(
29 1
                'data' => $this->extractDataFromObject($user),
30
            )
31 1
        );
32
33 1
        $response = $this->delegate($request);
34
35 1
        return new ProjectUser(
36
            array(
37 1
                'projectUser' => $this->hydrateDataFromArrayToObject($response, new User()),
38
            )
39 1
        );
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45 2
    public function updateProjectUser($projectUserId, \Marek\Toggable\API\Toggl\Values\Project\User $user)
0 ignored issues
show
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...
46
    {
47 2
        $request = new UpdateProjectUser(
48
            array(
49 2
                'projectUserId' => $this->validate($projectUserId),
50 1
                'data' => $this->extractDataFromObject($user),
51
            )
52 1
        );
53
54 1
        $response = $this->delegate($request);
55
56 1
        return new ProjectUser(
57
            array(
58 1
                'projectUser' => $this->hydrateDataFromArrayToObject($response, new User()),
59
            )
60 1
        );
61
    }
62
63
    /**
64
     * @inheritDoc
65
     */
66 2
    public function deleteProjectUser($projectUserId)
67
    {
68 2
        $request = new DeleteProjectUser(
69
            array(
70 2
                'projectUserId' => $this->validate($projectUserId),
71
            )
72 1
        );
73
74 1
        return $this->delegate($request);
75
    }
76
77
    /**
78
     * @inheritDoc
79
     */
80 2
    public function createMultipleProjectUsers($projectId, $userIds, \Marek\Toggable\API\Toggl\Values\Project\User $user)
0 ignored issues
show
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...
81
    {
82 2
        $request = new CreateMultipleProjectUsers(
83
            array(
84 2
                'projectId' => $this->validate($projectId),
85 1
                'userIds' => $userIds,
86 1
                'data' => $this->extractDataFromObject($user),
87
            )
88 1
        );
89
90 1
        $response = $this->delegate($request);
91
92 1
        $projectUsers = array();
93 1
        foreach ($response->body as $projectUser) {
94 1
            $projectUsers[] = $this->hydrator->hydrate($projectUser, new ProjectUser());
95 1
        }
96
97 1
        return new ProjectUsersResponse(
98
            array(
99 1
                'projectUsers' => $projectUsers,
100
            )
101 1
        );
102
    }
103
104
    /**
105
     * @inheritDoc
106
     */
107 1
    public function updateMultipleProjectUsers($projectUserIds, \Marek\Toggable\API\Toggl\Values\Project\User $user)
0 ignored issues
show
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...
108
    {
109 1
        $request = new BulkUpdateProjectUsers(
110
            array(
111 1
                'projectUserIds' => $projectUserIds,
112 1
                'data' => $this->extractDataFromObject($user),
113
            )
114 1
        );
115
116 1
        $response = $this->delegate($request);
117
118 1
        $projectUsers = array();
119 1
        foreach ($response->body as $projectUser) {
120 1
            $projectUsers[] = $this->hydrator->hydrate($projectUser, new ProjectUser());
121 1
        }
122
123 1
        return new ProjectUsersResponse(
124
            array(
125 1
                'projectUsers' => $projectUsers,
126
            )
127 1
        );
128
    }
129
130
    /**
131
     * @inheritDoc
132
     */
133 1
    public function deleteMultipleProjectUsers($projectUserIds)
134
    {
135 1
        $request = new BulkDeleteProjectUsers(
136
            array(
137 1
                'projectUserIds' => $projectUserIds,
138
            )
139 1
        );
140
141 1
        return $this->delegate($request);
142
    }
143
144
}
145
146