Пример #1
0
 /**
  * @param CM_Frontend_Render $render
  * @param string             $path
  * @throws CM_Exception_Invalid
  * @return string
  */
 public static final function getClassnameByPath(CM_Frontend_Render $render, $path)
 {
     $path = (string) $path;
     $pathTokens = explode('/', $path);
     array_shift($pathTokens);
     // Rewrites code-of-honor to CodeOfHonor
     foreach ($pathTokens as &$pathToken) {
         $pathToken = CM_Util::camelize($pathToken);
     }
     return $render->getClassnameByPartialClassname('Page_' . implode('_', $pathTokens));
 }
Пример #2
0
 /**
  * @param string|null $projectName
  * @param string|null $domain
  * @param string|null $moduleName
  * @throws CM_Cli_Exception_Internal
  */
 public function bootstrapProject($projectName = null, $domain = null, $moduleName = null)
 {
     $generatorApp = new CM_Tools_Generator_Application($this->_getAppInstallation(), $this->_getStreamOutput());
     $projectName = $this->_read('Please provide project name (vendor/project):', $projectName, null, function ($value) use($generatorApp) {
         if (!$generatorApp->isValidProjectName($value)) {
             throw new CM_InputStream_InvalidValueException('Project name needs to be in `vendor/project` format');
         }
     });
     list($vendorName, $appName) = explode('/', $projectName);
     $defaultDomain = $appName . '.dev';
     $hint = "Please provide local domain [{$defaultDomain}]:";
     $domain = $this->_read($hint, $domain, $defaultDomain, function ($value) use($generatorApp) {
         if (!$generatorApp->isValidDomain($value)) {
             throw new CM_InputStream_InvalidValueException('Invalid domain name');
         }
     });
     $defaultModuleName = CM_Util::camelize($appName);
     $moduleName = $this->_read("Please provide module name [{$defaultModuleName}]:", $moduleName, $defaultModuleName, function ($value) {
         if (!$this->_isValidModuleName($value)) {
             throw new CM_InputStream_InvalidValueException('Invalid name');
         }
     });
     $siteName = $appName;
     $siteClassName = $moduleName . '_Site_' . CM_Util::camelize($siteName);
     try {
         $generatorApp->configureDevEnvironment($appName, $domain);
         $generatorApp->setProjectName($projectName);
         $this->createModule($moduleName);
         $this->createSite($siteClassName, $siteName, $domain);
     } catch (CM_Exception_Invalid $e) {
         throw new CM_Cli_Exception_Internal("Bootstrap failed! {$e->getMessage()}");
     }
 }
Пример #3
0
 protected function _notify()
 {
     $arguments = func_get_args();
     $methodName = '_notify' . CM_Util::camelize($this->getVerbName());
     if (is_callable([$this, $methodName])) {
         call_user_func_array(array($this, $methodName), $arguments);
     }
     $this->_track();
 }