@@ -33,7 +33,7 @@ class Command {
3333
3434 protected static $ customAliases ;
3535
36- public function __construct ($ name = '' , $ value = '' , $ description = '' , $ aliases = [], $ parameters = [], $ examples = [], $ category = 'custom ' ) {
36+ public function __construct (string $ name = '' , string $ value = '' , string $ description = '' , array $ aliases = [], array $ parameters = [], array $ examples = [], string $ category = 'custom ' ) {
3737 $ this ->name = $ name ;
3838 $ this ->value = $ value ;
3939 $ this ->description = $ description ;
@@ -51,22 +51,22 @@ public function longString() {
5151 $ dec = "\t" ;
5252 $ result = "\n<b>■ " . $ this ->name . "</b> [ " . ConsoleFormatter::colorize ($ this ->value , ConsoleFormatter::YELLOW ) . "] => " ;
5353 $ result .= "\n" . $ dec . "· " . $ this ->description ;
54- if (sizeof ($ this ->aliases ) > 0 ) {
54+ if (\count ($ this ->aliases ) > 0 ) {
5555 $ result .= "\n" . $ dec . "· Aliases : " ;
5656 $ aliases = $ this ->aliases ;
5757 array_walk ($ aliases , function (&$ alias ) {
5858 $ alias = "<b> " . $ alias . "</b> " ;
5959 });
6060 $ result .= " " . implode (", " , $ aliases );
6161 }
62- if (sizeof ($ this ->parameters ) > 0 ) {
62+ if (\count ($ this ->parameters ) > 0 ) {
6363 $ result .= "\n" . $ dec . "· Parameters : " ;
6464 foreach ($ this ->parameters as $ param => $ content ) {
6565 $ result .= "\n" . $ dec . "\t<b>- " . $ param . "</b> " ;
6666 $ result .= $ content . "\n" ;
6767 }
6868 }
69- if (sizeof ($ this ->examples ) > 0 ) {
69+ if (\count ($ this ->examples ) > 0 ) {
7070 $ result .= "\n" . $ dec . "<b>× Samples :</b> " ;
7171 foreach ($ this ->examples as $ desc => $ sample ) {
7272 if (is_string ($ desc )) {
@@ -90,12 +90,12 @@ public static function getInfo($cmd) {
9090 "cmd " => $ command
9191 ]
9292 ];
93- } elseif (array_search ($ cmd , $ command ->getAliases ()) !== false ) {
93+ } elseif (\ array_search ($ cmd , $ command ->getAliases ()) !== false ) {
9494 $ result [] = [
9595 "info " => "Command <b> {$ cmd }</b> find by alias " ,
9696 "cmd " => $ command
9797 ];
98- } elseif (stripos ($ command ->getDescription (), $ cmd ) !== false ) {
98+ } elseif (\ stripos ($ command ->getDescription (), $ cmd ) !== false ) {
9999 $ result [] = [
100100 "info " => "Command <b> {$ cmd }</b> find in description " ,
101101 "cmd " => $ command
@@ -109,7 +109,7 @@ public static function getInfo($cmd) {
109109 "cmd " => $ command
110110 ];
111111 }
112- if (stripos ($ parameter ->getDescription (), $ cmd ) !== false ) {
112+ if (\ stripos ($ parameter ->getDescription (), $ cmd ) !== false ) {
113113 $ result [] = [
114114 "info " => "Command <b> {$ cmd }</b> find in parameter description " ,
115115 "cmd " => $ command
@@ -263,7 +263,7 @@ public static function serve() {
263263 "h " => Parameter::create ("host " , "Sets the host ip address. " , [], '127.0.0.1 ' ),
264264 "p " => Parameter::create ("port " , "Sets the listen port number. " , [], 8090 ),
265265 "n " => Parameter::create ("nolr " , "Starts without live-reload. " , [], false ),
266- "l " => Parameter::create ("lrport " , "Sets the live-reload listen port number. " , [], 35729 ),
266+ "l " => Parameter::create ("lrport " , "Sets the live-reload listen port number. " , [], ' 35729 ' ),
267267 "t " => Parameter::create ("type " , "Sets the server type. " , [
268268 'php ' ,
269269 'react ' ,
@@ -326,7 +326,8 @@ public static function crudController() {
326326 "form " ,
327327 "display "
328328 ], "index,form,display " ),
329- "p " => Parameter::create ("path " , "The associated route " , [])
329+ "p " => Parameter::create ("path " , "The associated route " , []),
330+ 'o ' => Parameter::create ('domain ' , 'The domain in which to create the controller. ' , [], '' )
330331 ], [
331332 'Creates a crud controller for the class models\User ' => 'Ubiquity crud CrudUsers -r=User ' ,
332333 'and associates a route to it ' => 'Ubiquity crud CrudUsers -r=User -p=/users ' ,
@@ -360,7 +361,8 @@ public static function indexCrudController() {
360361 ], "index,form,display,home,itemHome " ),
361362 "p " => Parameter::create ("path " , "The associated route " , [
362363 '{resource} '
363- ])
364+ ]),
365+ 'o ' => Parameter::create ('domain ' , 'The domain in which to create the controller. ' , [], '' )
364366 ], [
365367 'Creates an index crud controller ' => 'Ubiquity crud-index MainCrud -p=crud/{resource} ' ,
366368 'allows customization of index and form templates ' => 'Ubiquity index-crud MainCrud -t=index,form '
@@ -437,7 +439,7 @@ public static function newAction() {
437439 "true " ,
438440 "false "
439441 ], "false " ),
440- 'o ' => Parameter::create ('domain ' , 'The domain in which to create the models . ' , [], '' )
442+ 'o ' => Parameter::create ('domain ' , 'The domain in which the controller is . ' , [], '' )
441443 ], [
442444 'Adds the action all in controller Users ' => 'Ubiquity action Users.all ' ,
443445 'Adds the action display in controller Users with a parameter ' => 'Ubiquity action Users.display -p=idUser ' ,
@@ -793,7 +795,7 @@ public function getDescription() {
793795 */
794796 public function getValue () {
795797 if ($ this ->value != null ) {
796- return ltrim ($ this ->value , '? ' );
798+ return \ ltrim ($ this ->value , '? ' );
797799 }
798800 return $ this ->value ;
799801 }
@@ -843,7 +845,7 @@ public function setCategory($category) {
843845 }
844846
845847 public function hasParameters () {
846- return count ($ this ->parameters ) > 0 ;
848+ return \ count ($ this ->parameters ) > 0 ;
847849 }
848850
849851 public function hasValue () {
0 commit comments