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/Client/ClientService.php (2 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\Client;
4
5
use Marek\Toggable\API\Http\Request\Client\UpdateClient;
6
use Marek\Toggable\API\Http\Response\Client\Client as ClientResponse;
7
use Marek\Toggable\API\Http\Response\Client\Clients as ClientsResponse;
8
use Marek\Toggable\API\Http\Response\Project\Projects as ProjectsResponse;
9
use Marek\Toggable\API\Toggl\Values\Project\Project as ProjectValue;
10
use Marek\Toggable\API\Toggl\Values\Client\Client as ClientValue;
11
use Marek\Toggable\API\Http\Request\Client\CreateClient as CreateClientRequest;
12
use Marek\Toggable\API\Http\Request\Client\GetClientDetails as GetClientDetailsRequest;
13
use Marek\Toggable\API\Http\Request\Client\GetClientProjects as GetClientProjectsRequest;
14
use Marek\Toggable\API\Http\Request\Client\GetClients as GetClientsRequest;
15
use Marek\Toggable\API\Http\Request\Client\DeleteClient as DeleteClientRequest;
16
use Marek\Toggable\Service\AbstractService;
17
use Marek\Toggable\API\Toggl\Values\Activity;
18
19
/**
20
 * Class ClientService
21
 * @package Marek\Toggable\Service\Client
22
 */
23
class ClientService extends AbstractService implements \Marek\Toggable\API\Toggl\ClientServiceInterface
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function createClient(ClientValue $client)
29
    {
30 1
        $request = new CreateClientRequest(
31
            array(
32 1
                'data' => $this->extractDataFromObject($client),
33
            )
34 1
        );
35
36 1
        $response = $this->delegate($request);
37
38 1
        return new ClientResponse(
39
            array(
40 1
                'client' => $this->hydrateDataFromArrayToObject($response, new ClientValue()),
41
            )
42 1
        );
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 2
    public function getClientDetails($clientId)
49
    {
50 2
        $request = new GetClientDetailsRequest(
51
            array(
52 2
                'clientId' => $this->validate($clientId),
53
            )
54 1
        );
55
56 1
        $response = $this->delegate($request);
57
58 1
        return new ClientResponse(
59
            array(
60 1
                'client' => $this->hydrateDataFromArrayToObject($response, new ClientValue())
61 1
            )
62 1
        );
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68 1
    public function getClients()
69
    {
70 1
        $request = new GetClientsRequest();
71
72 1
        $response = $this->delegate($request);
73
74 1
        $clients = array();
75 1
        foreach($response->body as $client) {
76 1
            $clients[] = $this->hydrator->hydrate($client, new ClientValue);
77 1
        }
78
79 1
        return new ClientsResponse(
80
            array(
81 1
                'clients' => $clients,
82
            )
83 1
        );
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89 1
    public function getClientProjects($clientId, $active = Activity::ACTIVE)
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...
90
    {
91 1
        $request = new GetClientProjectsRequest(
92
            array(
93 1
                'clientId' => $this->validate($clientId),
94 1
                'active' => $active,
95
            )
96 1
        );
97
98 1
        $response = $this->delegate($request);
99
100 1
        $projects = array();
101 1
        foreach ($response->body as $project) {
102 1
            $projects[] = $this->hydrator->hydrate($project, new ProjectValue());
103 1
        }
104
105 1
        return new ProjectsResponse(array('projects' => $projects));
106
    }
107
108
    /**
109
     * {@inheritdoc}
110
     */
111 2
    public function updateClient($clientId, ClientValue $client)
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...
112
    {
113 2
        $request = new UpdateClient(
114
            array(
115 2
                'clientId' => $this->validate($clientId),
116 1
                'data' => $this->extractDataFromObject($client),
117
            )
118 1
        );
119
120 1
        $response = $this->delegate($request);
121
122 1
        return new ClientResponse(
123
            array(
124 1
                'client' => $this->hydrateDataFromArrayToObject($response, new ClientValue()),
125
            )
126 1
        );
127
    }
128
129
    /**
130
     * {@inheritdoc}
131
     */
132 2
    public function deleteClient($clientId)
133
    {
134 2
        $request = new DeleteClientRequest(
135
            array(
136 2
                'clientId' => $this->validate($clientId),
137
            )
138 1
        );
139
140 1
        return $this->delegate($request);
141
    }
142
}
143