• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Bynder / bynder-php-sdk / 7399777493

03 Jan 2024 04:24PM UTC coverage: 48.083% (+5.0%) from 43.042%
7399777493

push

github

web-flow
API-1824 [BE][PHP SDK] Implement Sample Files for Functionality Testing (#66)

* API-1824 setup sample files PHP sdk

* API-1824 media sample methods, add uploads sample method call

* API-1824 list asset ids within collection, sample collections

* API-1824 asset usage sample

* API-1824 metaproperty changes, options/dependencies for sample file

* API-1824 dockerize bynder php sdk to run sample files

* API-1824 add additional download url method calls, add makefile/docker files, add README for instructions

* API-1824 use var_dump for BrandsSample.php

* API-1824 cleanup

* API-1824 use correct file path to sample image

* API-1824 update README for docker build

163 of 339 relevant lines covered (48.08%)

2.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Bynder/Api/Impl/AbstractRequestHandler.php
1
<?php
2
namespace Bynder\Api\Impl;
3

4
abstract class AbstractRequestHandler
5
{
6
    protected $configuration;
7

8
    public function sendRequestAsync($requestMethod, $uri, $options = [])
9
    {
10
        $uri = sprintf(
×
11
            'https://%s/%s', $this->configuration->getBynderDomain(), $uri
×
12
        );
13

14
        if (!in_array($requestMethod, ['GET', 'POST', 'DELETE'])) {
×
15
            throw new \Exception('Invalid request method provided');
×
16
        }
17

18
        $request = $this->sendAuthenticatedRequest($requestMethod, $uri, $options);
×
19

20
        return $request->then(
×
21
            function ($response) {
22
                // Some 204 No Content responses have no content type header.
23
                if ($response->getStatusCode() === 204 && !$response->hasHeader('Content-Type')) {
×
24
                  return NULL;
×
25
                }
26
                $mimeType = explode(';', $response->getHeader('Content-Type')[0])[0];
×
27
                switch($mimeType) {
28
                    case 'application/json':
×
29
                        return json_decode($response->getBody(), true);
×
30
                    case 'text/plain':
×
31
                        return (string)$response->getBody();
×
32
                    case 'text/html':
×
33
                        return $response;
×
34
                    default:
35
                        throw new \Exception('The response type not recognized.');
×
36
                }
37
            }
38
        );
39
    }
40

41
    abstract protected function sendAuthenticatedRequest($requestMethod, $uri, $options = []);
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc