コード例 #1
0
ファイル: Ant.php プロジェクト: gitter-badger/ant-1
 public function setup($s)
 {
     if (false == isset($s['view'])) {
         throw new Exception('View path is not defined');
     }
     if (false == @is_readable($s['view'])) {
         throw new Exception(sprintf('View path %s is not available', $s['view']));
     }
     if (false == isset($s['cache'])) {
         throw new Exception('Cache path is not defined');
     }
     if (false == @is_readable($s['cache']) or false == @is_writeable($s['cache'])) {
         throw new Exception(sprintf('Cache path %s is not available', $s['cache']));
     }
     if (false == isset($s['extension'])) {
         $s['extension'] = 'php';
     }
     if (false == isset($s['debug'])) {
         $s['debug'] = false;
     }
     if (false == isset($s['freeze'])) {
         $s['freeze'] = false;
     }
     $s['cache'] = rtrim($s['cache'], ' 	\\/');
     $s['view'] = rtrim($s['view'], ' 	\\/');
     if (isset($s['logic'])) {
         $s['logic'] = rtrim($s['logic'], ' 	\\/');
     } else {
         $s['logic'] = '';
     }
     self::$settings = $s;
     self::$cache_obj = new Cache($s['cache']);
     self::$plugin = new Plugin();
     return $this;
 }
コード例 #2
0
ファイル: Ant.php プロジェクト: undercloud/ant
 /**
  * Setup engine
  *
  * @param array $settings settings
  *
  * @return Ant\Ant
  */
 public function setup(array $settings)
 {
     self::$settings = new Settings($settings);
     self::$cache = new Cache($settings['cache']);
     self::$plugin = new Plugin($this);
     Fn::apply($this);
     return $this;
 }