improve code style
Cette révision appartient à :
Parent
29a764bcfb
révision
59f927af32
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
@ -73,14 +75,14 @@ class Connection
|
|||||||
*/
|
*/
|
||||||
public function getClient(): ClientInterface
|
public function getClient(): ClientInterface
|
||||||
{
|
{
|
||||||
$this->client = $this->client ??
|
$this->client ??=
|
||||||
new Client([
|
new Client([
|
||||||
'base_uri' => self::URL,
|
'base_uri' => self::URL,
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'Content-Type' => 'application/json',
|
'Content-Type' => 'application/json',
|
||||||
'Accept' => 'application/json',
|
'Accept' => 'application/json',
|
||||||
'User-Agent' => self::USERAGENT.'/'.InstalledVersions::getVersion('d3/klicktipp-php-client')
|
'User-Agent' => self::USERAGENT.'/'.InstalledVersions::getVersion('d3/klicktipp-php-client'),
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $this->client;
|
return $this->client;
|
||||||
@ -91,12 +93,12 @@ class Connection
|
|||||||
* @param string $uri
|
* @param string $uri
|
||||||
* @param array $options
|
* @param array $options
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
* @throws BaseException|GuzzleException
|
* @throws BaseException
|
||||||
*/
|
*/
|
||||||
public function request(string $method, string $uri, array $options = []): ResponseInterface
|
public function request(string $method, string $uri, array $options = []): ResponseInterface
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$options['query'] = $options['query'] ?? [];
|
$options['query'] ??= [];
|
||||||
$options[RequestOptions::COOKIES] = $this->getCookiesJar();
|
$options[RequestOptions::COOKIES] = $this->getCookiesJar();
|
||||||
|
|
||||||
if (! empty($options['body'])) {
|
if (! empty($options['body'])) {
|
||||||
@ -114,6 +116,8 @@ class Connection
|
|||||||
$e->getResponse()->getStatusCode(),
|
$e->getResponse()->getStatusCode(),
|
||||||
$e
|
$e
|
||||||
);
|
);
|
||||||
|
} catch (GuzzleException $e) {
|
||||||
|
throw new BaseException($e->getMessage(), $e->getCode(), $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +127,6 @@ class Connection
|
|||||||
* @param array $options
|
* @param array $options
|
||||||
* @return array
|
* @return array
|
||||||
* @throws BaseException
|
* @throws BaseException
|
||||||
* @throws GuzzleException
|
|
||||||
*/
|
*/
|
||||||
public function requestAndParse(string $method, string $uri, array $options = []): array
|
public function requestAndParse(string $method, string $uri, array $options = []): array
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* https://www.d3data.de
|
||||||
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
|
* @link https://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
namespace D3\KlicktippPhpClient\Exceptions;
|
namespace D3\KlicktippPhpClient\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* https://www.d3data.de
|
||||||
|
*
|
||||||
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
|
* @link https://www.oxidmodule.com
|
||||||
|
*/
|
||||||
|
|
||||||
namespace D3\KlicktippPhpClient\Exceptions;
|
namespace D3\KlicktippPhpClient\Exceptions;
|
||||||
|
|
||||||
class NoCredentialsException extends BaseException
|
class NoCredentialsException extends BaseException
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* file that was distributed with this source code.
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
*
|
*
|
||||||
* https://www.d3data.de
|
* https://www.d3data.de
|
||||||
*
|
*
|
||||||
|
Chargement…
x
Référencer dans un nouveau ticket
Bloquer un utilisateur