add phpmd
This commit is contained in:
parent
5edca2bfd2
commit
08d118a842
@ -39,8 +39,10 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"phpunit": "./vendor/bin/phpunit -c phpunit.xml.dist",
|
"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",
|
"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,
|
"prefer-stable": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
|
39
phpmd.xml
Normal file
39
phpmd.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ruleset name="Ruleset"
|
||||||
|
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||||
|
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||||
|
<description>Ruleset</description>
|
||||||
|
<rule ref="rulesets/naming.xml">
|
||||||
|
<exclude name="ShortVariable" />
|
||||||
|
<exclude name="LongVariable" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/cleancode.xml">
|
||||||
|
<exclude name="StaticAccess" />
|
||||||
|
<exclude name="ElseExpression" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/unusedcode.xml">
|
||||||
|
<exclude name="UnusedFormalParameter" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/codesize.xml">
|
||||||
|
<exclude name="TooManyPublicMethods" />
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
|
||||||
|
<properties>
|
||||||
|
<property name="maxmethods" value="15" />
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/naming.xml/ShortVariable">
|
||||||
|
<properties>
|
||||||
|
<property name="minimum" value="2" />
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
<rule ref="rulesets/naming.xml/LongVariable">
|
||||||
|
<properties>
|
||||||
|
<property name="maximum" value="30" />
|
||||||
|
</properties>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
<exclude-pattern>tests/*</exclude-pattern>
|
||||||
|
</ruleset>
|
@ -6,7 +6,7 @@
|
|||||||
* @category ClientBuilder
|
* @category ClientBuilder
|
||||||
* @package RetailCrm\Builder
|
* @package RetailCrm\Builder
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ use RetailCrm\Traits\ContainerAwareTrait;
|
|||||||
* @category ClientBuilder
|
* @category ClientBuilder
|
||||||
* @package RetailCrm\Builder
|
* @package RetailCrm\Builder
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ContainerBuilder
|
* @category ContainerBuilder
|
||||||
* @package RetailCrm\Builder
|
* @package RetailCrm\Builder
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -31,6 +31,7 @@ use RetailCrm\Interfaces\RequestTimestampProviderInterface;
|
|||||||
use RetailCrm\Service\RequestDataFilter;
|
use RetailCrm\Service\RequestDataFilter;
|
||||||
use RetailCrm\Service\RequestSigner;
|
use RetailCrm\Service\RequestSigner;
|
||||||
use RetailCrm\Service\RequestTimestampProvider;
|
use RetailCrm\Service\RequestTimestampProvider;
|
||||||
|
use RuntimeException;
|
||||||
use Shieldon\Psr17\StreamFactory;
|
use Shieldon\Psr17\StreamFactory;
|
||||||
use Symfony\Component\Validator\Validation;
|
use Symfony\Component\Validator\Validation;
|
||||||
use Symfony\Component\Validator\Validator\TraceableValidator;
|
use Symfony\Component\Validator\Validator\TraceableValidator;
|
||||||
@ -42,9 +43,12 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||||||
* @category ContainerBuilder
|
* @category ContainerBuilder
|
||||||
* @package RetailCrm\Builder
|
* @package RetailCrm\Builder
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
|
*
|
||||||
|
* ContainerBuilder should be like that.
|
||||||
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class ContainerBuilder implements BuilderInterface
|
class ContainerBuilder implements BuilderInterface
|
||||||
{
|
{
|
||||||
@ -121,7 +125,7 @@ class ContainerBuilder implements BuilderInterface
|
|||||||
$this->setDevServices($container);
|
$this->setDevServices($container);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \RuntimeException(sprintf('Invalid environment type: %s', $this->env));
|
throw new RuntimeException(sprintf('Invalid environment type: %s', $this->env));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $container;
|
return $container;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category AppData
|
* @category AppData
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @category AppData
|
* @category AppData
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category TokenAuthenticator
|
* @category TokenAuthenticator
|
||||||
* @package RetailCrm\Component\Authenticator
|
* @package RetailCrm\Component\Authenticator
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category TokenAuthenticator
|
* @category TokenAuthenticator
|
||||||
* @package RetailCrm\Component\Authenticator
|
* @package RetailCrm\Component\Authenticator
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category Constants
|
* @category Constants
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component;
|
|||||||
* @category Constants
|
* @category Constants
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category Container
|
* @category Container
|
||||||
* @package RetailCrm\Component\DependencyInjection
|
* @package RetailCrm\Component\DependencyInjection
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ use Throwable;
|
|||||||
* @package RetailCrm\Component\DependencyInjection
|
* @package RetailCrm\Component\DependencyInjection
|
||||||
* @author Evgeniy Zyubin <mail@devanych.ru>
|
* @author Evgeniy Zyubin <mail@devanych.ru>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -190,17 +190,22 @@ final class Container implements ContainerInterface
|
|||||||
* @param ReflectionClass $reflection
|
* @param ReflectionClass $reflection
|
||||||
* @return object
|
* @return object
|
||||||
* @throws ContainerException If unable to create object.
|
* @throws ContainerException If unable to create object.
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
private function getObjectFromReflection(ReflectionClass $reflection): object
|
private function getObjectFromReflection(ReflectionClass $reflection): object
|
||||||
{
|
{
|
||||||
if (($constructor = $reflection->getConstructor()) === null) {
|
$constructor = $reflection->getConstructor();
|
||||||
|
|
||||||
|
if (null === $constructor) {
|
||||||
return $reflection->newInstance();
|
return $reflection->newInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
|
|
||||||
foreach ($constructor->getParameters() as $parameter) {
|
foreach ($constructor->getParameters() as $parameter) {
|
||||||
if ($type = $parameter->getType()) {
|
$type = $parameter->getType();
|
||||||
|
|
||||||
|
if ($type) {
|
||||||
$typeName = $type->getName();
|
$typeName = $type->getName();
|
||||||
|
|
||||||
if (!$type->isBuiltin() && ($this->has($typeName) || self::isClassName($typeName))) {
|
if (!$type->isBuiltin() && ($this->has($typeName) || self::isClassName($typeName))) {
|
||||||
@ -218,7 +223,7 @@ final class Container implements ContainerInterface
|
|||||||
try {
|
try {
|
||||||
$arguments[] = $parameter->getDefaultValue();
|
$arguments[] = $parameter->getDefaultValue();
|
||||||
continue;
|
continue;
|
||||||
} catch (ReflectionException $e) {
|
} catch (ReflectionException $exception) {
|
||||||
throw new ContainerException(
|
throw new ContainerException(
|
||||||
sprintf(
|
sprintf(
|
||||||
'Unable to create object `%s`. Unable to get default value of constructor parameter: `%s`.',
|
'Unable to create object `%s`. Unable to get default value of constructor parameter: `%s`.',
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ContainerException
|
* @category ContainerException
|
||||||
* @package RetailCrm\Component\DependencyInjection\Exception
|
* @package RetailCrm\Component\DependencyInjection\Exception
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ use LogicException;
|
|||||||
* @package RetailCrm\Component\DependencyInjection\Exception
|
* @package RetailCrm\Component\DependencyInjection\Exception
|
||||||
* @author Evgeniy Zyubin <mail@devanych.ru>
|
* @author Evgeniy Zyubin <mail@devanych.ru>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category NotFoundException
|
* @category NotFoundException
|
||||||
* @package RetailCrm\Component\DependencyInjection\Exception
|
* @package RetailCrm\Component\DependencyInjection\Exception
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ use InvalidArgumentException;
|
|||||||
* @package RetailCrm\Component\DependencyInjection\Exception
|
* @package RetailCrm\Component\DependencyInjection\Exception
|
||||||
* @author Evgeniy Zyubin <mail@devanych.ru>
|
* @author Evgeniy Zyubin <mail@devanych.ru>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FactoryInterface
|
* @category FactoryInterface
|
||||||
* @package RetailCrm\Component\DependencyInjection
|
* @package RetailCrm\Component\DependencyInjection
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use Psr\Container\ContainerInterface;
|
|||||||
* @package RetailCrm\Component\DependencyInjection
|
* @package RetailCrm\Component\DependencyInjection
|
||||||
* @author Evgeniy Zyubin <mail@devanych.ru>
|
* @author Evgeniy Zyubin <mail@devanych.ru>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category Environment
|
* @category Environment
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component;
|
|||||||
* @category Environment
|
* @category Environment
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FactoryException
|
* @category FactoryException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component\Exception;
|
|||||||
* @category FactoryException
|
* @category FactoryException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category NotImplementedException
|
* @category NotImplementedException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component\Exception;
|
|||||||
* @category NotImplementedException
|
* @category NotImplementedException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ValidationException
|
* @category ValidationException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use Throwable;
|
|||||||
* @category ValidationException
|
* @category ValidationException
|
||||||
* @package RetailCrm\Component\Exception
|
* @package RetailCrm\Component\Exception
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category AbstractLogger
|
* @category AbstractLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ use Psr\Log\AbstractLogger as BaseAbstractLogger;
|
|||||||
* @category AbstractLogger
|
* @category AbstractLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FileLogger
|
* @category FileLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component\Logger;
|
|||||||
* @category FileLogger
|
* @category FileLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category StdioLogger
|
* @category StdioLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Component\Logger;
|
|||||||
* @category StdioLogger
|
* @category StdioLogger
|
||||||
* @package RetailCrm\Component\Logger
|
* @package RetailCrm\Component\Logger
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,13 +6,15 @@
|
|||||||
* @category AppendStream
|
* @category AppendStream
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AppendStream
|
* Class AppendStream
|
||||||
@ -21,7 +23,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -81,7 +83,7 @@ class AppendStream implements StreamInterface
|
|||||||
public function addStream(StreamInterface $stream): void
|
public function addStream(StreamInterface $stream): void
|
||||||
{
|
{
|
||||||
if (!$stream->isReadable()) {
|
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
|
// The stream is only seekable if all streams are seekable
|
||||||
@ -154,13 +156,13 @@ class AppendStream implements StreamInterface
|
|||||||
$size = 0;
|
$size = 0;
|
||||||
|
|
||||||
foreach ($this->streams as $stream) {
|
foreach ($this->streams as $stream) {
|
||||||
$s = $stream->getSize();
|
$streamSize = $stream->getSize();
|
||||||
|
|
||||||
if ($s === null) {
|
if ($streamSize === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$size += $s;
|
$size += $streamSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $size;
|
return $size;
|
||||||
@ -193,28 +195,29 @@ class AppendStream implements StreamInterface
|
|||||||
public function seek($offset, $whence = SEEK_SET): void
|
public function seek($offset, $whence = SEEK_SET): void
|
||||||
{
|
{
|
||||||
if (!$this->seekable) {
|
if (!$this->seekable) {
|
||||||
throw new \RuntimeException('This AppendStream is not seekable');
|
throw new RuntimeException('This AppendStream is not seekable');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($whence !== SEEK_SET) {
|
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;
|
$this->pos = $this->current = 0;
|
||||||
|
|
||||||
// Rewind each stream
|
// Rewind each stream
|
||||||
foreach ($this->streams as $i => $stream) {
|
foreach ($this->streams as $index => $stream) {
|
||||||
try {
|
try {
|
||||||
$stream->rewind();
|
$stream->rewind();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $exception) {
|
||||||
throw new \RuntimeException('Unable to seek stream '
|
throw new RuntimeException('Unable to seek stream '
|
||||||
. $i . ' of the AppendStream', 0, $e);
|
. $index . ' of the AppendStream', 0, $exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seek to the actual position by reading from each stream
|
// Seek to the actual position by reading from each stream
|
||||||
while ($this->pos < $offset && !$this->eof()) {
|
while ($this->pos < $offset && !$this->eof()) {
|
||||||
$result = $this->read(min(8096, $offset - $this->pos));
|
$result = $this->read(min(8096, $offset - $this->pos));
|
||||||
|
|
||||||
if ($result === '') {
|
if ($result === '') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -294,7 +297,7 @@ class AppendStream implements StreamInterface
|
|||||||
*/
|
*/
|
||||||
public function write($string): int
|
public function write($string): int
|
||||||
{
|
{
|
||||||
throw new \RuntimeException('Cannot write to an AppendStream');
|
throw new RuntimeException('Cannot write to an AppendStream');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
* @category BufferStream
|
* @category BufferStream
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BufferStream
|
* Class BufferStream
|
||||||
@ -21,7 +22,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -128,7 +129,7 @@ class BufferStream implements StreamInterface
|
|||||||
*/
|
*/
|
||||||
public function seek($offset, $whence = SEEK_SET): void
|
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
|
public function eof(): bool
|
||||||
{
|
{
|
||||||
return strlen($this->buffer) === 0;
|
return $this->buffer === '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,7 +145,7 @@ class BufferStream implements StreamInterface
|
|||||||
*/
|
*/
|
||||||
public function tell(): int
|
public function tell(): int
|
||||||
{
|
{
|
||||||
throw new \RuntimeException('Cannot determine the position of a BufferStream');
|
throw new RuntimeException('Cannot determine the position of a BufferStream');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
* @category MultipartStream
|
* @category MultipartStream
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
use UnexpectedValueException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class MultipartStream
|
* Class MultipartStream
|
||||||
@ -21,7 +24,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -68,7 +71,7 @@ class MultipartStream implements StreamInterface
|
|||||||
return $this->stream;
|
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)
|
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)
|
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) {
|
foreach (['contents', 'name'] as $key) {
|
||||||
if (!array_key_exists($key, $element)) {
|
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
|
// Set a default content-length header if one was no provided
|
||||||
$length = $this->getHeader($headers, 'content-length');
|
$length = $this->getHeader($headers, 'content-length');
|
||||||
|
|
||||||
if (!$length && $length = $stream->getSize()) {
|
if (!$length) {
|
||||||
|
$length = $stream->getSize();
|
||||||
$headers['Content-Length'] = (string) $length;
|
$headers['Content-Length'] = (string) $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set a default Content-Type if one was not supplied
|
// Set a default Content-Type if one was not supplied
|
||||||
$type = $this->getHeader($headers, 'content-type');
|
$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;
|
$headers['Content-Type'] = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,13 +6,14 @@
|
|||||||
* @category PumpStream
|
* @category PumpStream
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class PumpStream
|
* Class PumpStream
|
||||||
@ -21,7 +22,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -142,7 +143,7 @@ class PumpStream implements StreamInterface
|
|||||||
*/
|
*/
|
||||||
public function seek($offset, $whence = SEEK_SET): void
|
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
|
public function write($string): int
|
||||||
{
|
{
|
||||||
throw new \RuntimeException('Cannot write to a PumpStream');
|
throw new RuntimeException('Cannot write to a PumpStream');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,13 +6,15 @@
|
|||||||
* @category Stream
|
* @category Stream
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Stream
|
* Class Stream
|
||||||
@ -21,9 +23,10 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
|
||||||
*/
|
*/
|
||||||
class Stream implements StreamInterface
|
class Stream implements StreamInterface
|
||||||
{
|
{
|
||||||
@ -75,7 +78,7 @@ class Stream implements StreamInterface
|
|||||||
public function __construct($stream, array $options = [])
|
public function __construct($stream, array $options = [])
|
||||||
{
|
{
|
||||||
if (!is_resource($stream)) {
|
if (!is_resource($stream)) {
|
||||||
throw new \InvalidArgumentException('Stream must be a resource');
|
throw new InvalidArgumentException('Stream must be a resource');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['size'])) {
|
if (isset($options['size'])) {
|
||||||
@ -111,12 +114,16 @@ class Stream implements StreamInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->getContents();
|
return $this->getContents();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $exception) {
|
||||||
if (\PHP_VERSION_ID >= 70400) {
|
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
|
public function getContents(): string
|
||||||
{
|
{
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
$contents = stream_get_contents($this->stream);
|
$contents = stream_get_contents($this->stream);
|
||||||
|
|
||||||
if ($contents === false) {
|
if ($contents === false) {
|
||||||
throw new \RuntimeException('Unable to read stream contents');
|
throw new RuntimeException('Unable to read stream contents');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $contents;
|
return $contents;
|
||||||
@ -162,8 +169,11 @@ class Stream implements StreamInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->stream;
|
$result = $this->stream;
|
||||||
|
|
||||||
unset($this->stream);
|
unset($this->stream);
|
||||||
$this->size = $this->uri = null;
|
|
||||||
|
$this->uri = null;
|
||||||
|
$this->size = null;
|
||||||
$this->readable = false;
|
$this->readable = false;
|
||||||
$this->writable = false;
|
$this->writable = false;
|
||||||
$this->seekable = false;
|
$this->seekable = false;
|
||||||
@ -228,7 +238,7 @@ class Stream implements StreamInterface
|
|||||||
public function eof(): bool
|
public function eof(): bool
|
||||||
{
|
{
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
return feof($this->stream);
|
return feof($this->stream);
|
||||||
@ -240,13 +250,13 @@ class Stream implements StreamInterface
|
|||||||
public function tell(): int
|
public function tell(): int
|
||||||
{
|
{
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = ftell($this->stream);
|
$result = ftell($this->stream);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \RuntimeException('Unable to determine stream position');
|
throw new RuntimeException('Unable to determine stream position');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -269,15 +279,15 @@ class Stream implements StreamInterface
|
|||||||
$whence = (int) $whence;
|
$whence = (int) $whence;
|
||||||
|
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->seekable) {
|
if (!$this->seekable) {
|
||||||
throw new \RuntimeException('Stream is not seekable');
|
throw new RuntimeException('Stream is not seekable');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fseek($this->stream, $offset, $whence) === -1) {
|
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));
|
. $offset . ' with whence ' . var_export($whence, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -290,15 +300,15 @@ class Stream implements StreamInterface
|
|||||||
public function read($length): string
|
public function read($length): string
|
||||||
{
|
{
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->readable) {
|
if (!$this->readable) {
|
||||||
throw new \RuntimeException('Cannot read from non-readable stream');
|
throw new RuntimeException('Cannot read from non-readable stream');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($length < 0) {
|
if ($length < 0) {
|
||||||
throw new \RuntimeException('Length parameter cannot be negative');
|
throw new RuntimeException('Length parameter cannot be negative');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === $length) {
|
if (0 === $length) {
|
||||||
@ -308,7 +318,7 @@ class Stream implements StreamInterface
|
|||||||
$string = fread($this->stream, $length);
|
$string = fread($this->stream, $length);
|
||||||
|
|
||||||
if (false === $string) {
|
if (false === $string) {
|
||||||
throw new \RuntimeException('Unable to read from stream');
|
throw new RuntimeException('Unable to read from stream');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $string;
|
return $string;
|
||||||
@ -322,11 +332,11 @@ class Stream implements StreamInterface
|
|||||||
public function write($string): int
|
public function write($string): int
|
||||||
{
|
{
|
||||||
if (!isset($this->stream)) {
|
if (!isset($this->stream)) {
|
||||||
throw new \RuntimeException('Stream is detached');
|
throw new RuntimeException('Stream is detached');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->writable) {
|
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
|
// We can't know the size after writing anything
|
||||||
@ -334,7 +344,7 @@ class Stream implements StreamInterface
|
|||||||
$result = fwrite($this->stream, $string);
|
$result = fwrite($this->stream, $string);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
throw new \RuntimeException('Unable to write to stream');
|
throw new RuntimeException('Unable to write to stream');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -6,13 +6,15 @@
|
|||||||
* @category Utils
|
* @category Utils
|
||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
namespace RetailCrm\Component\Psr7;
|
namespace RetailCrm\Component\Psr7;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Psr\Http\Message\StreamInterface;
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Utils
|
* Class Utils
|
||||||
@ -21,7 +23,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @package RetailCrm\Component\Psr7
|
* @package RetailCrm\Component\Psr7
|
||||||
* @author Michael Dowling <mtdowling@gmail.com>
|
* @author Michael Dowling <mtdowling@gmail.com>
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -87,7 +89,7 @@ class Utils
|
|||||||
$ex = null;
|
$ex = null;
|
||||||
|
|
||||||
set_error_handler(static function (int $errno, string $errstr) use ($filename, $mode, &$ex): bool {
|
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',
|
'Unable to open %s using mode %s: %s',
|
||||||
$filename,
|
$filename,
|
||||||
$mode,
|
$mode,
|
||||||
@ -121,6 +123,7 @@ class Utils
|
|||||||
*
|
*
|
||||||
* @return \Psr\Http\Message\StreamInterface
|
* @return \Psr\Http\Message\StreamInterface
|
||||||
* @throws \InvalidArgumentException if the $resource arg is not valid.
|
* @throws \InvalidArgumentException if the $resource arg is not valid.
|
||||||
|
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||||
*/
|
*/
|
||||||
public static function streamFor($resource = '', array $options = []): StreamInterface
|
public static function streamFor($resource = '', array $options = []): StreamInterface
|
||||||
{
|
{
|
||||||
@ -167,7 +170,7 @@ class Utils
|
|||||||
return new PumpStream($resource, $options);
|
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
|
* @param string $extension
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
|
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||||
*/
|
*/
|
||||||
public static function mimetypeFromExtension(string $extension): ?string
|
public static function mimetypeFromExtension(string $extension): ?string
|
||||||
{
|
{
|
||||||
static $mimetypes = [
|
$mimetypes = [
|
||||||
'3gp' => 'video/3gpp',
|
'3gp' => 'video/3gpp',
|
||||||
'7z' => 'application/x-7z-compressed',
|
'7z' => 'application/x-7z-compressed',
|
||||||
'aac' => 'audio/x-aac',
|
'aac' => 'audio/x-aac',
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ServiceLocator
|
* @category ServiceLocator
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ use RetailCrm\Traits\ContainerAwareTrait;
|
|||||||
* @category ServiceLocator
|
* @category ServiceLocator
|
||||||
* @package RetailCrm\Component
|
* @package RetailCrm\Component
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FileItemFactory
|
* @category FileItemFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ use RetailCrm\Model\FileItem;
|
|||||||
* @category FileItemFactory
|
* @category FileItemFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestFactory
|
* @category RequestFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -35,9 +35,10 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||||||
* @category RequestFactory
|
* @category RequestFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
|
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||||
*/
|
*/
|
||||||
class RequestFactory implements RequestFactoryInterface
|
class RequestFactory implements RequestFactoryInterface
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category SerializationContextFactory
|
* @category SerializationContextFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use JMS\Serializer\SerializationContext;
|
|||||||
* @category SerializationContextFactory
|
* @category SerializationContextFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category SerializerFactory
|
* @category SerializerFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -27,7 +27,7 @@ use RetailCrm\Interfaces\FactoryInterface;
|
|||||||
* @category SerializerFactory
|
* @category SerializerFactory
|
||||||
* @package RetailCrm\Factory
|
* @package RetailCrm\Factory
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category AppDataInterface
|
* @category AppDataInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces;
|
|||||||
* @category AppDataInterface
|
* @category AppDataInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category AuthenticatorInterface
|
* @category AuthenticatorInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category AuthenticatorInterface
|
* @category AuthenticatorInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category BuilderInterface
|
* @category BuilderInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces;
|
|||||||
* @category BuilderInterface
|
* @category BuilderInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ContainerAwareInterface
|
* @category ContainerAwareInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use Psr\Container\ContainerInterface;
|
|||||||
* @category ContainerAwareInterface
|
* @category ContainerAwareInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FactoryInterface
|
* @category FactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces;
|
|||||||
* @category FactoryInterface
|
* @category FactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FactoryInterface
|
* @category FactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces;
|
|||||||
* @category FileItemFactoryInterface
|
* @category FileItemFactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FileItemInterface
|
* @category FileItemInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use Psr\Http\Message\StreamInterface;
|
|||||||
* @category FileItemInterface
|
* @category FileItemInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestDtoInterface
|
* @category RequestDtoInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ namespace RetailCrm\Interfaces;
|
|||||||
* @category RequestDtoInterface
|
* @category RequestDtoInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestFactoryInterface
|
* @category RequestFactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category RequestFactoryInterface
|
* @category RequestFactoryInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestSignerInterface
|
* @category RequestSignerInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category RequestSignerInterface
|
* @category RequestSignerInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestTimestampProviderInterface
|
* @category RequestTimestampProviderInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category RequestTimestampProviderInterface
|
* @category RequestTimestampProviderInterface
|
||||||
* @package RetailCrm\Interfaces
|
* @package RetailCrm\Interfaces
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category FileItem
|
* @category FileItem
|
||||||
* @package RetailCrm\Model
|
* @package RetailCrm\Model
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use RetailCrm\Interfaces\FileItemInterface;
|
|||||||
* @category FileItem
|
* @category FileItem
|
||||||
* @package RetailCrm\Model
|
* @package RetailCrm\Model
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category BaseRequest
|
* @category BaseRequest
|
||||||
* @package RetailCrm\Model\Request
|
* @package RetailCrm\Model\Request
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @category BaseRequest
|
* @category BaseRequest
|
||||||
* @package RetailCrm\Model\Request
|
* @package RetailCrm\Model\Request
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category HttpDnsGetRequest
|
* @category HttpDnsGetRequest
|
||||||
* @package RetailCrm\Model\Request
|
* @package RetailCrm\Model\Request
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ namespace RetailCrm\Model\Request;
|
|||||||
* @category HttpDnsGetRequest
|
* @category HttpDnsGetRequest
|
||||||
* @package RetailCrm\Model\Request
|
* @package RetailCrm\Model\Request
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestDataFilter
|
* @category RequestDataFilter
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -20,7 +20,7 @@ use RetailCrm\Interfaces\FileItemInterface;
|
|||||||
* @category RequestDataFilter
|
* @category RequestDataFilter
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category RequestSigner
|
* @category RequestSigner
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -25,7 +25,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category RequestSigner
|
* @category RequestSigner
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category TimestampProvider
|
* @category TimestampProvider
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ use RetailCrm\Model\Request\BaseRequest;
|
|||||||
* @category TimestampProvider
|
* @category TimestampProvider
|
||||||
* @package RetailCrm\Service
|
* @package RetailCrm\Service
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ class RequestTimestampProvider implements RequestTimestampProviderInterface
|
|||||||
if (function_exists('date_default_timezone_set')
|
if (function_exists('date_default_timezone_set')
|
||||||
&& function_exists('date_default_timezone_get')
|
&& 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();
|
$timestamp = new DateTime();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category Client
|
* @category Client
|
||||||
* @package RetailCrm\TopClient
|
* @package RetailCrm\TopClient
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @category Client
|
* @category Client
|
||||||
* @package RetailCrm\TopClient
|
* @package RetailCrm\TopClient
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -142,12 +142,13 @@ class Client
|
|||||||
* @throws \Psr\Http\Client\ClientExceptionInterface
|
* @throws \Psr\Http\Client\ClientExceptionInterface
|
||||||
* @throws \RetailCrm\Component\Exception\ValidationException
|
* @throws \RetailCrm\Component\Exception\ValidationException
|
||||||
* @throws \RetailCrm\Component\Exception\FactoryException
|
* @throws \RetailCrm\Component\Exception\FactoryException
|
||||||
|
*
|
||||||
|
* @todo Implement this method and remove tag below.
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
*/
|
*/
|
||||||
public function sendRequest(BaseRequest $request)
|
public function sendRequest(BaseRequest $request)
|
||||||
{
|
{
|
||||||
$httpRequest = $this->requestFactory->fromModel($request, $this->appData, $this->authenticator);
|
$httpRequest = $this->requestFactory->fromModel($request, $this->appData, $this->authenticator);
|
||||||
$response = $this->httpClient->sendRequest($httpRequest);
|
$response = $this->httpClient->sendRequest($httpRequest);
|
||||||
|
|
||||||
// TODO: Implement this
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ContainerAwareTrait
|
* @category ContainerAwareTrait
|
||||||
* @package RetailCrm\Traits
|
* @package RetailCrm\Traits
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -22,7 +22,7 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||||||
* @category ContainerAwareTrait
|
* @category ContainerAwareTrait
|
||||||
* @package RetailCrm\Traits
|
* @package RetailCrm\Traits
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @category ValidatorAwareTrait
|
* @category ValidatorAwareTrait
|
||||||
* @package RetailCrm\Traits
|
* @package RetailCrm\Traits
|
||||||
* @author RetailCRM <integration@retailcrm.ru>
|
* @author RetailCRM <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see http://help.retailcrm.ru
|
* @see http://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
@ -23,7 +23,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||||||
* @category ValidatorAwareTrait
|
* @category ValidatorAwareTrait
|
||||||
* @package RetailCrm\Traits
|
* @package RetailCrm\Traits
|
||||||
* @author RetailDriver LLC <integration@retailcrm.ru>
|
* @author RetailDriver LLC <integration@retailcrm.ru>
|
||||||
* @license MIT
|
* @license MIT https://mit-license.org
|
||||||
* @link http://retailcrm.ru
|
* @link http://retailcrm.ru
|
||||||
* @see https://help.retailcrm.ru
|
* @see https://help.retailcrm.ru
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user