protected function verifyParams($params = array())
 {
     $errors = parent::verifyParams($params);
     if (!preg_match('@^[a-z][a-z0-9]+$@', $this->plugin_id)) {
         $errors[] = "Invalid plugin ID";
     }
     if (empty($errors)) {
         if (!empty($params['version']) && !preg_match('@^[\\d]+(\\.\\d+)*$@', $params['version'])) {
             $errors[] = 'Invalid version format';
         }
         if ($info = wa()->getAppInfo($this->app_id)) {
             if (empty($info['plugins'])) {
                 $errors[] = "Application '{$this->app_id}' doesn't support plugins";
             } else {
                 if (!preg_match('@^[a-z][a-z0-9]+$@', $this->plugin_id)) {
                     $errors[] = "Invalid plugin ID";
                 }
                 if (isset($params['frontend']) && empty($info['frontend'])) {
                     $errors[] = "Invalid option frontend, application {$this->app_id} doesn't support frontend";
                 }
             }
         } else {
             $errors[] = "Application not found";
         }
     }
     return $errors;
 }
 protected function initPath()
 {
     parent::initPath();
     if ($this->app_id == 'webasyst') {
         $this->path = wa()->getConfig()->getPath('widgets') . '/' . $this->widget_id . '/';
     } else {
         $this->path = wa()->getAppPath('widgets/' . $this->widget_id, $this->app_id) . '/';
     }
 }
    protected function showHelp()
    {
        echo <<<HELP
Usage: php wa.php createApp [app_id] [parameters]
    app_id - App id (string in lower case)
Optional parameters:
    -name (App name; if comprised of several words, enclose in quotes; e.g., 'My app')
    -version (App version; e.g., 1.0.0)
    -vendor (Numerical vendor id)
    -frontend (1|true|themes) (Has frontend and if value is themes support design themes)
    -features (comma separated values)
        plugins (Supports plugins)
        cli (Has CLI handlers)
        api (Has API)
    -disable (1|true) not enable application at wa-config/apps.php

Example: php wa.php createApp myapp -name 'My app' -version 1.0.0 -vendor 123456 -frontend themes -plugins -cli -api
HELP;
        parent::showHelp();
    }