Issues (33)

Security Analysis    no request data  

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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/Rosetta.php (5 issues)

1
<?php
2
3
namespace Ghc\Rosetta;
4
5
use Ghc\Rosetta\Connectors\Connector;
6
use Ghc\Rosetta\Connectors\Request;
7
use Ghc\Rosetta\Exceptions\ManagerException;
8
use Ghc\Rosetta\Messages\Message;
9
use Ghc\Rosetta\Transformers\Transformer;
10
11
class Rosetta
12
{
13
    /**
14
     * @param string $class
15
     * @param array  $config
16
     *
17
     * @throws ManagerException
18
     *
19
     * @return Connector
20
     */
21 View Code Duplication
    public static function connector($class, $config = [])
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...
22
    {
23
        if (!str_contains($class, '\\')) {
24
            $class = '\\Ghc\\Rosetta\\Connectors\\'.studly_case($class);
25
        }
26
27
        if (!class_exists($class)) {
28
            throw ManagerException::undefinedConnector($class);
29
        }
30
31
        return new $class($config);
32
    }
33
34
    /**
35
     * @param Connector  $connector
36
     * @param string     $method
37
     * @param string     $uri
38
     * @param mixed|null $data
39
     * @param array      $options
40
     *
41
     * @return Request
42
     */
43
    public static function connectorRequest(Connector $connector, $method, $uri, $data = null, $options = [])
44
    {
45
        return new Request($connector, $method, $uri, $data, $options);
46
    }
47
48
    /**
49
     * @param string     $class
50
     * @param null|mixed $data
51
     * @param array      $config
52
     *
53
     * @throws ManagerException
54
     *
55
     * @return Message
56
     */
57 View Code Duplication
    public static function message($class, $data = null, $config = [])
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...
58
    {
59
        if (!str_contains($class, '\\')) {
60
            $class = '\\Ghc\\Rosetta\\Messages\\'.studly_case($class);
61
        }
62
63
        if (!class_exists($class)) {
64
            throw ManagerException::undefinedMessage($class);
65
        }
66
67
        return new $class($data, $config);
68
    }
69
70
    /**
71
     * @param string $class
72
     * @param array  $config
73
     *
74
     * @throws ManagerException
75
     *
76
     * @return Message
77
     */
78 View Code Duplication
    public static function transformer($class, $config = [])
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...
79
    {
80
        if (!str_contains($class, '\\')) {
81
            $class = '\\Ghc\\Rosetta\\Transformers\\'.studly_case($class);
82
        }
83
84
        if (!class_exists($class)) {
85
            throw ManagerException::undefinedTransformer($class);
86
        }
87
88
        return new $class($config);
89
    }
90
91
    /**
92
     * @param array|mixed               $data
93
     * @param Transformer|Transformer[] $transformers
94
     *
95
     * @return Item
96
     */
97
    public static function item($data, $transformers = null)
98
    {
99
        return new Item($data, $transformers);
100
    }
101
102
    /**
103
     * @param array|mixed               $data
104
     * @param Transformer|Transformer[] $transformers
105
     *
106
     * @return Item
107
     */
108
    public static function collection($data, $transformers = null)
109
    {
110
        return new Collection($data, $transformers);
111
    }
112
113
    /**
114
     * @param string $class
115
     *
116
     * @throws ManagerException
117
     *
118
     * @return
119
     */
120 View Code Duplication
    public static function pipe($class)
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...
121
    {
122
        if (!str_contains($class, '\\')) {
123
            $class = '\\Ghc\\Rosetta\\Pipes\\'.studly_case($class);
124
        }
125
126
        if (!class_exists($class)) {
127
            throw ManagerException::undefinedPipe($class);
128
        }
129
130
        return new $class();
131
    }
132
133
    /**
134
     * @param string     $class
135
     * @param null|mixed $data
136
     * @param array      $config
137
     *
138
     * @throws ManagerException
139
     *
140
     * @return
141
     */
142 View Code Duplication
    public static function matcher($class, $data = null, $config = [])
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...
143
    {
144
        if (!str_contains($class, '\\')) {
145
            $class = '\\Ghc\\Rosetta\\Matchers\\'.studly_case($class);
146
        }
147
148
        if (!class_exists($class)) {
149
            throw ManagerException::undefinedMatcher($class);
150
        }
151
152
        return new $class($data, $config);
153
    }
154
155
    /**
156
     * @param array $config
157
     *
158
     * @return Pipeline
159
     */
160
    public static function pipeline($config = [])
161
    {
162
        return new Pipeline($config);
163
    }
164
165
    /**
166
     * @param Message $input
167
     * @param Message $output
168
     *
169
     * @return Message
170
     */
171
    public static function transformMessage($input, $output)
172
    {
173
        return $output->fromArray($input->toArray());
174
    }
175
}
176