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.
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 Sausin\Signere; |
||
4 | |||
5 | use Carbon\Carbon; |
||
6 | |||
7 | class Form extends BaseClass |
||
8 | { |
||
9 | /** The URI of the action */ |
||
10 | const URI = 'https://api.signere.no/api/Form'; |
||
11 | |||
12 | /** |
||
13 | * Gets all forms to the authenticated documentprovider. |
||
14 | * |
||
15 | * @return object |
||
16 | */ |
||
17 | 1 | public function get() |
|
18 | { |
||
19 | // make the URL for this request |
||
20 | 1 | $url = sprintf('%s/GetForms', $this->getBaseUrl()); |
|
21 | |||
22 | // get the headers for this request |
||
23 | 1 | $headers = $this->headers->make('GET', $url); |
|
24 | |||
25 | // get the response |
||
26 | 1 | $response = $this->client->get($url, [ |
|
27 | 1 | 'headers' => $headers, |
|
28 | ]); |
||
29 | |||
30 | // return the response |
||
31 | 1 | return $response; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Gets all signed forms to the authenticated documentprovider |
||
36 | * filtered by the input parameters provided. |
||
37 | * |
||
38 | * @param string|null $formId |
||
39 | * @param Carbon|null $from |
||
40 | * @param Carbon|null $to |
||
41 | * @return object |
||
42 | */ |
||
43 | 1 | public function getAllSigned(string $formId = null, Carbon $from = null, Carbon $to = null) |
|
44 | { |
||
45 | // make the URL for this request |
||
46 | 1 | $url = sprintf( |
|
47 | 1 | '%s/GetSignedForms?formId=%s&fromDate=%s&toDate=%s', |
|
48 | 1 | $this->getBaseUrl(), |
|
49 | 1 | $formId, |
|
50 | 1 | $from ? $from->toDateString() : null, |
|
51 | 1 | $to ? $to->toDateString() : null |
|
52 | ); |
||
53 | |||
54 | // get the headers for this request |
||
55 | 1 | $headers = $this->headers->make('GET', $url); |
|
56 | |||
57 | // get the response |
||
58 | 1 | $response = $this->client->get($url, [ |
|
59 | 1 | 'headers' => $headers, |
|
60 | ]); |
||
61 | |||
62 | // return the response |
||
63 | 1 | return $response; |
|
64 | } |
||
65 | |||
66 | /** |
||
67 | * Gets the attachements to the form. |
||
68 | * |
||
69 | * @param string $formId |
||
70 | * @param string $formSignId |
||
71 | * @param string $attachReference |
||
72 | * @return object |
||
73 | */ |
||
74 | 1 | public function getAttachments(string $formId, string $formSignId, string $attachReference) |
|
75 | { |
||
76 | // make the URL for this request |
||
77 | 1 | $url = sprintf( |
|
78 | 1 | '%s/GetFormAttachment?formId=%s&FormSignatureId=%s&AttatchmentReference=%s', |
|
79 | 1 | $this->getBaseUrl(), |
|
80 | 1 | $formId, |
|
81 | 1 | $formSignId, |
|
82 | 1 | $attachReference |
|
83 | ); |
||
84 | |||
85 | // get the headers for this request |
||
86 | 1 | $headers = $this->headers->make('GET', $url); |
|
87 | |||
88 | // get the response |
||
89 | 1 | $response = $this->client->get($url, [ |
|
90 | 1 | 'headers' => $headers, |
|
91 | ]); |
||
92 | |||
93 | // return the response |
||
94 | 1 | return $response; |
|
95 | } |
||
96 | |||
97 | /** |
||
98 | * Gets a signed form from DocumentID. |
||
99 | * |
||
100 | * @param string $documentId |
||
101 | * @return object |
||
102 | */ |
||
103 | 1 | public function getSignedByDocId(string $documentId) |
|
104 | { |
||
105 | // make the URL for this request |
||
106 | 1 | $url = sprintf('%s/GetSignedForm?documentid=%s', $this->getBaseUrl(), $documentId); |
|
107 | |||
108 | // get the headers for this request |
||
109 | 1 | $headers = $this->headers->make('GET', $url); |
|
110 | |||
111 | // get the response |
||
112 | 1 | $response = $this->client->get($url, [ |
|
113 | 1 | 'headers' => $headers, |
|
114 | ]); |
||
115 | |||
116 | // return the response |
||
117 | 1 | return $response; |
|
118 | } |
||
119 | |||
120 | /** |
||
121 | * Gets a signed form from formId and formSessionId. |
||
122 | * |
||
123 | * @param string $formId |
||
124 | * @param string $formSessionId |
||
125 | * @return object |
||
126 | */ |
||
127 | 1 | public function getSignedBySessionId(string $formId, string $formSessionId) |
|
128 | { |
||
129 | // make the URL for this request |
||
130 | 1 | $url = sprintf( |
|
131 | 1 | '%s/GetSignedFormByFormSessionId?formId=%s&formSessionId=%s', |
|
132 | 1 | $this->getBaseUrl(), |
|
133 | 1 | $formId, |
|
134 | 1 | $formSessionId |
|
135 | ); |
||
136 | |||
137 | // get the headers for this request |
||
138 | 1 | $headers = $this->headers->make('GET', $url); |
|
139 | |||
140 | // get the response |
||
141 | 1 | $response = $this->client->get($url, [ |
|
142 | 1 | 'headers' => $headers, |
|
143 | ]); |
||
144 | |||
145 | // return the response |
||
146 | 1 | return $response; |
|
147 | } |
||
148 | |||
149 | /** |
||
150 | * Enables the form. |
||
151 | * |
||
152 | * @param string $formId |
||
153 | * @return object |
||
154 | */ |
||
155 | 1 | View Code Duplication | public function enable(string $formId) |
0 ignored issues
–
show
|
|||
156 | { |
||
157 | // make the URL for this request |
||
158 | 1 | $url = sprintf('%s/EnableForm?formId=%s', $this->getBaseUrl(), $formId); |
|
159 | |||
160 | // get the headers for this request |
||
161 | 1 | $headers = $this->headers->make('PUT', $url, []); |
|
162 | |||
163 | // get the response |
||
164 | 1 | $response = $this->client->put($url, [ |
|
165 | 1 | 'headers' => $headers, |
|
166 | 'json' => [], |
||
167 | ]); |
||
168 | |||
169 | // return the response |
||
170 | 1 | return $response; |
|
171 | } |
||
172 | |||
173 | /** |
||
174 | * Disables the form. |
||
175 | * |
||
176 | * @param string $formId |
||
177 | * @return object |
||
178 | */ |
||
179 | 1 | View Code Duplication | public function disable(string $formId) |
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. ![]() |
|||
180 | { |
||
181 | // make the URL for this request |
||
182 | 1 | $url = sprintf('%s/DisableForm?formId=%s', $this->getBaseUrl(), $formId); |
|
183 | |||
184 | // get the headers for this request |
||
185 | 1 | $headers = $this->headers->make('PUT', $url, []); |
|
186 | |||
187 | // get the response |
||
188 | 1 | $response = $this->client->put($url, [ |
|
189 | 1 | 'headers' => $headers, |
|
190 | 'json' => [], |
||
191 | ]); |
||
192 | |||
193 | // return the response |
||
194 | 1 | return $response; |
|
195 | } |
||
196 | } |
||
197 |
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.