This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
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
|
|||
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. ![]() |
|||
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. ![]() |
|||
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. ![]() |
|||
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. ![]() |
|||
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 |
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.