Пример #1
0
 public static function getInstance()
 {
     if (self::$Instance === null) {
         $type = self::getType();
         $class_name = "{$type}Yaml";
         self::$Instance = new $class_name();
     }
     return self::$Instance;
 }
Пример #2
0
 public static function load()
 {
     $Yml = YamlFactory::factory();
     self::$config = $Yml->load('config/config.yaml');
     if (!empty(self::$config['import-file'])) {
         foreach (self::$config['import-file'] as $name => $link) {
             if (is_file($link)) {
                 self::$config[$name] = $Yml->load($link);
             } else {
                 exit('config/config.yaml: The file ' . $link . ' doesn\'t exists.');
             }
         }
         unset(self::$config['import-file']);
     }
 }
Пример #3
0
 public function execute()
 {
     $name = $this->getArgumentsValue('name');
     $ext = $this->getOptionsValue('extension');
     $extend = $this->getOptionsValue('extend');
     $indent = str_repeat(' ', (int) $this->getOptionsValue('indent-size'));
     $class = $name . 'Controller';
     $file = $name . 'Controller' . $ext;
     $content = "<?php" . PHP_EOL . PHP_EOL . "class {$class} extends {$extend}" . PHP_EOL . '{' . PHP_EOL . $indent . 'public function main()' . PHP_EOL . $indent . '{' . PHP_EOL . $indent . '}' . PHP_EOL . '}';
     $this->globalChecks($file, $content, $name);
     if (!$this->getOptionsValue('not-enable')) {
         $list = YamlFactory::factory()->load('config/apps.yaml');
         if (!in_array($name, $list)) {
             $list[] = $name;
             YamlFactory::factory()->putInFile('config/apps.yaml', $list);
         }
     }
 }
Пример #4
0
 private function getTasksDirs()
 {
     return YamlFactory::Factory()->load('config/autoload_tasks.yaml');
 }
Пример #5
0
 public static function getExtFromMimeType($file)
 {
     $list = YamlFactory::factory()->load('config/mimeTypes.yaml');
     $mime = self::getMimeType($file);
     if (isset($list[$mime])) {
         return $list[$mime];
     }
     $info = pathinfo($file);
     return $info['extension'];
 }
Пример #6
0
 private function getDoctrineConfig()
 {
     return YamlFactory::factory()->load('config/doctrine.yaml');
 }
Пример #7
0
 private static function getLibsInfo()
 {
     return YamlFactory::Factory()->load('config/autoload.yaml');
 }