diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf6a3c7e..99ff50fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,8 +36,12 @@ jobs: - name: Install dependencies run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-suggest + - name: PHP Security Checker + uses: symfonycorp/security-checker-action@v2 + if: ${{ matrix.stability == 'prefer-stable' }} + - name: Execute tests run: vendor/bin/phpunit --coverage-clover=coverage.clover --verbose - name: Upload Code Coverage - run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover \ No newline at end of file + run: wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover diff --git a/src/Api/Client.php b/src/Api/Client.php index eacd11ca..1681836b 100644 --- a/src/Api/Client.php +++ b/src/Api/Client.php @@ -224,12 +224,10 @@ public function buildAuth() */ public function buildOptions(array $options = []) { - return array_merge_recursive( - $options, - [ - 'headers' => $this->getHeaders(), - ] - ); + return [ + 'body' => json_encode($options ?? []), + 'headers' => $this->getHeaders(), + ]; } /** @@ -340,7 +338,7 @@ public function getPassword() * * @return string */ - public function getUrl($path = null) + public function getUrl($path = '') { return $this->url . '/v4_6_release/apis/3.0/' . ltrim($path, '/'); } @@ -395,7 +393,7 @@ protected function isCollection(array $array) */ protected function isLastPage(ResponseInterface $response) { - return !(bool)preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? null); + return !(bool)preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? ''); } /** diff --git a/tests/Api/ClientTest.php b/tests/Api/ClientTest.php index 15eec3a1..f747f7ae 100644 --- a/tests/Api/ClientTest.php +++ b/tests/Api/ClientTest.php @@ -294,7 +294,7 @@ public function it_builds_the_expected_options_array() $this->client->setIntegrator($username); $options = [ - 'extra' => 'option', + 'body' => json_encode(['extra' => 'option']), 'headers' => [ 'added' => 'header', 'Accept' => 'application/vnd.connectwise.com+json; version=2019.5',