Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 8875543

Browse files
authored
Merge pull request #16 from modulusphp/feature/deep-dive
Feature/deep dive
2 parents 8ec74d3 + 35dd731 commit 8875543

34 files changed

+108
-120
lines changed

Commands/ClearViews.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Modulus\Console\Commands;
44

5+
use Modulus\Support\Config;
56
use Modulus\Console\ModulusCLI;
67
use Modulus\Support\Filesystem;
78
use AtlantisPHP\Console\Command;
@@ -41,10 +42,9 @@ class ClearViews extends Command
4142
*/
4243
protected function execute(InputInterface $input, OutputInterface $output)
4344
{
44-
$searchDir = ModulusCLI::$appdir . 'storage' . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;
45+
$searchDir = Config::get('app.dir') . (substr(Config::get('view.compiled'), 0, 1) == DIRECTORY_SEPARATOR ? substr(Config::get('view.compiled'), 1) : Config::get('view.compiled')) . DIRECTORY_SEPARATOR;
4546
$extension = config('view.extension');
46-
47-
$views = glob($searchDir . '*@*' . $extension);
47+
$views = glob($searchDir . '*@*' . $extension);
4848

4949
if (count($views) < 1) {
5050
return $output->writeln('Nothing to remove');
@@ -60,4 +60,4 @@ protected function execute(InputInterface $input, OutputInterface $output)
6060

6161
return $output->writeln('<info>Cleared views</info>');
6262
}
63-
}
63+
}

Commands/CraftAbstract.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Abstract Class "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Abstract Class "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('File "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -87,4 +86,4 @@ private function add(string $name) : bool
8786
}
8887
}
8988

90-
}
89+
}

Commands/CraftClass.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Class "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Class "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('File "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -86,5 +85,4 @@ private function add(string $name) : bool
8685
return true;
8786
}
8887
}
89-
90-
}
88+
}

Commands/CraftCommand.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CraftCommand extends Command
3030
* @var array
3131
*/
3232
protected $descriptions = [
33-
'craft:command' => 'Create a new modulus command',
33+
'craft:command' => 'Create a new Craftsman command',
3434
'name' => 'The name of the new command'
3535
];
3636

@@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
4646
$class = implode('', array_map('ucfirst', explode('_', str_replace(':', '_', $name))));
4747

4848
if ($this->add($name, $class)) {
49-
return $output->writeln('<info>Command "' . $class . '" has been successfuly created.</info>');
49+
return $output->writeln('<info>Command "' . $class . '" has been successfully created.</info>');
5050
}
5151

5252
return $output->writeln('Command "' . $class . '" already exists.');
@@ -79,5 +79,4 @@ private function add(string $name, string $class) : bool
7979
return true;
8080
}
8181
}
82-
83-
}
82+
}

Commands/CraftController.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858

5959
if ($model == null || $model == '') {
6060
if ($this->add($controller, 'controller') == true) {
61-
return $output->writeln('<info>Controller "' . $controller . '" has been successfuly created.</info>');
61+
return $output->writeln('<info>Controller "' . $controller . '" has been successfully created.</info>');
6262
}
6363

6464
return $output->writeln('Controller "' . $controller . '" already exists.');
@@ -72,15 +72,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
7272
else {
7373
$this->add($controller, 'controller');
7474
$this->add($model, 'model');
75-
return $output->writeln('<info>Controller "' . $controller . '" has been successfuly created with Model "' . $model . '".</info>');
75+
return $output->writeln('<info>Controller "' . $controller . '" has been successfully created with Model "' . $model . '".</info>');
7676
}
7777
}
7878

7979
/**
80-
* Add new command
80+
* Add asset
8181
*
8282
* @param string $name
83-
* @param string $class
83+
* @param string $type
84+
* @param boolean $verify
8485
* @return boolean
8586
*/
8687
private function add(string $name, string $type, bool $verify = false) : bool
@@ -183,4 +184,4 @@ private function cleanController($controller, $class)
183184
return file_put_contents($controller, $contents);
184185
}
185186
}
186-
}
187+
}

Commands/CraftDirective.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Directive "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Directive "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('File "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -87,5 +86,4 @@ private function add(string $name) : bool
8786
return true;
8887
}
8988
}
90-
91-
}
89+
}

Commands/CraftEvent.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Event "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Event "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('Event "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -86,5 +85,4 @@ private function add(string $name) : bool
8685
return true;
8786
}
8887
}
89-
90-
}
88+
}

Commands/CraftInterface.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Interface "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Interface "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('File "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -86,5 +85,4 @@ private function add(string $name) : bool
8685
return true;
8786
}
8887
}
89-
90-
}
88+
}

Commands/CraftMiddleware.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
4545
$name = $input->getArgument('name');
4646

4747
if ($this->add($name)) {
48-
return $output->writeln('<info>Middleware "' . $name . '" has been successfuly created.</info>');
48+
return $output->writeln('<info>Middleware "' . $name . '" has been successfully created.</info>');
4949
}
5050

5151
return $output->writeln('Middleware "' . $name . '" already exists.');
5252
}
5353

5454
/**
55-
* Add new command
55+
* Add asset
5656
*
5757
* @param string $name
58-
* @param string $class
5958
* @return boolean
6059
*/
6160
private function add(string $name) : bool
@@ -86,5 +85,4 @@ private function add(string $name) : bool
8685
return true;
8786
}
8887
}
89-
90-
}
88+
}

Commands/CraftMigration.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,25 @@ protected function execute(InputInterface $input, OutputInterface $output)
5050

5151
if ($table == null || $table == '') {
5252
if ($this->add($name, $class)) {
53-
return $output->writeln('<info>Migration "' . $class . '" has been successfuly created.</info>');
53+
return $output->writeln('<info>Migration "' . $class . '" has been successfully created.</info>');
5454
}
5555

5656
return $output->writeln('Migration "' . $class . '" already exists.');
5757
}
5858

5959
if ($this->add($name, $class, $table)) {
60-
return $output->writeln('<info>Migration "' . $class . '" has been successfuly created.</info>');
60+
return $output->writeln('<info>Migration "' . $class . '" has been successfully created.</info>');
6161
}
6262

6363
return $output->writeln('Migration "' . $class . '" already exists.');
6464
}
6565

6666
/**
67-
* Add new command
67+
* Add asset
6868
*
6969
* @param string $name
7070
* @param string $class
71+
* @param string|null $table
7172
* @return boolean
7273
*/
7374
private function add(string $name, string $class, string $table = null) : bool
@@ -98,5 +99,4 @@ private function add(string $name, string $class, string $table = null) : bool
9899
return true;
99100
}
100101
}
101-
102-
}
102+
}

0 commit comments

Comments
 (0)