forked from PHPixie/Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Project\App; | ||
|
||
class Console extends \PHPixie\DefaultBundle\Console | ||
{ | ||
/** | ||
* @var Builder | ||
*/ | ||
protected $builder; | ||
|
||
/** | ||
* Constructor | ||
* @param Builder $builder | ||
*/ | ||
public function __construct($builder) | ||
{ | ||
$this->builder = $builder; | ||
} | ||
|
||
public function commandNames() | ||
{ | ||
return array('greet'); | ||
} | ||
|
||
/** | ||
* Build 'greet' command | ||
* @return ConsoleCommands\Greet | ||
*/ | ||
protected function buildGreetCommand($commandConfig) | ||
{ | ||
return new Console\Greet($commandConfig); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Project\App\Console; | ||
|
||
class Greet extends \PHPixie\Console\Command\Implementation | ||
{ | ||
public function __construct($config) | ||
{ | ||
$config | ||
->description('Greet the user'); | ||
|
||
$config->argument('message') | ||
->description("Message to display"); | ||
|
||
parent::__construct($config); | ||
} | ||
|
||
public function run($argumentData, $optionData) | ||
{ | ||
$message = $argumentData->get('message', "Have fun coding!"); | ||
$this->writeLine($message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/php | ||
<?php | ||
|
||
require_once(__DIR__.'/vendor/autoload.php'); | ||
|
||
$framework = new Project\Framework(); | ||
$framework->registerDebugHandlers(); | ||
$exitCode = $framework->processConsoleSapiCommand(); | ||
exit($exitCode); |