-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/tradefurniturecompany/image/issues/1
- Loading branch information
1 parent
cb136f3
commit 2cb467c
Showing
3 changed files
with
69 additions
and
1 deletion.
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
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,66 @@ | ||
<?php | ||
namespace Df\Framework\Console; | ||
use Exception as E; | ||
use Magento\Framework\Console\Cli; | ||
use Magento\Framework\ObjectManager\NoninterceptableInterface as INonInterceptable; | ||
use Symfony\Component\Console\Command\Command as _P; | ||
use Symfony\Component\Console\Input\InputInterface as I; | ||
use Symfony\Component\Console\Output\OutputInterface as O; | ||
/** | ||
* 2020-10-25 | ||
* @see \TFC\Image\Command | ||
*/ | ||
abstract class Command extends _P implements INonInterceptable { | ||
/** | ||
* 2020-10-25 | ||
* @used-by execute() | ||
* @see \TFC\Image\Command::p() | ||
* @return void | ||
*/ | ||
abstract protected function p(); | ||
|
||
/** | ||
* 2020-10-25 | ||
* @override | ||
* @see \Symfony\Component\Console\Command\Command::execute() | ||
* @return int | ||
*/ | ||
final protected function execute(I $i, O $o) {$this->_i = $i; $this->_o = $o; return df_try( | ||
function() {$this->p(); return Cli::RETURN_SUCCESS;} | ||
,function(E $e) use($o) { | ||
$o->writeln(df_tag('error', [], $e->getMessage())); | ||
if (O::VERBOSITY_VERBOSE <= $o->getVerbosity()) { | ||
$o->writeln($e->getTraceAsString()); | ||
} | ||
return Cli::RETURN_FAILURE; | ||
} | ||
);} | ||
|
||
/** | ||
* 2020-10-25 | ||
* @return I | ||
*/ | ||
final protected function input() {return $this->_i;} | ||
|
||
/** | ||
* 2020-10-25 | ||
* @return O | ||
*/ | ||
final protected function output() {return $this->_o;} | ||
|
||
/** | ||
* 2020-20-25 | ||
* @used-by execute() | ||
* @used-by input() | ||
* @var I | ||
*/ | ||
private $_i; | ||
|
||
/** | ||
* 2020-20-25 | ||
* @used-by execute() | ||
* @used-by output() | ||
* @var O | ||
*/ | ||
private $_o; | ||
} |