Skip to content

Commit

Permalink
update file
Browse files Browse the repository at this point in the history
  • Loading branch information
juancristobalgd1 authored Mar 29, 2024
1 parent 43c5785 commit 34dfec3
Show file tree
Hide file tree
Showing 47 changed files with 587 additions and 1,210 deletions.
14 changes: 7 additions & 7 deletions src/libraries/Console/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,37 @@ abstract class BaseCommand
* when listing commands.
* @var string
*/
protected $group;
protected string $group;

/**
* The Command's name
* @var string
*/
protected $name;
protected string $name;

/**
* the Command's usage description
* @var string
*/
protected $usage;
protected string $usage;

/**
* the Command's short description
* @var string
*/
protected $description;
protected string $description;

/**
* the Command's options description
* @var array
*/
protected $options = [];
protected array $options = [];

/**
* the Command's Arguments description
* @var array
*/
protected $arguments = [];
protected array $arguments = [];

/**
* Instance of Commands so
Expand All @@ -81,7 +81,7 @@ abstract class BaseCommand
/**
* @var array
*/
private $params = [];
private array $params = [];

protected const ARROW_SYMBOL = '';

Expand Down
30 changes: 10 additions & 20 deletions src/libraries/Console/Commands/Cache/ClearCache.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* This file is part of Axm framework.
* Axm Framework PHP.
*
* (c) Axm Foundation <admin@Axm.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* @author Juan Cristobal <juancristobalgd1@gmail.com>
* @link http://www.axm.com/
* @license http://www.axm.com/license/
* @package Console
*/

namespace Console\Commands\Cache;
Expand All @@ -23,38 +23,28 @@ class ClearCache extends BaseCommand
{
/**
* Command grouping.
*
* @var string
*/
protected $group = 'Cache';
protected string $group = 'Cache';

/**
* The Command's name
*
* @var string
*/
protected $name = 'clear:cache';
protected string $name = 'clear:cache';

/**
* the Command's short description
*
* @var string
*/
protected $description = 'Clears the current system caches.';
protected string $description = 'Clears the current system caches.';

/**
* the Command's usage
*
* @var string
*/
protected $usage = 'clear:cache [driver]';
protected string $usage = 'clear:cache [driver]';

/**
* the Command's Arguments
*
* @var array
*/
protected $arguments = [
protected array $arguments = [
'driver' => 'The cache driver to use',
];

Expand Down
26 changes: 9 additions & 17 deletions src/libraries/Console/Commands/Cache/InfoCache.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* This file is part of Axm framework.
* Axm Framework PHP.
*
* (c) Axm Foundation <admin@Axm.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* @author Juan Cristobal <juancristobalgd1@gmail.com>
* @link http://www.axm.com/
* @license http://www.axm.com/license/
* @package Console
*/

namespace Console\Commands\Cache;
Expand All @@ -22,31 +22,23 @@ class InfoCache extends BaseCommand
{
/**
* Command grouping.
*
* @var string
*/
protected $group = 'Cache';
protected string $group = 'Cache';

/**
* The Command's name
*
* @var string
*/
protected $name = 'info:cache';
protected string $name = 'info:cache';

/**
* the Command's short description
*
* @var string
*/
protected $description = 'Shows file cache information in the current system.';
protected string $description = 'Shows file cache information in the current system.';

/**
* the Command's usage
*
* @var string
*/
protected $usage = 'info:cache';
protected string $usage = 'info:cache';

/**
* Clears the cache
Expand Down
39 changes: 12 additions & 27 deletions src/libraries/Console/Commands/Database/CreateDatabase.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* This file is part of Axm framework.
* Axm Framework PHP.
*
* (c) Axm Foundation <admin@Axm.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* @author Juan Cristobal <juancristobalgd1@gmail.com>
* @link http://www.axm.com/
* @license http://www.axm.com/license/
* @package Console
*/

namespace Console\Commands\Database;
Expand All @@ -24,51 +24,40 @@ class CreateDatabase extends BaseCommand
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
protected string $group = 'Database';

/**
* The Command's name
* @var string
*/
protected $name = 'db:create';
protected string $name = 'db:create';

/**
* The Command's short description
* @var string
*/
protected $description = 'Create new database.';
protected string $description = 'Create new database.';

/**
* The Command's usage
* @var string
*/
protected $usage = 'db:create <db_name> [options]';
protected string $usage = 'db:create <db_name> [options]';

/**
* The Command's arguments
* @var array<string, string>
*/
protected $arguments = [
protected array $arguments = [
'db_name' => 'The database name to use',
];

/**
* The Command's options
* @var array<string, string>
*/
protected $options = [];
protected array $options = [];

/**
* @var string
*/
protected $driver = null;
protected ?string $driver = null;

/**
* Creates a new database.
* @param array $params
*/
public function run(array $params)
{
Expand All @@ -86,9 +75,6 @@ public function run(array $params)

/**
* Create a new database with the given name.
*
* @param string $name The name of the database to create.
* @throws Exception If there is an error creating the database.
*/
protected function createDatabase(string $name)
{
Expand All @@ -103,7 +89,6 @@ protected function createDatabase(string $name)

/**
* Get the database connection information from the environment.
* @return array The database connection information.
*/
public function getData(): array
{
Expand Down
43 changes: 11 additions & 32 deletions src/libraries/Console/Commands/Database/DeleteConsole.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

/**
* This file is part of Axm framework.
* Axm Framework PHP.
*
* (c) Axm Foundation <admin@Axm.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
* @author Juan Cristobal <juancristobalgd1@gmail.com>
* @link http://www.axm.com/
* @license http://www.axm.com/license/
* @package Console
*/

namespace Console\Commands\Database;
Expand All @@ -19,47 +19,36 @@ class DeleteConsole extends BaseCommand
/**
* The group the command is lumped under
* when listing commands.
*
* @var string
*/
protected $group = 'Database';
protected string $group = 'Database';

/**
* The Command's name
* @var string
*/
protected $name = 'd:command';
protected string $name = 'd:command';

/**
* The Command's short description
* @var string
*/
protected $description = 'Delete a console command';
protected string $description = 'Delete a console command';

/**
* The Command's usage
* @var string
*/
protected $usage = 'd:command <command_name>';
protected string $usage = 'd:command <command_name>';

/**
* The Command's arguments
* @var array<string, string>
*/
protected $arguments = [];
protected array $arguments = [];

/**
* The Command's options
* @var array
*/
protected $options = [];

protected array $options = [];

/**
* Runs the command based on the provided parameters.
*
* @param array $params An array of command parameters.
* @return int Returns 0 on success, 1 on failure.
*/
public function run(array $params): int
{
Expand All @@ -80,9 +69,6 @@ public function run(array $params): int

/**
* Gets the file path for the specified command.
*
* @param string $command The name of the command.
* @return string The file path for the command.
*/
private function getCommandFilePath(string $command): string
{
Expand All @@ -91,10 +77,6 @@ private function getCommandFilePath(string $command): string

/**
* Deletes the file associated with the specified command.
*
* @param string $commandFile The file path for the command.
* @param string $command The name of the command.
* @return bool Returns true on successful deletion, false otherwise.
*/
private function deleteCommandFile(string $commandFile, string $command): bool
{
Expand All @@ -113,9 +95,6 @@ private function deleteCommandFile(string $commandFile, string $command): bool

/**
* Prints a success message for the deleted command.
*
* @param string $command The name of the deleted command.
* @return void
*/
private function printSuccessMessage(string $command): void
{
Expand Down
Loading

0 comments on commit 34dfec3

Please sign in to comment.