Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions migrations/create_table_comments_1698145440.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Quantum\Database\Factories\TableFactory;
use Quantum\Migration\QtMigration;
use Quantum\Migration\Migration;

class Create_table_comments_1698145440 extends QtMigration
class Create_table_comments_1698145440 extends Migration
{
public function up(?TableFactory $tableFactory): void
{
Expand Down
4 changes: 2 additions & 2 deletions migrations/create_table_posts_1669639752.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Quantum\Database\Factories\TableFactory;
use Quantum\Migration\QtMigration;
use Quantum\Migration\Migration;

class Create_table_posts_1669639752 extends QtMigration
class Create_table_posts_1669639752 extends Migration
{
public function up(?TableFactory $tableFactory): void
{
Expand Down
4 changes: 2 additions & 2 deletions migrations/create_table_users_1669639740.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

use Quantum\Database\Factories\TableFactory;
use Quantum\Migration\QtMigration;
use Quantum\Migration\Migration;

class Create_table_users_1669639740 extends QtMigration
class Create_table_users_1669639740 extends Migration
{
public function up(?TableFactory $tableFactory): void
{
Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/CommentCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\CommentService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use Quantum\Validation\Rule;
use Shared\DTOs\CommentDTO;
use ReflectionException;
Expand All @@ -29,7 +29,7 @@
* Class CommentCreateCommand
* @package Shared\Commands
*/
class CommentCreateCommand extends QtCommand
class CommentCreateCommand extends CliCommand
{
use CommandValidationTrait;

Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/CommentDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\CommentService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use ReflectionException;

/**
* Class CommentDeleteCommand
* @package Shared\Commands
*/
class CommentDeleteCommand extends QtCommand
class CommentDeleteCommand extends CliCommand
{
/**
* Command name
Expand Down
40 changes: 4 additions & 36 deletions shared/Commands/DemoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@
use Bluemmb\Faker\PicsumPhotosProvider;
use Quantum\Di\Exceptions\DiException;
use Symfony\Component\Process\Process;
use Quantum\Database\Database;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use Ottaviano\Faker\Gravatar;
use ReflectionException;
use Shared\Enums\Role;
use RuntimeException;
use Faker\Generator;
use ErrorException;
use Quantum\Di\Di;
use Faker\Factory;

/**
* Class DemoCommand
* @package Shared\Commands
*/
class DemoCommand extends QtCommand
class DemoCommand extends CliCommand
{
/**
* Default password for generated users
Expand Down Expand Up @@ -205,8 +203,6 @@ private function getSteps(): array

/**
* Initializes a progress bar.
* @param int $steps
* @return ProgressBar
*/
private function initProgressBar(int $steps): ProgressBar
{
Expand All @@ -221,9 +217,6 @@ private function initProgressBar(int $steps): ProgressBar

/**
* Creates module
* @param string $moduleName
* @param string $template
* @param bool $withAssets
*/
private function createModule(string $moduleName, string $template, bool $withAssets): void
{
Expand All @@ -243,7 +236,6 @@ private function createModule(string $moduleName, string $template, bool $withAs

/**
* Generate demo users.
* @return array
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand All @@ -265,8 +257,6 @@ private function generateUsers(): array

/**
* Generate demo posts for each user.
* @param array $users
* @return array
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand All @@ -292,9 +282,6 @@ private function generatePosts(array $users): array

/**
* Generate demo comments for each post.
* @param array $users
* @param array $posts
* @return void
* @throws ExceptionInterface
*/
private function generateComments(array $users, array $posts): void
Expand All @@ -314,7 +301,6 @@ private function generateComments(array $users, array $posts): void

/**
* Generates data for user
* @return array
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand Down Expand Up @@ -348,8 +334,6 @@ private function generateUserData(): array

/**
* Generates data for post
* @param array $user
* @return array
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand Down Expand Up @@ -379,9 +363,6 @@ private function generatePostData(array $user): array

/**
* Get random user for comment except post owner
* @param array $users
* @param string $excludeUuid
* @return array
*/
private function getRandomUserExcept(array $users, string $excludeUuid): array
{
Expand All @@ -404,16 +385,11 @@ private function updateProgress(ProgressBar $progress, string $message): void

/**
* Rebuilds the database
* @return void
* @throws ExceptionInterface
*/
private function rebuildDatabase(): void
{
if (!Di::isRegistered(Database::class)) {
Di::register(Database::class);
}

switch (Di::get(Database::class)->getConfigs()['driver']) {
switch (db()->getConfigs()['driver']) {
case 'mysql':
$this->runCommandInternally(self::COMMANDS['migrate'], ['direction' => 'down']);
$this->runCommandInternally(self::COMMANDS['migrate'], ['direction' => 'up']);
Expand Down Expand Up @@ -449,7 +425,6 @@ private function removeUploads(): void

/**
* Cleans the uploads and resets the database.
* @return void
* @throws BaseException
* @throws ConfigException
* @throws DiException
Expand All @@ -463,8 +438,6 @@ private function resetDatabase(): void
}

/**
* @param string $commandName
* @param array $arguments
* @throws ExceptionInterface
*/
private function runCommandInternally(string $commandName, array $arguments = []): void
Expand All @@ -474,8 +447,7 @@ private function runCommandInternally(string $commandName, array $arguments = []
}

/**
* @param string $commandName
* @param array $arguments
* Runs command externally
*/
private function runCommandExternally(string $commandName, array $arguments = []): void
{
Expand All @@ -485,8 +457,6 @@ private function runCommandExternally(string $commandName, array $arguments = []

/**
* Runs separate process
* @param array $command
* @return void
*/
private function runExternalProcess(array $command): void
{
Expand All @@ -498,8 +468,6 @@ private function runExternalProcess(array $command): void

/**
* Builds command string
* @param string $commandName
* @param array $arguments
* @return string[]
*/
private function buildCommand(string $commandName, array $arguments): array
Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/PostCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\PostService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use Quantum\Validation\Rule;
use Shared\DTOs\PostDTO;
use ReflectionException;
Expand All @@ -29,7 +29,7 @@
* Class PostCreateCommand
* @package Shared\Commands
*/
class PostCreateCommand extends QtCommand
class PostCreateCommand extends CliCommand
{
use CommandValidationTrait;

Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/PostDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\PostService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use ReflectionException;

/**
* Class PostDeleteCommand
* @package Shared\Commands
*/
class PostDeleteCommand extends QtCommand
class PostDeleteCommand extends CliCommand
{
/**
* Command name
Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/PostShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
use Quantum\Di\Exceptions\DiException;
use Quantum\Model\ModelCollection;
use Shared\Services\PostService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use ReflectionException;

/**
* Class PostShowCommand
* @package Shared\Commands
*/
class PostShowCommand extends QtCommand
class PostShowCommand extends CliCommand
{
/**
* Posts per page
Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/PostUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\PostService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use Quantum\Validation\Rule;
use Shared\DTOs\PostDTO;
use ReflectionException;
Expand All @@ -29,7 +29,7 @@
* Class PostUpdateCommand
* @package Shared\Commands
*/
class PostUpdateCommand extends QtCommand
class PostUpdateCommand extends CliCommand
{
use CommandValidationTrait;

Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/UserCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Quantum\Di\Exceptions\DiException;
use Quantum\Validation\Validator;
use Shared\Services\AuthService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use Quantum\Validation\Rule;
use Quantum\Hasher\Hasher;
use Shared\DTOs\UserDTO;
Expand All @@ -32,7 +32,7 @@
* Class UserCreateCommand
* @package Shared\Commands
*/
class UserCreateCommand extends QtCommand
class UserCreateCommand extends CliCommand
{
use CommandValidationTrait;

Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/UserDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
use Quantum\App\Exceptions\BaseException;
use Quantum\Di\Exceptions\DiException;
use Shared\Services\AuthService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use ReflectionException;

/**
* Class PostDeleteCommand
* @package Shared\Commands
*/
class UserDeleteCommand extends QtCommand
class UserDeleteCommand extends CliCommand
{
/**
* Command name
Expand Down
4 changes: 2 additions & 2 deletions shared/Commands/UserShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
use Quantum\Di\Exceptions\DiException;
use Quantum\Model\ModelCollection;
use Shared\Services\AuthService;
use Quantum\Console\QtCommand;
use Quantum\Console\CliCommand;
use ReflectionException;

/**
* Class UserShowCommand
* @package Shared\Commands
*/
class UserShowCommand extends QtCommand
class UserShowCommand extends CliCommand
{
/**
* Command name
Expand Down
4 changes: 2 additions & 2 deletions shared/Services/AuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
use Quantum\Di\Exceptions\DiException;
use Quantum\Auth\User as AuthUser;
use Quantum\Model\ModelCollection;
use Quantum\Service\QtService;
use Quantum\Service\Service;
use ReflectionException;
use Shared\Models\User;

/**
* Class AuthService
* @package Shared\Services
*/
class AuthService extends QtService implements AuthServiceInterface
class AuthService extends Service implements AuthServiceInterface
{
/**
* @var User
Expand Down
4 changes: 2 additions & 2 deletions shared/Services/CommentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Shared\Transformers\CommentTransformer;
use Quantum\App\Exceptions\BaseException;
use Quantum\Model\ModelCollection;
use Quantum\Service\QtService;
use Quantum\Service\Service;
use Shared\DTOs\CommentDTO;
use Shared\Models\Comment;
use Shared\Models\User;
Expand All @@ -29,7 +29,7 @@
* Class CommentService
* @package Shared\Services
*/
class CommentService extends QtService
class CommentService extends Service
{
/**
* @var Comment
Expand Down
Loading
Loading