73 public function create($pattern, &$cmdPath) {
74 @list ($directory, $ext) = \explode(
'*', $pattern);
75 $directory ??=
'commands';
77 $template =
'createCommand.tpl';
78 $classname = \ucfirst($this->name);
79 $filename = $classname . $ext;
80 $aliases = \array_filter(\explode(
',', $this->aliases));
83 '%classname%' => $classname,
84 '%aliases%' => UArray::asPhpArray(
$aliases,
'array'),
87 '%description%' => $this->description ==
null ? ($this->name .
' description.') : \addslashes($this->description),
91 $path = \ROOT . \DS .
'..' . \DS . $directory;
93 $cmdPath = realpath($path) . \DS . $filename;
94 return UFileSystem::openReplaceWriteFromTemplateFile($this->
getTemplateDir() . $template, $cmdPath, $variables);