diff --git a/src/Reactant/Models/Reactant.php b/src/Reactant/Models/Reactant.php index 11cd8e5..5f2cecf 100755 --- a/src/Reactant/Models/Reactant.php +++ b/src/Reactant/Models/Reactant.php @@ -18,8 +18,10 @@ use I\Love\Reactant\ReactionTotal\Models\ReactionTotal; use I\Love\Reacter\Models\Reacter; use I\Love\ReactionType\Models\ReactionType; +use I\Love\Support\Object\Nullable; -interface Reactant +interface Reactant extends + Nullable { public function getId(): string; @@ -47,10 +49,6 @@ public function isEqualTo(self $that): bool; public function isNotEqualTo(self $that): bool; - public function isNull(): bool; - - public function isNotNull(): bool; - public function createReactionCounterOfType(ReactionType $type): void; public function createReactionTotal(): void; diff --git a/src/Reactant/ReactionCounter/Models/ReactionCounter.php b/src/Reactant/ReactionCounter/Models/ReactionCounter.php index 57d9308..5a92a00 100755 --- a/src/Reactant/ReactionCounter/Models/ReactionCounter.php +++ b/src/Reactant/ReactionCounter/Models/ReactionCounter.php @@ -15,8 +15,12 @@ use I\Love\Reactant\Models\Reactant; use I\Love\ReactionType\Models\ReactionType; +use I\Love\Support\Object\Countable; +use I\Love\Support\Object\Weightable; -interface ReactionCounter +interface ReactionCounter extends + Countable, + Weightable { public function getReactant(): Reactant; @@ -25,16 +29,4 @@ public function getReactionType(): ReactionType; public function isReactionOfType(ReactionType $type): bool; public function isNotReactionOfType(ReactionType $type): bool; - - public function getCount(): int; - - public function getWeight(): float; - - public function incrementCount(int $amount): void; - - public function decrementCount(int $amount): void; - - public function incrementWeight(float $amount): void; - - public function decrementWeight(float $amount): void; } diff --git a/src/Reactant/ReactionTotal/Models/ReactionTotal.php b/src/Reactant/ReactionTotal/Models/ReactionTotal.php index 8bcfc88..308b9bc 100755 --- a/src/Reactant/ReactionTotal/Models/ReactionTotal.php +++ b/src/Reactant/ReactionTotal/Models/ReactionTotal.php @@ -14,20 +14,12 @@ namespace I\Love\Reactant\ReactionTotal\Models; use I\Love\Reactant\Models\Reactant; +use I\Love\Support\Object\Countable; +use I\Love\Support\Object\Weightable; -interface ReactionTotal +interface ReactionTotal extends + Countable, + Weightable { public function getReactant(): Reactant; - - public function getCount(): int; - - public function getWeight(): float; - - public function incrementCount(int $amount): void; - - public function decrementCount(int $amount): void; - - public function incrementWeight(float $amount): void; - - public function decrementWeight(float $amount): void; } diff --git a/src/Reacter/Models/Reacter.php b/src/Reacter/Models/Reacter.php index 00c8d18..f1e8a5d 100755 --- a/src/Reacter/Models/Reacter.php +++ b/src/Reacter/Models/Reacter.php @@ -16,8 +16,10 @@ use I\Love\Reactant\Models\Reactant; use I\Love\Reacterable\Models\Reacterable; use I\Love\ReactionType\Models\ReactionType; +use I\Love\Support\Object\Nullable; -interface Reacter +interface Reacter extends + Nullable { public function getId(): string; @@ -39,8 +41,4 @@ public function hasNotReactedTo(Reactant $reactant, ?ReactionType $reactionType public function isEqualTo(self $that): bool; public function isNotEqualTo(self $that): bool; - - public function isNull(): bool; - - public function isNotNull(): bool; } diff --git a/src/Support/Object/Countable.php b/src/Support/Object/Countable.php new file mode 100644 index 0000000..2856f0a --- /dev/null +++ b/src/Support/Object/Countable.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace I\Love\Support\Object; + +interface Countable +{ + public function getCount(): int; + + public function incrementCount(int $amount): void; + + public function decrementCount(int $amount): void; +} diff --git a/src/Support/Object/Nullable.php b/src/Support/Object/Nullable.php new file mode 100644 index 0000000..b7ece5b --- /dev/null +++ b/src/Support/Object/Nullable.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace I\Love\Support\Object; + +interface Nullable +{ + public function isNull(): bool; + + public function isNotNull(): bool; +} diff --git a/src/Support/Object/Weightable.php b/src/Support/Object/Weightable.php new file mode 100644 index 0000000..c63a790 --- /dev/null +++ b/src/Support/Object/Weightable.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +namespace I\Love\Support\Object; + +interface Weightable +{ + public function getWeight(): float; + + public function incrementWeight(float $amount): void; + + public function decrementWeight(float $amount): void; +}