@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var $type |
| 17 | 17 | */ |
| 18 | - public $type='request'; |
|
| 18 | + public $type = 'request'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var array |
@@ -32,15 +32,15 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var $commandRule |
| 34 | 34 | */ |
| 35 | - public $commandRule=['request']; |
|
| 35 | + public $commandRule = ['request']; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @method create |
| 39 | 39 | * @return mixed |
| 40 | 40 | */ |
| 41 | - public function create(){
|
|
| 41 | + public function create() {
|
|
| 42 | 42 | |
| 43 | - $request=$this->argument['request']; |
|
| 43 | + $request = $this->argument['request']; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | $this->directory['requestCreate'] = path()->request(); |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | //set project directory |
| 51 | 51 | $this->file->makeDirectory($this); |
| 52 | 52 | |
| 53 | - if(!file_exists($this->directory['requestCreate'].'/Request.php')){
|
|
| 53 | + if (!file_exists($this->directory['requestCreate'].'/Request.php')) {
|
|
| 54 | 54 | $this->touch['source/request'] = $this->directory['requestCreate'].'/Request.php'; |
| 55 | 55 | $this->touch['source/requestGenerator'] = $this->directory['requestCreate'].'/RequestGenerator.php'; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if(!file_exists($this->directory['requestCreate'].'/RequestProvider.php')){
|
|
| 58 | + if (!file_exists($this->directory['requestCreate'].'/RequestProvider.php')) {
|
|
| 59 | 59 | $this->touch['source/requestProvider'] = $this->directory['requestCreate'].'/RequestProvider.php'; |
| 60 | 60 | } |
| 61 | 61 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var $type |
| 16 | 16 | */ |
| 17 | - public $type='token'; |
|
| 17 | + public $type = 'token'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array |
@@ -31,20 +31,20 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var $commandRule |
| 33 | 33 | */ |
| 34 | - public $commandRule=['key']; |
|
| 34 | + public $commandRule = ['key']; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @method create |
| 38 | 38 | * @return mixed |
| 39 | 39 | */ |
| 40 | - public function create(){
|
|
| 40 | + public function create() {
|
|
| 41 | 41 | |
| 42 | 42 | // |
| 43 | - $clientApiToken=StaticPathModel::appMiddlewarePath($this->projectName()).'\\ClientApiToken'; |
|
| 44 | - $resolveClientApiToken=DIContainerManager::resolve($clientApiToken,$this->app->app->applicationProviderBinding($this->app->app)); |
|
| 43 | + $clientApiToken = StaticPathModel::appMiddlewarePath($this->projectName()).'\\ClientApiToken'; |
|
| 44 | + $resolveClientApiToken = DIContainerManager::resolve($clientApiToken, $this->app->app->applicationProviderBinding($this->app->app)); |
|
| 45 | 45 | |
| 46 | 46 | // |
| 47 | - $key=lcfirst($this->argument['key']); |
|
| 47 | + $key = lcfirst($this->argument['key']); |
|
| 48 | 48 | |
| 49 | 49 | echo $this->info($resolveClientApiToken->createToken($key)); |
| 50 | 50 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * @var $type |
| 15 | 15 | */ |
| 16 | - public $type='command'; |
|
| 16 | + public $type = 'command'; |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @var array |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * @var $commandRule |
| 27 | 27 | */ |
| 28 | - protected $commandRule=['command']; |
|
| 28 | + protected $commandRule = ['command']; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @method create |
| 32 | 32 | * @return mixed |
| 33 | 33 | */ |
| 34 | - public function create(){
|
|
| 34 | + public function create() {
|
|
| 35 | 35 | |
| 36 | 36 | $this->directory['commandDir'] = path()->command(); |
| 37 | 37 | $this->argument['commandNamespace'] = app()->namespace()->command(); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | //set project directory |
| 41 | 41 | $this->file->makeDirectory($this); |
| 42 | 42 | |
| 43 | - $this->touch['command/file'] = $this->directory['commandDir'].'/'.$this->argument['command'].'.php'; |
|
| 43 | + $this->touch['command/file'] = $this->directory['commandDir'].'/'.$this->argument['command'].'.php'; |
|
| 44 | 44 | |
| 45 | 45 | $this->file->touch($this); |
| 46 | 46 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | 18 | //if there is no arguments constant |
| 19 | - if(!defined('arguments')) define ('arguments',['api']);
|
|
| 19 | + if (!defined('arguments')) define('arguments', ['api']);
|
|
| 20 | 20 | |
| 21 | 21 | //get psr standard console arguments |
| 22 | 22 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @method getConsoleClass |
| 27 | 27 | * @return mixed |
| 28 | 28 | */ |
| 29 | - public function getConsoleClass(){
|
|
| 29 | + public function getConsoleClass() {
|
|
| 30 | 30 | |
| 31 | 31 | return current($this->getArguments()); |
| 32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @method getConsoleClassMethod |
| 36 | 36 | * @return mixed |
| 37 | 37 | */ |
| 38 | - public function getConsoleClassMethod(){
|
|
| 38 | + public function getConsoleClassMethod() {
|
|
| 39 | 39 | |
| 40 | 40 | return $this->getArguments()[1]; |
| 41 | 41 | } |
@@ -44,44 +44,44 @@ discard block |
||
| 44 | 44 | * @method getConsoleClassMethod |
| 45 | 45 | * @return mixed |
| 46 | 46 | */ |
| 47 | - public function getConsoleClassRealArguments(){
|
|
| 47 | + public function getConsoleClassRealArguments() {
|
|
| 48 | 48 | |
| 49 | - return array_slice($this->getArguments(),2); |
|
| 49 | + return array_slice($this->getArguments(), 2); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @method getConsoleArgumentsWithKey |
| 54 | 54 | * @return array |
| 55 | 55 | */ |
| 56 | - public function getConsoleArgumentsWithKey(){
|
|
| 56 | + public function getConsoleArgumentsWithKey() {
|
|
| 57 | 57 | |
| 58 | 58 | //get console class real arguments |
| 59 | - $getConsoleClassRealArguments=$this->getConsoleClassRealArguments(); |
|
| 59 | + $getConsoleClassRealArguments = $this->getConsoleClassRealArguments(); |
|
| 60 | 60 | |
| 61 | - $listKey=[]; |
|
| 62 | - $listKey['project']=null; |
|
| 61 | + $listKey = []; |
|
| 62 | + $listKey['project'] = null; |
|
| 63 | 63 | |
| 64 | - if(property_exists($this,'consoleClassNamespace')){
|
|
| 64 | + if (property_exists($this, 'consoleClassNamespace')) {
|
|
| 65 | 65 | $listKey['class'] = strtolower(class_basename($this->consoleClassNamespace)); |
| 66 | 66 | $listKey['classMethod'] = strtolower($this->getConsoleClassMethod()); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - foreach($getConsoleClassRealArguments as $key=>$value){
|
|
| 69 | + foreach ($getConsoleClassRealArguments as $key=>$value) {
|
|
| 70 | 70 | |
| 71 | - if($key=="0"){
|
|
| 71 | + if ($key=="0") {
|
|
| 72 | 72 | |
| 73 | - $listKey['project']=$value; |
|
| 73 | + $listKey['project'] = $value; |
|
| 74 | 74 | } |
| 75 | - else{
|
|
| 75 | + else {
|
|
| 76 | 76 | |
| 77 | - $colonExplode=explode(":",$value);
|
|
| 78 | - $listKey[strtolower($colonExplode[0])]=ucfirst($colonExplode[1]); |
|
| 77 | + $colonExplode = explode(":", $value);
|
|
| 78 | + $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | //get app version |
| 84 | - $listKey['version']=UrlVersionIdentifier::version(); |
|
| 84 | + $listKey['version'] = UrlVersionIdentifier::version(); |
|
| 85 | 85 | |
| 86 | 86 | return $listKey; |
| 87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | /** |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - public function consoleClassNamespace(){
|
|
| 93 | + public function consoleClassNamespace() {
|
|
| 94 | 94 | return 'Resta\Console\\Source\\'.$this->getConsoleClass().'\\'.$this->getConsoleClass(); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -101,18 +101,18 @@ discard block |
||
| 101 | 101 | public function defineAppnameForCustomConsole() |
| 102 | 102 | {
|
| 103 | 103 | |
| 104 | - $arguments=$this->getArguments(); |
|
| 104 | + $arguments = $this->getArguments(); |
|
| 105 | 105 | |
| 106 | - $getConsoleArgumentsWithKey=$this->getConsoleArgumentsWithKey(); |
|
| 106 | + $getConsoleArgumentsWithKey = $this->getConsoleArgumentsWithKey(); |
|
| 107 | 107 | |
| 108 | - if(isset($arguments[2])){
|
|
| 109 | - $app=$arguments[2]; |
|
| 108 | + if (isset($arguments[2])) {
|
|
| 109 | + $app = $arguments[2]; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if(!defined('group')){
|
|
| 113 | - define('group',StaticPathList::$projectPrefixGroup);
|
|
| 112 | + if (!defined('group')) {
|
|
| 113 | + define('group', StaticPathList::$projectPrefixGroup);
|
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(!defined('app') and isset($arguments[2])) define('app',$app);
|
|
| 116 | + if (!defined('app') and isset($arguments[2])) define('app', $app);
|
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | \ No newline at end of file |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | {
|
| 17 | 17 | |
| 18 | 18 | //if there is no arguments constant |
| 19 | - if(!defined('arguments')) define ('arguments',['api']);
|
|
| 19 | + if(!defined('arguments')) {
|
|
| 20 | + define ('arguments',['api']);
|
|
| 21 | + } |
|
| 20 | 22 | |
| 21 | 23 | //get psr standard console arguments |
| 22 | 24 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -71,8 +73,7 @@ discard block |
||
| 71 | 73 | if($key=="0"){
|
| 72 | 74 | |
| 73 | 75 | $listKey['project']=$value; |
| 74 | - } |
|
| 75 | - else{
|
|
| 76 | + } else{
|
|
| 76 | 77 | |
| 77 | 78 | $colonExplode=explode(":",$value);
|
| 78 | 79 | $listKey[strtolower($colonExplode[0])]=ucfirst($colonExplode[1]); |
@@ -113,6 +114,8 @@ discard block |
||
| 113 | 114 | define('group',StaticPathList::$projectPrefixGroup);
|
| 114 | 115 | } |
| 115 | 116 | |
| 116 | - if(!defined('app') and isset($arguments[2])) define('app',$app);
|
|
| 117 | + if(!defined('app') and isset($arguments[2])) {
|
|
| 118 | + define('app',$app);
|
|
| 119 | + } |
|
| 117 | 120 | } |
| 118 | 121 | } |
| 119 | 122 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @var $directory |
| 42 | 42 | */ |
| 43 | - public $directory=array(); |
|
| 43 | + public $directory = array(); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @var $app |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @var $touch |
| 57 | 57 | */ |
| 58 | - public $touch=array(); |
|
| 58 | + public $touch = array(); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * ConsoleOutputter constructor. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param $app |
| 64 | 64 | * @param $command |
| 65 | 65 | */ |
| 66 | - public function __construct($argument,$app) {
|
|
| 66 | + public function __construct($argument, $app) {
|
|
| 67 | 67 | |
| 68 | 68 | // Set up shell colors |
| 69 | 69 | $this->foreground_colors['black'] = '0;30'; |
@@ -92,14 +92,14 @@ discard block |
||
| 92 | 92 | $this->background_colors['cyan'] = '46'; |
| 93 | 93 | $this->background_colors['light_gray'] = '47'; |
| 94 | 94 | |
| 95 | - $this->app=$app; |
|
| 96 | - $this->argument=$argument; |
|
| 97 | - $this->file=new FileProcess(); |
|
| 98 | - $table=require_once ('ConsoleTable.php');
|
|
| 99 | - $this->table=new \console_table(); |
|
| 95 | + $this->app = $app; |
|
| 96 | + $this->argument = $argument; |
|
| 97 | + $this->file = new FileProcess(); |
|
| 98 | + $table = require_once ('ConsoleTable.php');
|
|
| 99 | + $this->table = new \console_table(); |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | - if(isset($this->argument['project'])){
|
|
| 102 | + if (isset($this->argument['project'])) {
|
|
| 103 | 103 | |
| 104 | 104 | $this->argument['repositoryNamespace'] = app()->namespace()->repository(); |
| 105 | 105 | $this->argument['modelNamespace'] = app()->namespace()->model(); |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | $this->argument['versionNamespace'] = app()->namespace()->version(); |
| 108 | 108 | |
| 109 | 109 | |
| 110 | - $this->argument['project']=$this->argument['project'].'\\'.StaticPathList::$projectPrefixGroup; |
|
| 110 | + $this->argument['project'] = $this->argument['project'].'\\'.StaticPathList::$projectPrefixGroup; |
|
| 111 | 111 | |
| 112 | 112 | |
| 113 | - $this->project=StaticPathModel::appPath().'/'.str_replace('\\','/',$this->argument['project']);
|
|
| 113 | + $this->project = StaticPathModel::appPath().'/'.str_replace('\\', '/', $this->argument['project']);
|
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | } |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | return array_keys($this->background_colors); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function ReadStdin($prompt=null, $valid_inputs=null, $default = '') {
|
|
| 131 | - while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == 'is_file' && !is_file($input))) {
|
|
| 130 | + public function ReadStdin($prompt = null, $valid_inputs = null, $default = '') {
|
|
| 131 | + while (!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs=='is_file' && !is_file($input))) {
|
|
| 132 | 132 | echo $this->input($prompt); |
| 133 | 133 | $input = strtolower(trim(fgets(STDIN))); |
| 134 | - if(empty($input) && !empty($default)) {
|
|
| 134 | + if (empty($input) && !empty($default)) {
|
|
| 135 | 135 | $input = $default; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -142,22 +142,22 @@ discard block |
||
| 142 | 142 | * @param $commander |
| 143 | 143 | * @return string |
| 144 | 144 | */ |
| 145 | - public function exception($commander){
|
|
| 145 | + public function exception($commander) {
|
|
| 146 | 146 | return $this->error('[['.$commander['argument'].']] parameter is missing for commander');
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
| 150 | 150 | * @param $data |
| 151 | 151 | */ |
| 152 | - public function checkGroupArgument($data,$seperate="\\"){
|
|
| 152 | + public function checkGroupArgument($data, $seperate = "\\") {
|
|
| 153 | 153 | |
| 154 | - $dataParse=explode("\\",$data);
|
|
| 154 | + $dataParse = explode("\\", $data);
|
|
| 155 | 155 | |
| 156 | - if(isset($this->argument['group'])){
|
|
| 157 | - $argument=current($dataParse).''.$seperate.''.$this->argument['group']; |
|
| 156 | + if (isset($this->argument['group'])) {
|
|
| 157 | + $argument = current($dataParse).''.$seperate.''.$this->argument['group']; |
|
| 158 | 158 | } |
| 159 | - else{
|
|
| 160 | - $argument=current($dataParse); |
|
| 159 | + else {
|
|
| 160 | + $argument = current($dataParse); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $argument; |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | /** |
| 167 | 167 | * @param $string |
| 168 | 168 | */ |
| 169 | - public function consoleLogger($string,$level) |
|
| 169 | + public function consoleLogger($string, $level) |
|
| 170 | 170 | {
|
| 171 | - if(config('app')!==null && config('app.consoleLogger')){
|
|
| 171 | + if (config('app')!==null && config('app.consoleLogger')) {
|
|
| 172 | 172 | |
| 173 | 173 | logger('console')->{$level}([
|
| 174 | - 'argument' => implode(" ",core()->consoleArguments),
|
|
| 174 | + 'argument' => implode(" ", core()->consoleArguments),
|
|
| 175 | 175 | 'result' => $string, |
| 176 | 176 | ]); |
| 177 | 177 | } |
@@ -155,8 +155,7 @@ |
||
| 155 | 155 | |
| 156 | 156 | if(isset($this->argument['group'])){
|
| 157 | 157 | $argument=current($dataParse).''.$seperate.''.$this->argument['group']; |
| 158 | - } |
|
| 159 | - else{
|
|
| 158 | + } else{
|
|
| 160 | 159 | $argument=current($dataParse); |
| 161 | 160 | } |
| 162 | 161 | |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * @method bindConsoleShared |
| 21 | 21 | * @return array |
| 22 | 22 | */ |
| 23 | - private function bindConsoleShared(){
|
|
| 23 | + private function bindConsoleShared() {
|
|
| 24 | 24 | |
| 25 | 25 | //We assign the values assigned to the console object to the bindings array. |
| 26 | 26 | //The console object represents the classes to be bound for the kernel object console. |
| 27 | 27 | //if the array returns false on an if condition, the array will be automatically detected as empty. |
| 28 | - if(isset($this->app['consoleShared']) and is_array($this->app['consoleShared'])){
|
|
| 28 | + if (isset($this->app['consoleShared']) and is_array($this->app['consoleShared'])) {
|
|
| 29 | 29 | return $this->app['consoleShared']; |
| 30 | 30 | } |
| 31 | 31 | return []; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param $container |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function bindForAppCommand($object,$container){
|
|
| 39 | + public function bindForAppCommand($object, $container) {
|
|
| 40 | 40 | |
| 41 | 41 | //We need a definition of the application name from the data supplied with the console variables. |
| 42 | 42 | //The specified app variable is important to us in the command that is run in the application. |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | //we send the value to the bind method without callback after checking the bind object to be loaded for the console. |
| 55 | 55 | //This is the value found in the bindings variable. |
| 56 | 56 | //Thus, we get the binding objects required for the console independently of the http method installation. |
| 57 | - if(isset($this->bindings[$object])){
|
|
| 58 | - $this->app->{$appresolve}($object,$this->bindings[$object]);
|
|
| 57 | + if (isset($this->bindings[$object])) {
|
|
| 58 | + $this->app->{$appresolve}($object, $this->bindings[$object]);
|
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,25 +64,25 @@ discard block |
||
| 64 | 64 | * @param $callback |
| 65 | 65 | * @param $container |
| 66 | 66 | */ |
| 67 | - public function console($object,$callback,$container){
|
|
| 67 | + public function console($object, $callback, $container) {
|
|
| 68 | 68 | |
| 69 | 69 | //If the console argument is an operator that exists in the resta kernel, |
| 70 | 70 | //we run a callback method to check it. The bindings for the custom application commander will be run. |
| 71 | - $this->bindForAppCommand($object,$container); |
|
| 71 | + $this->bindForAppCommand($object, $container); |
|
| 72 | 72 | |
| 73 | 73 | //closure object |
| 74 | 74 | $callBackResolve = Utils::callbackProcess($callback); |
| 75 | 75 | |
| 76 | 76 | // if the callbackresolve variable represents a class, |
| 77 | 77 | // we directly register it's resolved status to the container object. |
| 78 | - if(Utils::isNamespaceExists($callBackResolve)){
|
|
| 79 | - $this->app->register($object,$this->app->resolve(Utils::callbackProcess($callback))); |
|
| 78 | + if (Utils::isNamespaceExists($callBackResolve)) {
|
|
| 79 | + $this->app->register($object, $this->app->resolve(Utils::callbackProcess($callback))); |
|
| 80 | 80 | } |
| 81 | - else{
|
|
| 81 | + else {
|
|
| 82 | 82 | |
| 83 | 83 | // if callbackresolve doesn't represent a class, |
| 84 | 84 | // we're register it's no resolved status. |
| 85 | - $this->app->register($object,Utils::callbackProcess($callback)); |
|
| 85 | + $this->app->register($object, Utils::callbackProcess($callback)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | // we directly register it's resolved status to the container object. |
| 78 | 78 | if(Utils::isNamespaceExists($callBackResolve)){
|
| 79 | 79 | $this->app->register($object,$this->app->resolve(Utils::callbackProcess($callback))); |
| 80 | - } |
|
| 81 | - else{
|
|
| 80 | + } else{
|
|
| 82 | 81 | |
| 83 | 82 | // if callbackresolve doesn't represent a class, |
| 84 | 83 | // we're register it's no resolved status. |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | function convert($string, $colored = true) |
| 218 | 218 | {
|
| 219 | 219 | static $conversions = array ( // static so the array doesn't get built |
| 220 | - // everytime |
|
| 220 | + // everytime |
|
| 221 | 221 | // %y - yellow, and so on... {{{
|
| 222 | 222 | '%y' => array('color' => 'yellow'),
|
| 223 | 223 | '%g' => array('color' => 'green' ),
|
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $string = str_replace('%%', '% ', $string);
|
| 261 | 261 | foreach ($conversions as $key => $value) {
|
| 262 | 262 | $string = str_replace($key, Console_Color::color($value), |
| 263 | - $string); |
|
| 263 | + $string); |
|
| 264 | 264 | } |
| 265 | 265 | $string = str_replace('% ', '%', $string);
|
| 266 | 266 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -$GLOBALS['_CONSOLE_COLOR_CODES'] = array ( |
|
| 35 | +$GLOBALS['_CONSOLE_COLOR_CODES'] = array( |
|
| 36 | 36 | 'color' => array( |
| 37 | 37 | 'black' => 30, |
| 38 | 38 | 'red' => 31, |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $color = @$color['color']; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ($color == 'reset') {
|
|
| 115 | + if ($color=='reset') {
|
|
| 116 | 116 | return "\033[0m"; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -216,37 +216,37 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | function convert($string, $colored = true) |
| 218 | 218 | {
|
| 219 | - static $conversions = array ( // static so the array doesn't get built |
|
| 219 | + static $conversions = array( // static so the array doesn't get built |
|
| 220 | 220 | // everytime |
| 221 | 221 | // %y - yellow, and so on... {{{
|
| 222 | 222 | '%y' => array('color' => 'yellow'),
|
| 223 | - '%g' => array('color' => 'green' ),
|
|
| 224 | - '%b' => array('color' => 'blue' ),
|
|
| 225 | - '%r' => array('color' => 'red' ),
|
|
| 223 | + '%g' => array('color' => 'green'),
|
|
| 224 | + '%b' => array('color' => 'blue'),
|
|
| 225 | + '%r' => array('color' => 'red'),
|
|
| 226 | 226 | '%p' => array('color' => 'purple'),
|
| 227 | 227 | '%m' => array('color' => 'purple'),
|
| 228 | - '%c' => array('color' => 'cyan' ),
|
|
| 229 | - '%w' => array('color' => 'grey' ),
|
|
| 230 | - '%k' => array('color' => 'black' ),
|
|
| 231 | - '%n' => array('color' => 'reset' ),
|
|
| 232 | - '%Y' => array('color' => 'yellow', 'style' => 'light'),
|
|
| 233 | - '%G' => array('color' => 'green', 'style' => 'light'),
|
|
| 234 | - '%B' => array('color' => 'blue', 'style' => 'light'),
|
|
| 235 | - '%R' => array('color' => 'red', 'style' => 'light'),
|
|
| 236 | - '%P' => array('color' => 'purple', 'style' => 'light'),
|
|
| 237 | - '%M' => array('color' => 'purple', 'style' => 'light'),
|
|
| 238 | - '%C' => array('color' => 'cyan', 'style' => 'light'),
|
|
| 239 | - '%W' => array('color' => 'grey', 'style' => 'light'),
|
|
| 240 | - '%K' => array('color' => 'black', 'style' => 'light'),
|
|
| 241 | - '%N' => array('color' => 'reset', 'style' => 'light'),
|
|
| 228 | + '%c' => array('color' => 'cyan'),
|
|
| 229 | + '%w' => array('color' => 'grey'),
|
|
| 230 | + '%k' => array('color' => 'black'),
|
|
| 231 | + '%n' => array('color' => 'reset'),
|
|
| 232 | + '%Y' => array('color' => 'yellow', 'style' => 'light'),
|
|
| 233 | + '%G' => array('color' => 'green', 'style' => 'light'),
|
|
| 234 | + '%B' => array('color' => 'blue', 'style' => 'light'),
|
|
| 235 | + '%R' => array('color' => 'red', 'style' => 'light'),
|
|
| 236 | + '%P' => array('color' => 'purple', 'style' => 'light'),
|
|
| 237 | + '%M' => array('color' => 'purple', 'style' => 'light'),
|
|
| 238 | + '%C' => array('color' => 'cyan', 'style' => 'light'),
|
|
| 239 | + '%W' => array('color' => 'grey', 'style' => 'light'),
|
|
| 240 | + '%K' => array('color' => 'black', 'style' => 'light'),
|
|
| 241 | + '%N' => array('color' => 'reset', 'style' => 'light'),
|
|
| 242 | 242 | '%3' => array('background' => 'yellow'),
|
| 243 | - '%2' => array('background' => 'green' ),
|
|
| 244 | - '%4' => array('background' => 'blue' ),
|
|
| 245 | - '%1' => array('background' => 'red' ),
|
|
| 243 | + '%2' => array('background' => 'green'),
|
|
| 244 | + '%4' => array('background' => 'blue'),
|
|
| 245 | + '%1' => array('background' => 'red'),
|
|
| 246 | 246 | '%5' => array('background' => 'purple'),
|
| 247 | - '%6' => array('background' => 'cyan' ),
|
|
| 248 | - '%7' => array('background' => 'grey' ),
|
|
| 249 | - '%0' => array('background' => 'black' ),
|
|
| 247 | + '%6' => array('background' => 'cyan'),
|
|
| 248 | + '%7' => array('background' => 'grey'),
|
|
| 249 | + '%0' => array('background' => 'black'),
|
|
| 250 | 250 | // Don't use this, I can't stand flashing text |
| 251 | 251 | '%F' => array('style' => 'blink'),
|
| 252 | 252 | '%U' => array('style' => 'underline'),
|
@@ -15,25 +15,24 @@ discard block |
||
| 15 | 15 | {
|
| 16 | 16 | $getCommandList = app()->commandList(); |
| 17 | 17 | |
| 18 | - $this->table->setHeaders(['command','project','params','description']); |
|
| 18 | + $this->table->setHeaders(['command', 'project', 'params', 'description']); |
|
| 19 | 19 | |
| 20 | 20 | $app = $this; |
| 21 | 21 | |
| 22 | - foreach ($getCommandList as $command=>$runnable){
|
|
| 22 | + foreach ($getCommandList as $command=>$runnable) {
|
|
| 23 | 23 | |
| 24 | - $commandInstance = app()->resolve($command,['argument'=>[]]); |
|
| 24 | + $commandInstance = app()->resolve($command, ['argument'=>[]]); |
|
| 25 | 25 | |
| 26 | 26 | $className = class_basename($commandInstance); |
| 27 | 27 | |
| 28 | - ClosureDispatcher::bind($commandInstance)->call(function() use($app,$className) |
|
| 28 | + ClosureDispatcher::bind($commandInstance)->call(function() use($app, $className) |
|
| 29 | 29 | {
|
| 30 | - if(isset($this->runnableMethods)){
|
|
| 30 | + if (isset($this->runnableMethods)) {
|
|
| 31 | 31 | |
| 32 | - foreach ($this->runnableMethods as $method=>$description){
|
|
| 32 | + foreach ($this->runnableMethods as $method=>$description) {
|
|
| 33 | 33 | |
| 34 | 34 | $commandRule = (isset($this->commandRule[$method])) ? |
| 35 | - $app->methodCommandRule($this->commandRule[$method]) : |
|
| 36 | - $app->methodCommandRule($this->commandRule); |
|
| 35 | + $app->methodCommandRule($this->commandRule[$method]) : $app->methodCommandRule($this->commandRule); |
|
| 37 | 36 | |
| 38 | 37 | $projectStatus = (isset($this->projectStatus)) ? 'YES' : 'NO'; |
| 39 | 38 | |
@@ -61,15 +60,15 @@ discard block |
||
| 61 | 60 | public function methodCommandRule($commandRule) |
| 62 | 61 | {
|
| 63 | 62 | |
| 64 | - if(is_array($commandRule)){
|
|
| 63 | + if (is_array($commandRule)) {
|
|
| 65 | 64 | |
| 66 | 65 | $list = []; |
| 67 | 66 | |
| 68 | - foreach ($commandRule as $rule){
|
|
| 67 | + foreach ($commandRule as $rule) {
|
|
| 69 | 68 | $list[] = $rule.':['.$rule.']'; |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | - return implode(" ",$list);
|
|
| 71 | + return implode(" ", $list);
|
|
| 73 | 72 | } |
| 74 | 73 | |
| 75 | 74 | return '['.$commandRule.']'; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * @var array $prepareBind |
| 11 | 11 | */ |
| 12 | - protected $prepareBind=[]; |
|
| 12 | + protected $prepareBind = []; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * @param $commander |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public function prepareCommander($commander) |
| 19 | 19 | {
|
| 20 | - $commander=$commander->call(function() use($commander){
|
|
| 20 | + $commander = $commander->call(function() use($commander){
|
|
| 21 | 21 | |
| 22 | 22 | return [ |
| 23 | 23 | 'commandRule' => $this->commandRule, |
@@ -35,16 +35,15 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected function resolveParameters($commander) |
| 37 | 37 | {
|
| 38 | - if(isset($commander['commandRule'][$commander['method']])){
|
|
| 39 | - $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
| 38 | + if (isset($commander['commandRule'][$commander['method']])) {
|
|
| 39 | + $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : |
|
| 43 | - $this->getDefaultCommandRules($commander['commandRule']); |
|
| 42 | + $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : $this->getDefaultCommandRules($commander['commandRule']); |
|
| 44 | 43 | |
| 45 | - foreach ($commandRule as $key=>$value){
|
|
| 46 | - if(!preg_match('@\?.+@is',$value)){
|
|
| 47 | - if(!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]==""){
|
|
| 44 | + foreach ($commandRule as $key=>$value) {
|
|
| 45 | + if (!preg_match('@\?.+@is', $value)) {
|
|
| 46 | + if (!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]=="") {
|
|
| 48 | 47 | return [ |
| 49 | 48 | 'status'=>false, |
| 50 | 49 | 'argument'=>$value, |
@@ -66,12 +65,12 @@ discard block |
||
| 66 | 65 | {
|
| 67 | 66 | $list = []; |
| 68 | 67 | |
| 69 | - if(!is_array($rules)) $rules = []; |
|
| 68 | + if (!is_array($rules)) $rules = []; |
|
| 70 | 69 | |
| 71 | - foreach ($rules as $key=>$rule){
|
|
| 70 | + foreach ($rules as $key=>$rule) {
|
|
| 72 | 71 | |
| 73 | - if(!is_array($rules[$key])){
|
|
| 74 | - $list[$key]=$rule; |
|
| 72 | + if (!is_array($rules[$key])) {
|
|
| 73 | + $list[$key] = $rule; |
|
| 75 | 74 | } |
| 76 | 75 | } |
| 77 | 76 | |
@@ -66,7 +66,9 @@ |
||
| 66 | 66 | {
|
| 67 | 67 | $list = []; |
| 68 | 68 | |
| 69 | - if(!is_array($rules)) $rules = []; |
|
| 69 | + if(!is_array($rules)) {
|
|
| 70 | + $rules = []; |
|
| 71 | + } |
|
| 70 | 72 | |
| 71 | 73 | foreach ($rules as $key=>$rule){
|
| 72 | 74 | |