File tree Expand file tree Collapse file tree 3 files changed +15
-13
lines changed
Expand file tree Collapse file tree 3 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 1111namespace hidev \base ;
1212
1313use hidev \console \CommonBehavior ;
14+ use hidev \helpers \Helper ;
1415
1516/**
1617 * Basic controller.
@@ -61,22 +62,12 @@ public function runActions($actions)
6162 foreach ($ this ->normalizeTasks ($ actions ) as $ action => $ enabled ) {
6263 if ($ enabled ) {
6364 $ res = $ this ->runAction ($ action );
64- if (!static ::isResponseOk ($ res )) {
65+ if (!Helper ::isResponseOk ($ res )) {
6566 return $ res ;
6667 }
6768 }
6869 }
6970
7071 return 0 ;
7172 }
72-
73- /**
74- * Is response Ok.
75- * @param Response|int $response
76- * @return bool
77- */
78- public static function isResponseOk ($ response )
79- {
80- return !(is_object ($ response ) ? $ response ->exitStatus : $ response );
81- }
8273}
Original file line number Diff line number Diff line change 1111namespace hidev \console ;
1212
1313use hidev \base \Controller ;
14+ use hidev \helpers \Helper ;
1415use Yii ;
1516use yii \console \Request ;
1617
@@ -32,7 +33,7 @@ public function events()
3233 public function onBeforeAction ($ event )
3334 {
3435 $ result = $ this ->runRequests ($ event ->sender ->before );
35- if (!Controller ::isResponseOk ($ result )) {
36+ if (!Helper ::isResponseOk ($ result )) {
3637 $ this ->beforeResult = $ result ;
3738 $ event ->isValid = false ;
3839 }
@@ -53,7 +54,7 @@ public function runRequests($requests)
5354 foreach ($ this ->normalizeTasks ($ requests ) as $ request => $ enabled ) {
5455 if ($ enabled ) {
5556 $ response = $ this ->runRequest ($ request );
56- if (!Controller ::isResponseOk ($ response )) {
57+ if (!Helper ::isResponseOk ($ response )) {
5758 return $ response ;
5859 }
5960 }
Original file line number Diff line number Diff line change @@ -108,4 +108,14 @@ public static function readpassword($prompt)
108108
109109 return $ password ;
110110 }
111+
112+ /**
113+ * Is response Ok.
114+ * @param Response|int $response
115+ * @return bool
116+ */
117+ public static function isResponseOk ($ response )
118+ {
119+ return !(is_object ($ response ) ? $ response ->exitStatus : $ response );
120+ }
111121}
You can’t perform that action at this time.
0 commit comments