diff --git a/app/Core/Subscribers/AchieveSubscriber.php b/app/Domains/Bot/AchieveSubscriber.php similarity index 82% rename from app/Core/Subscribers/AchieveSubscriber.php rename to app/Domains/Bot/AchieveSubscriber.php index c74e1d7..e099146 100644 --- a/app/Core/Subscribers/AchieveSubscriber.php +++ b/app/Domains/Bot/AchieveSubscriber.php @@ -8,23 +8,23 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers; +namespace Domains\Bot; -use Domains\Room; use Domains\Achieve; -use Illuminate\Support\Collection; -use Illuminate\Contracts\Support\Jsonable; +use Domains\Bot\Achievements\DocsAchieve; +use Domains\Bot\Achievements\Karma100Achieve; +use Domains\Bot\Achievements\Karma10Achieve; +use Domains\Bot\Achievements\Karma500Achieve; +use Domains\Bot\Achievements\Karma50Achieve; +use Domains\Bot\Achievements\Thanks100Achieve; +use Domains\Bot\Achievements\Thanks10Karma0Achieve; +use Domains\Bot\Achievements\Thanks20Achieve; +use Domains\Bot\Achievements\Thanks50Achieve; +use Domains\Room; use Illuminate\Contracts\Support\Arrayable; +use Illuminate\Contracts\Support\Jsonable; +use Illuminate\Support\Collection; use Interfaces\Gitter\Subscriber\SubscriberInterface; -use Core\Subscribers\Achievements\Karma10Achieve; -use Core\Subscribers\Achievements\Karma50Achieve; -use Core\Subscribers\Achievements\Karma100Achieve; -use Core\Subscribers\Achievements\Karma500Achieve; -use Core\Subscribers\Achievements\Thanks20Achieve; -use Core\Subscribers\Achievements\Thanks50Achieve; -use Core\Subscribers\Achievements\Thanks100Achieve; -use Core\Subscribers\Achievements\Thanks10Karma0Achieve; -use Core\Subscribers\Achievements\DocsAchieve; /** * Class AchieveSubscriber @@ -46,7 +46,7 @@ class AchieveSubscriber implements Thanks50Achieve::class, Thanks100Achieve::class, Thanks10Karma0Achieve::class, - DocsAchieve::class + DocsAchieve::class, ]; /** @@ -65,14 +65,6 @@ public function __construct() } } - /** - * @return array - */ - public function getAchievementInstances(): array - { - return $this->instances; - } - /** * Subscribe achievements */ @@ -93,11 +85,12 @@ public function handle() } /** - * @return Collection + * @param int $options + * @return string */ - public function toCollection(): Collection + public function toJson($options = 0): string { - return new Collection($this->getAchievementInstances()); + return json_encode($this->toArray(), $options); } /** @@ -111,11 +104,18 @@ public function toArray(): array } /** - * @param int $options - * @return string + * @return Collection */ - public function toJson($options = 0): string + public function toCollection(): Collection { - return json_encode($this->toArray(), $options); + return new Collection($this->getAchievementInstances()); + } + + /** + * @return array + */ + public function getAchievementInstances(): array + { + return $this->instances; } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/DocsAchieve.php b/app/Domains/Bot/Achievements/DocsAchieve.php similarity index 95% rename from app/Core/Subscribers/Achievements/DocsAchieve.php rename to app/Domains/Bot/Achievements/DocsAchieve.php index b58d03a..44ba2ea 100644 --- a/app/Core/Subscribers/Achievements/DocsAchieve.php +++ b/app/Domains/Bot/Achievements/DocsAchieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -40,4 +40,4 @@ public function handle() { // Only manual addition } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Karma100Achieve.php b/app/Domains/Bot/Achievements/Karma100Achieve.php similarity index 95% rename from app/Core/Subscribers/Achievements/Karma100Achieve.php rename to app/Domains/Bot/Achievements/Karma100Achieve.php index a9d2f37..3ba4860 100644 --- a/app/Core/Subscribers/Achievements/Karma100Achieve.php +++ b/app/Domains/Bot/Achievements/Karma100Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Karma10Achieve.php b/app/Domains/Bot/Achievements/Karma10Achieve.php similarity index 95% rename from app/Core/Subscribers/Achievements/Karma10Achieve.php rename to app/Domains/Bot/Achievements/Karma10Achieve.php index 638fa58..b63a243 100644 --- a/app/Core/Subscribers/Achievements/Karma10Achieve.php +++ b/app/Domains/Bot/Achievements/Karma10Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -47,4 +47,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Karma500Achieve.php b/app/Domains/Bot/Achievements/Karma500Achieve.php similarity index 95% rename from app/Core/Subscribers/Achievements/Karma500Achieve.php rename to app/Domains/Bot/Achievements/Karma500Achieve.php index c284f1c..a79ac8d 100644 --- a/app/Core/Subscribers/Achievements/Karma500Achieve.php +++ b/app/Domains/Bot/Achievements/Karma500Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Karma50Achieve.php b/app/Domains/Bot/Achievements/Karma50Achieve.php similarity index 96% rename from app/Core/Subscribers/Achievements/Karma50Achieve.php rename to app/Domains/Bot/Achievements/Karma50Achieve.php index cc3abb1..11c266d 100644 --- a/app/Core/Subscribers/Achievements/Karma50Achieve.php +++ b/app/Domains/Bot/Achievements/Karma50Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Thanks100Achieve.php b/app/Domains/Bot/Achievements/Thanks100Achieve.php similarity index 96% rename from app/Core/Subscribers/Achievements/Thanks100Achieve.php rename to app/Domains/Bot/Achievements/Thanks100Achieve.php index f5d0f0e..fc96f36 100644 --- a/app/Core/Subscribers/Achievements/Thanks100Achieve.php +++ b/app/Domains/Bot/Achievements/Thanks100Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Thanks10Karma0Achieve.php b/app/Domains/Bot/Achievements/Thanks10Karma0Achieve.php similarity index 96% rename from app/Core/Subscribers/Achievements/Thanks10Karma0Achieve.php rename to app/Domains/Bot/Achievements/Thanks10Karma0Achieve.php index 539978b..b8f6232 100644 --- a/app/Core/Subscribers/Achievements/Thanks10Karma0Achieve.php +++ b/app/Domains/Bot/Achievements/Thanks10Karma0Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; diff --git a/app/Core/Subscribers/Achievements/Thanks20Achieve.php b/app/Domains/Bot/Achievements/Thanks20Achieve.php similarity index 96% rename from app/Core/Subscribers/Achievements/Thanks20Achieve.php rename to app/Domains/Bot/Achievements/Thanks20Achieve.php index 4794bd3..c743cc7 100644 --- a/app/Core/Subscribers/Achievements/Thanks20Achieve.php +++ b/app/Domains/Bot/Achievements/Thanks20Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Core/Subscribers/Achievements/Thanks50Achieve.php b/app/Domains/Bot/Achievements/Thanks50Achieve.php similarity index 96% rename from app/Core/Subscribers/Achievements/Thanks50Achieve.php rename to app/Domains/Bot/Achievements/Thanks50Achieve.php index 7c87a3a..a05faa0 100644 --- a/app/Core/Subscribers/Achievements/Thanks50Achieve.php +++ b/app/Domains/Bot/Achievements/Thanks50Achieve.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Core\Subscribers\Achievements; +namespace Domains\Bot\Achievements; use Domains\Karma; use Interfaces\Gitter\Achieve\AbstractAchieve; @@ -46,4 +46,4 @@ public function handle() } }); } -} \ No newline at end of file +} diff --git a/app/Interfaces/Gitter/Achieve/AbstractAchieve.php b/app/Interfaces/Gitter/Achieve/AbstractAchieve.php index 6a5549c..b9f4680 100644 --- a/app/Interfaces/Gitter/Achieve/AbstractAchieve.php +++ b/app/Interfaces/Gitter/Achieve/AbstractAchieve.php @@ -59,7 +59,7 @@ abstract class AbstractAchieve implements */ public function __construct() { - $this->name = static::class; + $this->name = basename(static::class); } /** @@ -109,4 +109,4 @@ public function toJson($options = 0): string { return json_encode($this->toArray(), $options); } -} \ No newline at end of file +} diff --git a/config/gitter.php b/config/gitter.php index bebdde9..988a338 100644 --- a/config/gitter.php +++ b/config/gitter.php @@ -59,6 +59,6 @@ // Subscribers 'subscribers' => [ // Подписывается на создание ачивки и отправляет сообщеньку в чат - Core\Subscribers\AchieveSubscriber::class, + Domains\Bot\AchieveSubscriber::class, ], ];