Issues (71)

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/GroupService.php (7 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
namespace OmnideskBundle\Service;
3
4
use OmnideskBundle\Factory\Group\GroupConfigurationFactory;
5
use OmnideskBundle\Factory\Group\GroupDataTransformerFactory;
6
use OmnideskBundle\Request\Group\AddGroupRequest;
7
use OmnideskBundle\Request\Group\EditGroupRequest;
8
use OmnideskBundle\Request\Group\ListGroupRequest;
9
use OmnideskBundle\Request\Group\ViewGroupRequest;
10
use OmnideskBundle\Response\Group\GetGroupResponse;
11
use OmnideskBundle\Response\Group\GroupResponse;
12
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
13
14
/**
15
 * Class GroupService
16
 * @package OmnideskBundle\Service
17
 */
18
class GroupService extends AbstractService
19
{
20
    /**
21
     * @var RequestService
22
     */
23
    protected $requestService;
24
25
    /**
26
     * @var GroupDataTransformerFactory
27
     */
28
    protected $transformerFactory;
29
30
    /**
31
     * @var GroupConfigurationFactory
32
     */
33
    protected $configurationFactory;
34
35
    /**
36
     * GroupService constructor.
37
     * @param RequestService              $requestService
38
     * @param GroupDataTransformerFactory $transformerFactory
39
     * @param GroupConfigurationFactory   $configurationFactory
40
     */
41
    public function __construct(
42
        RequestService $requestService,
43
        GroupDataTransformerFactory $transformerFactory,
44
        GroupConfigurationFactory $configurationFactory
45
    ) {
46
        $this->requestService = $requestService;
47
        $this->transformerFactory = $transformerFactory;
48
        $this->configurationFactory = $configurationFactory;
49
    }
50
51
    /**
52
     * @param AddGroupRequest $request
53
     * @return GroupResponse
54
     */
55 View Code Duplication
    public function add(AddGroupRequest $request)
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...
56
    {
57
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_ADD);
58
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_ADD);
59
60
        try {
61
            $params = $this->checkRequest($request, $transformer, $configuration);
62
        } catch (InvalidConfigurationException $exception) {
63
            throw new InvalidConfigurationException($exception->getMessage());
64
        }
65
66
        $result = $this->requestService->post('groups', ['group' => $params]);
67
68
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result);
69
    }
70
71
    /**
72
     * @param EditGroupRequest $request
73
     * @return GroupResponse
74
     */
75 View Code Duplication
    public function edit(EditGroupRequest $request)
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...
76
    {
77
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_EDIT);
78
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_EDIT);
79
80
        try {
81
            $params = $this->checkRequest($request, $transformer, $configuration);
82
        } catch (InvalidConfigurationException $exception) {
83
            throw new InvalidConfigurationException($exception->getMessage());
84
        }
85
86
        $result = $this->requestService->put("groups/{$params['group_id']}", ['group' => $params]);
87
88
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result);
89
    }
90
91
    /**
92
     * @param ListGroupRequest $request
93
     * @return GetGroupResponse
94
     */
95 View Code Duplication
    public function lists(ListGroupRequest $request)
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...
96
    {
97
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_LIST);
98
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_LIST);
99
100
        try {
101
            $params = $this->checkRequest($request, $transformer, $configuration);
102
        } catch (InvalidConfigurationException $exception) {
103
            throw new InvalidConfigurationException($exception->getMessage());
104
        }
105
106
        $result = $this->requestService->get('groups', $params);
107
108
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_LIST)->transform($result);
109
    }
110
111
    /**
112
     * @param ViewGroupRequest $request
113
     * @return GroupResponse
114
     */
115 View Code Duplication
    public function view(ViewGroupRequest $request)
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...
116
    {
117
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW);
118
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW);
119
120
        try {
121
            $params = $this->checkRequest($request, $transformer, $configuration);
122
        } catch (InvalidConfigurationException $exception) {
123
            throw new InvalidConfigurationException($exception->getMessage());
124
        }
125
126
        $result = $this->requestService->get("groups/{$params['group_id']}");
127
128
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result);
129
    }
130
131
    /**
132
     * @param ViewGroupRequest $request
133
     * @return GroupResponse
134
     */
135 View Code Duplication
    public function disable(ViewGroupRequest $request)
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...
136
    {
137
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW);
138
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW);
139
140
        try {
141
            $params = $this->checkRequest($request, $transformer, $configuration);
142
        } catch (InvalidConfigurationException $exception) {
143
            throw new InvalidConfigurationException($exception->getMessage());
144
        }
145
146
        $result = $this->requestService->put("groups/{$params['group_id']}/disable");
147
148
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result);
149
    }
150
151
    /**
152
     * @param ViewGroupRequest $request
153
     * @return GroupResponse
154
     */
155 View Code Duplication
    public function enable(ViewGroupRequest $request)
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...
156
    {
157
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW);
158
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW);
159
160
        try {
161
            $params = $this->checkRequest($request, $transformer, $configuration);
162
        } catch (InvalidConfigurationException $exception) {
163
            throw new InvalidConfigurationException($exception->getMessage());
164
        }
165
166
        $result = $this->requestService->put("groups/{$params['group_id']}/enable");
167
168
        return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result);
169
    }
170
171
    /**
172
     * @param ViewGroupRequest $request
173
     * @return GroupResponse
174
     */
175 View Code Duplication
    public function delete(ViewGroupRequest $request)
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...
176
    {
177
        $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW);
178
        $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW);
179
180
        try {
181
            $params = $this->checkRequest($request, $transformer, $configuration);
182
        } catch (InvalidConfigurationException $exception) {
183
            throw new InvalidConfigurationException($exception->getMessage());
184
        }
185
186
        $this->requestService->delete("groups/{$params['group_id']}");
187
    }
188
}
189