From 08d118a84274ed4ebbb62e803344ed2f864b97ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB?= Date: Tue, 29 Sep 2020 16:35:45 +0300 Subject: [PATCH] add phpmd --- composer.json | 4 +- phpmd.xml | 39 ++++++++++++++ src/Builder/ClientBuilder.php | 4 +- src/Builder/ContainerBuilder.php | 10 ++-- src/Component/AppData.php | 4 +- .../Authenticator/TokenAuthenticator.php | 4 +- src/Component/Constants.php | 4 +- .../DependencyInjection/Container.php | 15 ++++-- .../Exception/ContainerException.php | 4 +- .../Exception/NotFoundException.php | 4 +- .../DependencyInjection/FactoryInterface.php | 4 +- src/Component/Environment.php | 4 +- src/Component/Exception/FactoryException.php | 4 +- .../Exception/NotImplementedException.php | 4 +- .../Exception/ValidationException.php | 4 +- src/Component/Logger/AbstractLogger.php | 4 +- src/Component/Logger/FileLogger.php | 4 +- src/Component/Logger/StdoutLogger.php | 4 +- src/Component/Psr7/AppendStream.php | 29 +++++----- src/Component/Psr7/BufferStream.php | 11 ++-- src/Component/Psr7/MultipartStream.php | 21 +++++--- src/Component/Psr7/PumpStream.php | 9 ++-- src/Component/Psr7/Stream.php | 54 +++++++++++-------- src/Component/Psr7/Utils.php | 14 +++-- src/Component/ServiceLocator.php | 4 +- src/Factory/FileItemFactory.php | 4 +- src/Factory/RequestFactory.php | 5 +- src/Factory/SerializationContextFactory.php | 4 +- src/Factory/SerializerFactory.php | 4 +- src/Interfaces/AppDataInterface.php | 4 +- src/Interfaces/AuthenticatorInterface.php | 4 +- src/Interfaces/BuilderInterface.php | 4 +- src/Interfaces/ContainerAwareInterface.php | 4 +- src/Interfaces/FactoryInterface.php | 4 +- src/Interfaces/FileItemFactoryInterface.php | 4 +- src/Interfaces/FileItemInterface.php | 4 +- src/Interfaces/RequestDtoInterface.php | 4 +- src/Interfaces/RequestFactoryInterface.php | 4 +- src/Interfaces/RequestSignerInterface.php | 4 +- .../RequestTimestampProviderInterface.php | 4 +- src/Model/FileItem.php | 4 +- src/Model/Request/BaseRequest.php | 4 +- src/Model/Request/HttpDnsGetRequest.php | 4 +- src/Service/RequestDataFilter.php | 4 +- src/Service/RequestSigner.php | 4 +- src/Service/RequestTimestampProvider.php | 6 +-- src/TopClient/Client.php | 9 ++-- src/Traits/ContainerAwareTrait.php | 4 +- src/Traits/ValidatorAwareTrait.php | 4 +- 49 files changed, 223 insertions(+), 147 deletions(-) create mode 100644 phpmd.xml diff --git a/composer.json b/composer.json index e9f801a..3121cbb 100644 --- a/composer.json +++ b/composer.json @@ -39,8 +39,10 @@ }, "scripts": { "phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist", + "phpmd": "./vendor/bin/phpmd src text controversial,design,./phpmd.xml", "phpcs": "./vendor/bin/phpcs -p src --runtime-set testVersion 7.3", - "phpcbf": "./vendor/bin/phpcbf -p src" + "phpcbf": "./vendor/bin/phpcbf -p src", + "test": "composer run-script phpmd && composer run-script phpunit" }, "prefer-stable": true, "license": "MIT" diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 0000000..fee5306 --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,39 @@ + + + Ruleset + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + tests/* + diff --git a/src/Builder/ClientBuilder.php b/src/Builder/ClientBuilder.php index eee3012..cdc1b09 100644 --- a/src/Builder/ClientBuilder.php +++ b/src/Builder/ClientBuilder.php @@ -6,7 +6,7 @@ * @category ClientBuilder * @package RetailCrm\Builder * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -30,7 +30,7 @@ use RetailCrm\Traits\ContainerAwareTrait; * @category ClientBuilder * @package RetailCrm\Builder * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Builder/ContainerBuilder.php b/src/Builder/ContainerBuilder.php index f0b24ea..9c728d3 100644 --- a/src/Builder/ContainerBuilder.php +++ b/src/Builder/ContainerBuilder.php @@ -6,7 +6,7 @@ * @category ContainerBuilder * @package RetailCrm\Builder * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -31,6 +31,7 @@ use RetailCrm\Interfaces\RequestTimestampProviderInterface; use RetailCrm\Service\RequestDataFilter; use RetailCrm\Service\RequestSigner; use RetailCrm\Service\RequestTimestampProvider; +use RuntimeException; use Shieldon\Psr17\StreamFactory; use Symfony\Component\Validator\Validation; use Symfony\Component\Validator\Validator\TraceableValidator; @@ -42,9 +43,12 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; * @category ContainerBuilder * @package RetailCrm\Builder * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru + * + * ContainerBuilder should be like that. + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ContainerBuilder implements BuilderInterface { @@ -121,7 +125,7 @@ class ContainerBuilder implements BuilderInterface $this->setDevServices($container); break; default: - throw new \RuntimeException(sprintf('Invalid environment type: %s', $this->env)); + throw new RuntimeException(sprintf('Invalid environment type: %s', $this->env)); } return $container; diff --git a/src/Component/AppData.php b/src/Component/AppData.php index 3c3e4d5..ed183dd 100644 --- a/src/Component/AppData.php +++ b/src/Component/AppData.php @@ -6,7 +6,7 @@ * @category AppData * @package RetailCrm\Component * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @category AppData * @package RetailCrm\Component * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Authenticator/TokenAuthenticator.php b/src/Component/Authenticator/TokenAuthenticator.php index 35bbdcc..5a91e7e 100644 --- a/src/Component/Authenticator/TokenAuthenticator.php +++ b/src/Component/Authenticator/TokenAuthenticator.php @@ -6,7 +6,7 @@ * @category TokenAuthenticator * @package RetailCrm\Component\Authenticator * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category TokenAuthenticator * @package RetailCrm\Component\Authenticator * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Constants.php b/src/Component/Constants.php index 7487614..d7fc3d6 100644 --- a/src/Component/Constants.php +++ b/src/Component/Constants.php @@ -6,7 +6,7 @@ * @category Constants * @package RetailCrm\Component * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component; * @category Constants * @package RetailCrm\Component * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/DependencyInjection/Container.php b/src/Component/DependencyInjection/Container.php index 0713692..095a925 100644 --- a/src/Component/DependencyInjection/Container.php +++ b/src/Component/DependencyInjection/Container.php @@ -6,7 +6,7 @@ * @category Container * @package RetailCrm\Component\DependencyInjection * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -30,7 +30,7 @@ use Throwable; * @package RetailCrm\Component\DependencyInjection * @author Evgeniy Zyubin * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -190,17 +190,22 @@ final class Container implements ContainerInterface * @param ReflectionClass $reflection * @return object * @throws ContainerException If unable to create object. + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ private function getObjectFromReflection(ReflectionClass $reflection): object { - if (($constructor = $reflection->getConstructor()) === null) { + $constructor = $reflection->getConstructor(); + + if (null === $constructor) { return $reflection->newInstance(); } $arguments = []; foreach ($constructor->getParameters() as $parameter) { - if ($type = $parameter->getType()) { + $type = $parameter->getType(); + + if ($type) { $typeName = $type->getName(); if (!$type->isBuiltin() && ($this->has($typeName) || self::isClassName($typeName))) { @@ -218,7 +223,7 @@ final class Container implements ContainerInterface try { $arguments[] = $parameter->getDefaultValue(); continue; - } catch (ReflectionException $e) { + } catch (ReflectionException $exception) { throw new ContainerException( sprintf( 'Unable to create object `%s`. Unable to get default value of constructor parameter: `%s`.', diff --git a/src/Component/DependencyInjection/Exception/ContainerException.php b/src/Component/DependencyInjection/Exception/ContainerException.php index beed645..a9f16ab 100644 --- a/src/Component/DependencyInjection/Exception/ContainerException.php +++ b/src/Component/DependencyInjection/Exception/ContainerException.php @@ -6,7 +6,7 @@ * @category ContainerException * @package RetailCrm\Component\DependencyInjection\Exception * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -22,7 +22,7 @@ use LogicException; * @package RetailCrm\Component\DependencyInjection\Exception * @author Evgeniy Zyubin * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/DependencyInjection/Exception/NotFoundException.php b/src/Component/DependencyInjection/Exception/NotFoundException.php index 9207e2d..40d39c7 100644 --- a/src/Component/DependencyInjection/Exception/NotFoundException.php +++ b/src/Component/DependencyInjection/Exception/NotFoundException.php @@ -6,7 +6,7 @@ * @category NotFoundException * @package RetailCrm\Component\DependencyInjection\Exception * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -22,7 +22,7 @@ use InvalidArgumentException; * @package RetailCrm\Component\DependencyInjection\Exception * @author Evgeniy Zyubin * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/DependencyInjection/FactoryInterface.php b/src/Component/DependencyInjection/FactoryInterface.php index a79e492..7f2932e 100644 --- a/src/Component/DependencyInjection/FactoryInterface.php +++ b/src/Component/DependencyInjection/FactoryInterface.php @@ -6,7 +6,7 @@ * @category FactoryInterface * @package RetailCrm\Component\DependencyInjection * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use Psr\Container\ContainerInterface; * @package RetailCrm\Component\DependencyInjection * @author Evgeniy Zyubin * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Environment.php b/src/Component/Environment.php index ec2a58d..ec058b2 100644 --- a/src/Component/Environment.php +++ b/src/Component/Environment.php @@ -6,7 +6,7 @@ * @category Environment * @package RetailCrm\Component * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component; * @category Environment * @package RetailCrm\Component * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Exception/FactoryException.php b/src/Component/Exception/FactoryException.php index 7605122..bf1d469 100644 --- a/src/Component/Exception/FactoryException.php +++ b/src/Component/Exception/FactoryException.php @@ -6,7 +6,7 @@ * @category FactoryException * @package RetailCrm\Component\Exception * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component\Exception; * @category FactoryException * @package RetailCrm\Component\Exception * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Exception/NotImplementedException.php b/src/Component/Exception/NotImplementedException.php index d440445..b8ce3b0 100644 --- a/src/Component/Exception/NotImplementedException.php +++ b/src/Component/Exception/NotImplementedException.php @@ -6,7 +6,7 @@ * @category NotImplementedException * @package RetailCrm\Component\Exception * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component\Exception; * @category NotImplementedException * @package RetailCrm\Component\Exception * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Exception/ValidationException.php b/src/Component/Exception/ValidationException.php index 6411f10..f3707b9 100644 --- a/src/Component/Exception/ValidationException.php +++ b/src/Component/Exception/ValidationException.php @@ -6,7 +6,7 @@ * @category ValidationException * @package RetailCrm\Component\Exception * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use Throwable; * @category ValidationException * @package RetailCrm\Component\Exception * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Logger/AbstractLogger.php b/src/Component/Logger/AbstractLogger.php index fe6b4a1..f0ee584 100644 --- a/src/Component/Logger/AbstractLogger.php +++ b/src/Component/Logger/AbstractLogger.php @@ -6,7 +6,7 @@ * @category AbstractLogger * @package RetailCrm\Component\Logger * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -20,7 +20,7 @@ use Psr\Log\AbstractLogger as BaseAbstractLogger; * @category AbstractLogger * @package RetailCrm\Component\Logger * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Logger/FileLogger.php b/src/Component/Logger/FileLogger.php index 4b6332f..b5caae3 100644 --- a/src/Component/Logger/FileLogger.php +++ b/src/Component/Logger/FileLogger.php @@ -6,7 +6,7 @@ * @category FileLogger * @package RetailCrm\Component\Logger * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component\Logger; * @category FileLogger * @package RetailCrm\Component\Logger * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Logger/StdoutLogger.php b/src/Component/Logger/StdoutLogger.php index 2611256..342ba32 100644 --- a/src/Component/Logger/StdoutLogger.php +++ b/src/Component/Logger/StdoutLogger.php @@ -6,7 +6,7 @@ * @category StdioLogger * @package RetailCrm\Component\Logger * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Component\Logger; * @category StdioLogger * @package RetailCrm\Component\Logger * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Component/Psr7/AppendStream.php b/src/Component/Psr7/AppendStream.php index 99796c1..44282a2 100644 --- a/src/Component/Psr7/AppendStream.php +++ b/src/Component/Psr7/AppendStream.php @@ -6,13 +6,15 @@ * @category AppendStream * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; +use InvalidArgumentException; use Psr\Http\Message\StreamInterface; +use RuntimeException; /** * Class AppendStream @@ -21,7 +23,7 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -81,7 +83,7 @@ class AppendStream implements StreamInterface public function addStream(StreamInterface $stream): void { if (!$stream->isReadable()) { - throw new \InvalidArgumentException('Each stream must be readable'); + throw new InvalidArgumentException('Each stream must be readable'); } // The stream is only seekable if all streams are seekable @@ -154,13 +156,13 @@ class AppendStream implements StreamInterface $size = 0; foreach ($this->streams as $stream) { - $s = $stream->getSize(); + $streamSize = $stream->getSize(); - if ($s === null) { + if ($streamSize === null) { return null; } - $size += $s; + $size += $streamSize; } return $size; @@ -193,28 +195,29 @@ class AppendStream implements StreamInterface public function seek($offset, $whence = SEEK_SET): void { if (!$this->seekable) { - throw new \RuntimeException('This AppendStream is not seekable'); + throw new RuntimeException('This AppendStream is not seekable'); } if ($whence !== SEEK_SET) { - throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + throw new RuntimeException('The AppendStream can only seek with SEEK_SET'); } $this->pos = $this->current = 0; // Rewind each stream - foreach ($this->streams as $i => $stream) { + foreach ($this->streams as $index => $stream) { try { $stream->rewind(); - } catch (\Exception $e) { - throw new \RuntimeException('Unable to seek stream ' - . $i . ' of the AppendStream', 0, $e); + } catch (\Exception $exception) { + throw new RuntimeException('Unable to seek stream ' + . $index . ' of the AppendStream', 0, $exception); } } // Seek to the actual position by reading from each stream while ($this->pos < $offset && !$this->eof()) { $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { break; } @@ -294,7 +297,7 @@ class AppendStream implements StreamInterface */ public function write($string): int { - throw new \RuntimeException('Cannot write to an AppendStream'); + throw new RuntimeException('Cannot write to an AppendStream'); } /** diff --git a/src/Component/Psr7/BufferStream.php b/src/Component/Psr7/BufferStream.php index 41e9a96..2e822de 100644 --- a/src/Component/Psr7/BufferStream.php +++ b/src/Component/Psr7/BufferStream.php @@ -6,13 +6,14 @@ * @category BufferStream * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; use Psr\Http\Message\StreamInterface; +use RuntimeException; /** * Class BufferStream @@ -21,7 +22,7 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -128,7 +129,7 @@ class BufferStream implements StreamInterface */ public function seek($offset, $whence = SEEK_SET): void { - throw new \RuntimeException('Cannot seek a BufferStream'); + throw new RuntimeException('Cannot seek a BufferStream'); } /** @@ -136,7 +137,7 @@ class BufferStream implements StreamInterface */ public function eof(): bool { - return strlen($this->buffer) === 0; + return $this->buffer === ''; } /** @@ -144,7 +145,7 @@ class BufferStream implements StreamInterface */ public function tell(): int { - throw new \RuntimeException('Cannot determine the position of a BufferStream'); + throw new RuntimeException('Cannot determine the position of a BufferStream'); } /** diff --git a/src/Component/Psr7/MultipartStream.php b/src/Component/Psr7/MultipartStream.php index d6f41d4..926631a 100644 --- a/src/Component/Psr7/MultipartStream.php +++ b/src/Component/Psr7/MultipartStream.php @@ -6,13 +6,16 @@ * @category MultipartStream * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; +use InvalidArgumentException; use Psr\Http\Message\StreamInterface; +use RuntimeException; +use UnexpectedValueException; /** * Class MultipartStream @@ -21,7 +24,7 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -68,7 +71,7 @@ class MultipartStream implements StreamInterface return $this->stream; } - throw new \UnexpectedValueException("$name not found on class"); + throw new UnexpectedValueException("$name not found on class"); } /** @@ -77,7 +80,7 @@ class MultipartStream implements StreamInterface */ public function __set(string $name, $value) { - throw new \RuntimeException('Not implemented'); + throw new RuntimeException('Not implemented'); } /** @@ -85,7 +88,7 @@ class MultipartStream implements StreamInterface */ public function __isset(string $name) { - throw new \RuntimeException('Not implemented'); + throw new RuntimeException('Not implemented'); } /** @@ -300,7 +303,7 @@ class MultipartStream implements StreamInterface { foreach (['contents', 'name'] as $key) { if (!array_key_exists($key, $element)) { - throw new \InvalidArgumentException("A '{$key}' key is required"); + throw new InvalidArgumentException("A '{$key}' key is required"); } } @@ -352,14 +355,16 @@ class MultipartStream implements StreamInterface // Set a default content-length header if one was no provided $length = $this->getHeader($headers, 'content-length'); - if (!$length && $length = $stream->getSize()) { + if (!$length) { + $length = $stream->getSize(); $headers['Content-Length'] = (string) $length; } // Set a default Content-Type if one was not supplied $type = $this->getHeader($headers, 'content-type'); - if (!$type && ($filename === '0' || $filename) && $type = Utils::mimetypeFromFilename($filename)) { + if (!$type && ($filename === '0' || $filename)) { + $type = Utils::mimetypeFromFilename($filename); $headers['Content-Type'] = $type; } diff --git a/src/Component/Psr7/PumpStream.php b/src/Component/Psr7/PumpStream.php index 978eb0a..2bbc231 100644 --- a/src/Component/Psr7/PumpStream.php +++ b/src/Component/Psr7/PumpStream.php @@ -6,13 +6,14 @@ * @category PumpStream * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; use Psr\Http\Message\StreamInterface; +use RuntimeException; /** * Class PumpStream @@ -21,7 +22,7 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -142,7 +143,7 @@ class PumpStream implements StreamInterface */ public function seek($offset, $whence = SEEK_SET): void { - throw new \RuntimeException('Cannot seek a PumpStream'); + throw new RuntimeException('Cannot seek a PumpStream'); } /** @@ -160,7 +161,7 @@ class PumpStream implements StreamInterface */ public function write($string): int { - throw new \RuntimeException('Cannot write to a PumpStream'); + throw new RuntimeException('Cannot write to a PumpStream'); } /** diff --git a/src/Component/Psr7/Stream.php b/src/Component/Psr7/Stream.php index c9336ce..e613267 100644 --- a/src/Component/Psr7/Stream.php +++ b/src/Component/Psr7/Stream.php @@ -6,13 +6,15 @@ * @category Stream * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; +use InvalidArgumentException; use Psr\Http\Message\StreamInterface; +use RuntimeException; /** * Class Stream @@ -21,9 +23,10 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ class Stream implements StreamInterface { @@ -75,7 +78,7 @@ class Stream implements StreamInterface public function __construct($stream, array $options = []) { if (!is_resource($stream)) { - throw new \InvalidArgumentException('Stream must be a resource'); + throw new InvalidArgumentException('Stream must be a resource'); } if (isset($options['size'])) { @@ -111,12 +114,16 @@ class Stream implements StreamInterface } return $this->getContents(); - } catch (\Throwable $e) { + } catch (\Throwable $exception) { if (\PHP_VERSION_ID >= 70400) { - throw $e; + throw $exception; } - trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), E_USER_ERROR); + trigger_error(sprintf( + '%s::__toString exception: %s', + self::class, (string) $exception), + E_USER_ERROR + ); } } @@ -126,13 +133,13 @@ class Stream implements StreamInterface public function getContents(): string { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } $contents = stream_get_contents($this->stream); if ($contents === false) { - throw new \RuntimeException('Unable to read stream contents'); + throw new RuntimeException('Unable to read stream contents'); } return $contents; @@ -162,8 +169,11 @@ class Stream implements StreamInterface } $result = $this->stream; + unset($this->stream); - $this->size = $this->uri = null; + + $this->uri = null; + $this->size = null; $this->readable = false; $this->writable = false; $this->seekable = false; @@ -228,7 +238,7 @@ class Stream implements StreamInterface public function eof(): bool { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } return feof($this->stream); @@ -240,13 +250,13 @@ class Stream implements StreamInterface public function tell(): int { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } $result = ftell($this->stream); if ($result === false) { - throw new \RuntimeException('Unable to determine stream position'); + throw new RuntimeException('Unable to determine stream position'); } return $result; @@ -269,15 +279,15 @@ class Stream implements StreamInterface $whence = (int) $whence; if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->seekable) { - throw new \RuntimeException('Stream is not seekable'); + throw new RuntimeException('Stream is not seekable'); } if (fseek($this->stream, $offset, $whence) === -1) { - throw new \RuntimeException('Unable to seek to stream position ' + throw new RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . var_export($whence, true)); } } @@ -290,15 +300,15 @@ class Stream implements StreamInterface public function read($length): string { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->readable) { - throw new \RuntimeException('Cannot read from non-readable stream'); + throw new RuntimeException('Cannot read from non-readable stream'); } if ($length < 0) { - throw new \RuntimeException('Length parameter cannot be negative'); + throw new RuntimeException('Length parameter cannot be negative'); } if (0 === $length) { @@ -308,7 +318,7 @@ class Stream implements StreamInterface $string = fread($this->stream, $length); if (false === $string) { - throw new \RuntimeException('Unable to read from stream'); + throw new RuntimeException('Unable to read from stream'); } return $string; @@ -322,11 +332,11 @@ class Stream implements StreamInterface public function write($string): int { if (!isset($this->stream)) { - throw new \RuntimeException('Stream is detached'); + throw new RuntimeException('Stream is detached'); } if (!$this->writable) { - throw new \RuntimeException('Cannot write to a non-writable stream'); + throw new RuntimeException('Cannot write to a non-writable stream'); } // We can't know the size after writing anything @@ -334,7 +344,7 @@ class Stream implements StreamInterface $result = fwrite($this->stream, $string); if ($result === false) { - throw new \RuntimeException('Unable to write to stream'); + throw new RuntimeException('Unable to write to stream'); } return $result; diff --git a/src/Component/Psr7/Utils.php b/src/Component/Psr7/Utils.php index d6a220c..95f3be9 100644 --- a/src/Component/Psr7/Utils.php +++ b/src/Component/Psr7/Utils.php @@ -6,13 +6,15 @@ * @category Utils * @package RetailCrm\Component\Psr7 * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ namespace RetailCrm\Component\Psr7; +use InvalidArgumentException; use Psr\Http\Message\StreamInterface; +use RuntimeException; /** * Class Utils @@ -21,7 +23,7 @@ use Psr\Http\Message\StreamInterface; * @package RetailCrm\Component\Psr7 * @author Michael Dowling * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -87,7 +89,7 @@ class Utils $ex = null; set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool { - $ex = new \RuntimeException(sprintf( + $ex = new RuntimeException(sprintf( 'Unable to open %s using mode %s: %s', $filename, $mode, @@ -121,6 +123,7 @@ class Utils * * @return \Psr\Http\Message\StreamInterface * @throws \InvalidArgumentException if the $resource arg is not valid. + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public static function streamFor($resource = '', array $options = []): StreamInterface { @@ -167,7 +170,7 @@ class Utils return new PumpStream($resource, $options); } - throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); + throw new InvalidArgumentException('Invalid resource type: ' . gettype($resource)); } /** @@ -190,10 +193,11 @@ class Utils * @param string $extension * * @return string|null + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public static function mimetypeFromExtension(string $extension): ?string { - static $mimetypes = [ + $mimetypes = [ '3gp' => 'video/3gpp', '7z' => 'application/x-7z-compressed', 'aac' => 'audio/x-aac', diff --git a/src/Component/ServiceLocator.php b/src/Component/ServiceLocator.php index 24ee05b..330017b 100644 --- a/src/Component/ServiceLocator.php +++ b/src/Component/ServiceLocator.php @@ -6,7 +6,7 @@ * @category ServiceLocator * @package RetailCrm\Component * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -23,7 +23,7 @@ use RetailCrm\Traits\ContainerAwareTrait; * @category ServiceLocator * @package RetailCrm\Component * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Factory/FileItemFactory.php b/src/Factory/FileItemFactory.php index 41fa959..7f6f221 100644 --- a/src/Factory/FileItemFactory.php +++ b/src/Factory/FileItemFactory.php @@ -6,7 +6,7 @@ * @category FileItemFactory * @package RetailCrm\Factory * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -23,7 +23,7 @@ use RetailCrm\Model\FileItem; * @category FileItemFactory * @package RetailCrm\Factory * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Factory/RequestFactory.php b/src/Factory/RequestFactory.php index 66eeb9b..8f628c5 100644 --- a/src/Factory/RequestFactory.php +++ b/src/Factory/RequestFactory.php @@ -6,7 +6,7 @@ * @category RequestFactory * @package RetailCrm\Factory * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -35,9 +35,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; * @category RequestFactory * @package RetailCrm\Factory * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class RequestFactory implements RequestFactoryInterface { diff --git a/src/Factory/SerializationContextFactory.php b/src/Factory/SerializationContextFactory.php index cdd8d4e..8d9c679 100644 --- a/src/Factory/SerializationContextFactory.php +++ b/src/Factory/SerializationContextFactory.php @@ -6,7 +6,7 @@ * @category SerializationContextFactory * @package RetailCrm\Factory * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use JMS\Serializer\SerializationContext; * @category SerializationContextFactory * @package RetailCrm\Factory * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Factory/SerializerFactory.php b/src/Factory/SerializerFactory.php index f757f41..a70dc7e 100644 --- a/src/Factory/SerializerFactory.php +++ b/src/Factory/SerializerFactory.php @@ -6,7 +6,7 @@ * @category SerializerFactory * @package RetailCrm\Factory * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -27,7 +27,7 @@ use RetailCrm\Interfaces\FactoryInterface; * @category SerializerFactory * @package RetailCrm\Factory * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/AppDataInterface.php b/src/Interfaces/AppDataInterface.php index 5449485..dd034ae 100644 --- a/src/Interfaces/AppDataInterface.php +++ b/src/Interfaces/AppDataInterface.php @@ -6,7 +6,7 @@ * @category AppDataInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces; * @category AppDataInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/AuthenticatorInterface.php b/src/Interfaces/AuthenticatorInterface.php index d936fd7..1f6b8a6 100644 --- a/src/Interfaces/AuthenticatorInterface.php +++ b/src/Interfaces/AuthenticatorInterface.php @@ -6,7 +6,7 @@ * @category AuthenticatorInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category AuthenticatorInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/BuilderInterface.php b/src/Interfaces/BuilderInterface.php index 58279da..9e63f29 100644 --- a/src/Interfaces/BuilderInterface.php +++ b/src/Interfaces/BuilderInterface.php @@ -6,7 +6,7 @@ * @category BuilderInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces; * @category BuilderInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/ContainerAwareInterface.php b/src/Interfaces/ContainerAwareInterface.php index ae8ab5d..7726273 100644 --- a/src/Interfaces/ContainerAwareInterface.php +++ b/src/Interfaces/ContainerAwareInterface.php @@ -6,7 +6,7 @@ * @category ContainerAwareInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use Psr\Container\ContainerInterface; * @category ContainerAwareInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/FactoryInterface.php b/src/Interfaces/FactoryInterface.php index baa11e9..a814f74 100644 --- a/src/Interfaces/FactoryInterface.php +++ b/src/Interfaces/FactoryInterface.php @@ -6,7 +6,7 @@ * @category FactoryInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces; * @category FactoryInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/FileItemFactoryInterface.php b/src/Interfaces/FileItemFactoryInterface.php index 7495953..862bbe3 100644 --- a/src/Interfaces/FileItemFactoryInterface.php +++ b/src/Interfaces/FileItemFactoryInterface.php @@ -6,7 +6,7 @@ * @category FactoryInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces; * @category FileItemFactoryInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/FileItemInterface.php b/src/Interfaces/FileItemInterface.php index 1e24273..8cf5eca 100644 --- a/src/Interfaces/FileItemInterface.php +++ b/src/Interfaces/FileItemInterface.php @@ -6,7 +6,7 @@ * @category FileItemInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use Psr\Http\Message\StreamInterface; * @category FileItemInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/RequestDtoInterface.php b/src/Interfaces/RequestDtoInterface.php index 0808548..c55d344 100644 --- a/src/Interfaces/RequestDtoInterface.php +++ b/src/Interfaces/RequestDtoInterface.php @@ -6,7 +6,7 @@ * @category RequestDtoInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces; * @category RequestDtoInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/RequestFactoryInterface.php b/src/Interfaces/RequestFactoryInterface.php index 54922aa..0b5c2ba 100644 --- a/src/Interfaces/RequestFactoryInterface.php +++ b/src/Interfaces/RequestFactoryInterface.php @@ -6,7 +6,7 @@ * @category RequestFactoryInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -22,7 +22,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category RequestFactoryInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/RequestSignerInterface.php b/src/Interfaces/RequestSignerInterface.php index 9873e75..39dac4a 100644 --- a/src/Interfaces/RequestSignerInterface.php +++ b/src/Interfaces/RequestSignerInterface.php @@ -6,7 +6,7 @@ * @category RequestSignerInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category RequestSignerInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Interfaces/RequestTimestampProviderInterface.php b/src/Interfaces/RequestTimestampProviderInterface.php index 299925a..204e538 100644 --- a/src/Interfaces/RequestTimestampProviderInterface.php +++ b/src/Interfaces/RequestTimestampProviderInterface.php @@ -6,7 +6,7 @@ * @category RequestTimestampProviderInterface * @package RetailCrm\Interfaces * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category RequestTimestampProviderInterface * @package RetailCrm\Interfaces * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Model/FileItem.php b/src/Model/FileItem.php index aa8f271..c42b056 100644 --- a/src/Model/FileItem.php +++ b/src/Model/FileItem.php @@ -6,7 +6,7 @@ * @category FileItem * @package RetailCrm\Model * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -21,7 +21,7 @@ use RetailCrm\Interfaces\FileItemInterface; * @category FileItem * @package RetailCrm\Model * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Model/Request/BaseRequest.php b/src/Model/Request/BaseRequest.php index 667519f..273e663 100644 --- a/src/Model/Request/BaseRequest.php +++ b/src/Model/Request/BaseRequest.php @@ -6,7 +6,7 @@ * @category BaseRequest * @package RetailCrm\Model\Request * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @category BaseRequest * @package RetailCrm\Model\Request * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Model/Request/HttpDnsGetRequest.php b/src/Model/Request/HttpDnsGetRequest.php index 44a05d0..ee1b1a6 100644 --- a/src/Model/Request/HttpDnsGetRequest.php +++ b/src/Model/Request/HttpDnsGetRequest.php @@ -6,7 +6,7 @@ * @category HttpDnsGetRequest * @package RetailCrm\Model\Request * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -18,7 +18,7 @@ namespace RetailCrm\Model\Request; * @category HttpDnsGetRequest * @package RetailCrm\Model\Request * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Service/RequestDataFilter.php b/src/Service/RequestDataFilter.php index 241343d..e1c45ec 100644 --- a/src/Service/RequestDataFilter.php +++ b/src/Service/RequestDataFilter.php @@ -6,7 +6,7 @@ * @category RequestDataFilter * @package RetailCrm\Service * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -20,7 +20,7 @@ use RetailCrm\Interfaces\FileItemInterface; * @category RequestDataFilter * @package RetailCrm\Service * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Service/RequestSigner.php b/src/Service/RequestSigner.php index ffbb579..52a4947 100644 --- a/src/Service/RequestSigner.php +++ b/src/Service/RequestSigner.php @@ -6,7 +6,7 @@ * @category RequestSigner * @package RetailCrm\Service * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -25,7 +25,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category RequestSigner * @package RetailCrm\Service * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Service/RequestTimestampProvider.php b/src/Service/RequestTimestampProvider.php index 58c7248..ac3ad93 100644 --- a/src/Service/RequestTimestampProvider.php +++ b/src/Service/RequestTimestampProvider.php @@ -6,7 +6,7 @@ * @category TimestampProvider * @package RetailCrm\Service * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -23,7 +23,7 @@ use RetailCrm\Model\Request\BaseRequest; * @category TimestampProvider * @package RetailCrm\Service * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -49,7 +49,7 @@ class RequestTimestampProvider implements RequestTimestampProviderInterface if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get') ) { - date_default_timezone_set(@date_default_timezone_get()); + date_default_timezone_set(date_default_timezone_get()); } $timestamp = new DateTime(); diff --git a/src/TopClient/Client.php b/src/TopClient/Client.php index 0e49614..6fb6263 100644 --- a/src/TopClient/Client.php +++ b/src/TopClient/Client.php @@ -6,7 +6,7 @@ * @category Client * @package RetailCrm\TopClient * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -28,7 +28,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @category Client * @package RetailCrm\TopClient * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ @@ -142,12 +142,13 @@ class Client * @throws \Psr\Http\Client\ClientExceptionInterface * @throws \RetailCrm\Component\Exception\ValidationException * @throws \RetailCrm\Component\Exception\FactoryException + * + * @todo Implement this method and remove tag below. + * @SuppressWarnings(PHPMD) */ public function sendRequest(BaseRequest $request) { $httpRequest = $this->requestFactory->fromModel($request, $this->appData, $this->authenticator); $response = $this->httpClient->sendRequest($httpRequest); - - // TODO: Implement this } } diff --git a/src/Traits/ContainerAwareTrait.php b/src/Traits/ContainerAwareTrait.php index 2ebde7f..a434006 100644 --- a/src/Traits/ContainerAwareTrait.php +++ b/src/Traits/ContainerAwareTrait.php @@ -6,7 +6,7 @@ * @category ContainerAwareTrait * @package RetailCrm\Traits * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert; * @category ContainerAwareTrait * @package RetailCrm\Traits * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */ diff --git a/src/Traits/ValidatorAwareTrait.php b/src/Traits/ValidatorAwareTrait.php index cb3e114..8a73599 100644 --- a/src/Traits/ValidatorAwareTrait.php +++ b/src/Traits/ValidatorAwareTrait.php @@ -6,7 +6,7 @@ * @category ValidatorAwareTrait * @package RetailCrm\Traits * @author RetailCRM - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see http://help.retailcrm.ru */ @@ -23,7 +23,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface; * @category ValidatorAwareTrait * @package RetailCrm\Traits * @author RetailDriver LLC - * @license MIT + * @license MIT https://mit-license.org * @link http://retailcrm.ru * @see https://help.retailcrm.ru */