These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | use Adlogix\ConfluenceClient\ClientBuilder; |
||
3 | use Adlogix\ConfluenceClient\Security\QueryParamAuthentication; |
||
4 | |||
5 | require_once 'vendor/autoload.php'; |
||
6 | |||
7 | |||
8 | /** |
||
9 | * See the 'installed' webhook on how to recover this payload. |
||
10 | * |
||
11 | * The sharedSecret is given by the application we installed the add-on to, |
||
12 | * this is needed to sign our request and to validate the requests from the application. |
||
13 | */ |
||
14 | View Code Duplication | if (file_exists('payload.json')) { |
|
0 ignored issues
–
show
|
|||
15 | $payload = json_decode(file_get_contents('payload.json')); |
||
16 | $sharedSecret = $payload->sharedSecret; |
||
17 | $baseUrl = $payload->baseUrl . '/'; |
||
18 | } |
||
19 | |||
20 | |||
21 | $authenticationMethod = new QueryParamAuthentication('eu.adlogix.confluence-client', $sharedSecret); |
||
22 | /** @var \Adlogix\ConfluenceClient\Client $client */ |
||
23 | $client = ClientBuilder::create($baseUrl, $authenticationMethod) |
||
24 | ->setDebug(true) |
||
25 | ->build(); |
||
26 | |||
27 | |||
28 | $response = $client->sendRawApiRequest('GET', 'space'); |
||
29 | var_dump($response->getBody()->getContents()); |
||
30 | |||
31 | echo "\r\n\r\n=====================================================================================================================================================================================================\r\n\r\n"; |
||
32 | $response = $client->downloadAttachment('download/attachments/197288/Seller%20Admin%20logo%20stats.png?api=v2'); |
||
33 | var_dump($response->getBody()->getContents()); |
||
34 |
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.