From 2c89bbe5f542e03e0d7044eb791d44fb7c0a49d5 Mon Sep 17 00:00:00 2001 From: Meritoo Date: Thu, 6 Sep 2018 23:35:08 +0200 Subject: [PATCH] Composer > meritoo/common-library package > use latest version --- composer.json | 2 +- src/Base/Result/BaseParticipantsCollection.php | 6 +++--- src/Exception/UnknownMethodException.php | 12 +++++++++--- src/Result/Collection/SurveysSummaries.php | 6 +++--- tests/Exception/UnknownMethodExceptionTest.php | 4 ++-- tests/Resources/var/cache/.gitkeep | 0 tests/Resources/var/log/.gitkeep | 0 tests/Resources/var/sessions/.gitkeep | 0 8 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 tests/Resources/var/cache/.gitkeep create mode 100644 tests/Resources/var/log/.gitkeep create mode 100644 tests/Resources/var/sessions/.gitkeep diff --git a/composer.json b/composer.json index ccf8db6..c1c72b1 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": ">=5.6", "fguillot/json-rpc": "^1.2", - "meritoo/common-library": "~0.0.1" + "meritoo/common-library": "^0.1.0" }, "require-dev": { "phpunit/phpunit": "^5.7", diff --git a/src/Base/Result/BaseParticipantsCollection.php b/src/Base/Result/BaseParticipantsCollection.php index 38db099..406f5fc 100644 --- a/src/Base/Result/BaseParticipantsCollection.php +++ b/src/Base/Result/BaseParticipantsCollection.php @@ -18,7 +18,7 @@ abstract class BaseParticipantsCollection extends Collection */ public function add($element, $index = null) { - throw new DisabledMethodException(__METHOD__, 'addParticipant'); + throw DisabledMethodException::create(__METHOD__, 'addParticipant'); } /** @@ -26,7 +26,7 @@ abstract class BaseParticipantsCollection extends Collection */ public function addMultiple($elements, $useIndexes = false) { - throw new DisabledMethodException(__METHOD__, 'addParticipants'); + throw DisabledMethodException::create(__METHOD__, 'addParticipants'); } /** @@ -34,7 +34,7 @@ abstract class BaseParticipantsCollection extends Collection */ public function has($element) { - throw new DisabledMethodException(__METHOD__, 'hasParticipantsOfSurvey'); + throw DisabledMethodException::create(__METHOD__, 'hasParticipantsOfSurvey'); } /** diff --git a/src/Exception/UnknownMethodException.php b/src/Exception/UnknownMethodException.php index a207bd7..8c8391c 100644 --- a/src/Exception/UnknownMethodException.php +++ b/src/Exception/UnknownMethodException.php @@ -20,10 +20,16 @@ use Meritoo\LimeSurvey\ApiClient\Type\MethodType; class UnknownMethodException extends UnknownTypeException { /** - * {@inheritdoc} + * Creates exception + * + * @param string $unknownMethod Name of unknown method used while talking to the LimeSurvey's API + * @return UnknownMethodException */ - public function __construct($unknownType) + public static function createException($unknownMethod) { - parent::__construct($unknownType, new MethodType(), 'name of method used while talking to the LimeSurvey\'s API'); + /* @var UnknownMethodException $exception */ + $exception = parent::create($unknownMethod, new MethodType(), 'name of method used while talking to the LimeSurvey\'s API'); + + return $exception; } } diff --git a/src/Result/Collection/SurveysSummaries.php b/src/Result/Collection/SurveysSummaries.php index 91d66c6..e41cf8c 100644 --- a/src/Result/Collection/SurveysSummaries.php +++ b/src/Result/Collection/SurveysSummaries.php @@ -25,7 +25,7 @@ class SurveysSummaries extends Collection */ public function add($element, $index = null) { - throw new DisabledMethodException(__METHOD__, 'addSurveySummary'); + throw DisabledMethodException::create(__METHOD__, 'addSurveySummary'); } /** @@ -33,7 +33,7 @@ class SurveysSummaries extends Collection */ public function addMultiple($elements, $useIndexes = false) { - throw new DisabledMethodException(__METHOD__, 'addSurveysSummaries'); + throw DisabledMethodException::create(__METHOD__, 'addSurveysSummaries'); } /** @@ -41,7 +41,7 @@ class SurveysSummaries extends Collection */ public function has($element) { - throw new DisabledMethodException(__METHOD__, 'hasSurveySummary'); + throw DisabledMethodException::create(__METHOD__, 'hasSurveySummary'); } /** diff --git a/tests/Exception/UnknownMethodExceptionTest.php b/tests/Exception/UnknownMethodExceptionTest.php index 681bcfb..a56979d 100644 --- a/tests/Exception/UnknownMethodExceptionTest.php +++ b/tests/Exception/UnknownMethodExceptionTest.php @@ -24,7 +24,7 @@ class UnknownMethodExceptionTest extends BaseTestCase { public function testConstructorVisibilityAndArguments() { - static::assertConstructorVisibilityAndArguments(UnknownMethodException::class, OopVisibilityType::IS_PUBLIC, 1, 1); + static::assertConstructorVisibilityAndArguments(UnknownMethodException::class, OopVisibilityType::IS_PUBLIC, 3); } /** @@ -35,7 +35,7 @@ class UnknownMethodExceptionTest extends BaseTestCase */ public function testConstructorMessage($unknownType, $expectedMessage) { - $exception = new UnknownMethodException($unknownType); + $exception = UnknownMethodException::createException($unknownType); static::assertEquals($expectedMessage, $exception->getMessage()); } diff --git a/tests/Resources/var/cache/.gitkeep b/tests/Resources/var/cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/Resources/var/log/.gitkeep b/tests/Resources/var/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/Resources/var/sessions/.gitkeep b/tests/Resources/var/sessions/.gitkeep new file mode 100644 index 0000000..e69de29