-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from dotkernel/develop
Develop
- Loading branch information
Showing
7 changed files
with
161 additions
and
23 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,22 @@ | ||
<?php | ||
/** | ||
* Console application bootstrap file | ||
*/ | ||
use ZF\Console\Application; | ||
|
||
chdir(dirname(__DIR__)); | ||
require 'vendor/autoload.php'; | ||
|
||
/** | ||
* Self-called anonymous function that creates its own scope and keep the global namespace clean. | ||
*/ | ||
call_user_func(function () { | ||
/** @var \Interop\Container\ContainerInterface $container */ | ||
$container = require 'config/container.php'; | ||
|
||
/** @var Application $app */ | ||
$app = $container->get(Application::class); | ||
|
||
$exit = $app->run(); | ||
exit($exit); | ||
}); |
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,18 @@ | ||
<?php | ||
|
||
use Frontend\Console\Command\HelloCommand; | ||
|
||
return [ | ||
'dot_console' => [ | ||
//'name' => 'DotKernel Console', | ||
//'version' => '1.0.0', | ||
|
||
'commands' => [ | ||
[ | ||
'name' => 'hello', | ||
'description' => 'Hello, World! command example', | ||
'handler' => HelloCommand::class, | ||
], | ||
] | ||
] | ||
]; |
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,45 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/frontend/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/frontend/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Frontend\Console\Command; | ||
|
||
use Dot\AnnotatedServices\Annotation\Service; | ||
use Dot\Console\Command\AbstractCommand; | ||
use Zend\Console\Adapter\AdapterInterface; | ||
use ZF\Console\Route; | ||
|
||
/** | ||
* Class HelloWorldCommand | ||
* @package Frontend\Console\Command | ||
* | ||
* @Service | ||
*/ | ||
class HelloCommand extends AbstractCommand | ||
{ | ||
/** | ||
* @param Route $route | ||
* @param AdapterInterface $console | ||
* @return int | ||
*/ | ||
public function __invoke(Route $route, AdapterInterface $console) | ||
{ | ||
$console->writeLine( | ||
<<<EOT | ||
_ _ _ _ ____ _ _ __ _ _ | ||
| | | | ___| | | ___ | _ \ ___ | |_| |/ /___ _ __ _ __ ___| | | | | ||
| |_| |/ _ \ | |/ _ \ | | | |/ _ \| __| ' // _ \ '__| '_ \ / _ \ | | | | ||
| _ | __/ | | (_) | _ | |_| | (_) | |_| . \ __/ | | | | | __/ | |_| | ||
|_| |_|\___|_|_|\___/ ( ) |____/ \___/ \__|_|\_\___|_| |_| |_|\___|_| (_) | ||
|/ | ||
EOT | ||
); | ||
return 0; | ||
} | ||
} |
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,29 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/dotkernel/frontend/ for the canonical source repository | ||
* @copyright Copyright (c) 2017 Apidemia (https://www.apidemia.com) | ||
* @license https://github.com/dotkernel/frontend/blob/master/LICENSE.md MIT License | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Frontend\Console; | ||
|
||
/** | ||
* Class ConfigProvider | ||
* @package Frontend\Console | ||
*/ | ||
class ConfigProvider | ||
{ | ||
public function __invoke() | ||
{ | ||
return [ | ||
'dependencies' => $this->getDependencies(), | ||
]; | ||
} | ||
|
||
public function getDependencies() | ||
{ | ||
return []; | ||
} | ||
} |