Example #1
0
 public function setFramework(Framework $framework)
 {
     $this->_framework = $framework;
     $this->_router = $framework->getRouter();
     $framework->kit('greut', new Kit\Greut());
     return $this;
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $fwk = new Framework();
     $this->_router = $fwk->getRouter();
     $this->_view = $fwk->getView();
     $this->_router->any('/(?<_call>.[^/]+)/(?<_able>.*)', array('as' => 'c', 'to' => 'main#index'));
     $this->_router->any('/', array('as' => 'm', 'to' => 'main#index'));
     $kit = new Kit($this->_router, $fwk->getDispatcher(), $this->_view, $fwk);
     $this->_kit = $kit->greut;
 }
Example #3
0
 /**
  * The entry method.
  *
  * @access  public
  * @return  int
  */
 public function main()
 {
     $reset = false;
     $generate = false;
     $cache = 'hoa://Application/Cache/Route.php';
     $route = 'hoa://Application/Config/Route.php';
     while (false !== ($c = $this->getOption($v))) {
         switch ($c) {
             case 'g':
                 $generate = true;
             case 'r':
                 $reset = true;
                 break;
             case 'h':
             case '?':
                 return $this->usage();
                 break;
         }
     }
     if ($reset === true) {
         if (file_exists($cache)) {
             $result = unlink($cache);
             if ($result) {
                 echo \Hoa\Console\Chrome\Text::colorize('[OK] Cache flush', 'foreground(green)') . "\n";
             } else {
                 echo \Hoa\Console\Chrome\Text::colorize('[!!] Cache flush', 'foreground(white) background(red)') . "\n";
             }
         } else {
             echo \Hoa\Console\Chrome\Text::colorize('No cache found', 'foreground(green)') . "\n";
         }
     }
     if ($generate === true) {
         $core = Core::getInstance();
         $parameters = $core->getParameters();
         $cwd = $parameters->getKeyword('cwd');
         $parameters->setKeyword('cwd', $cwd . '/Public');
         $framework = new Framework();
         $router = $framework->getRouter();
         $dir = dirname($cache);
         $router->saveCache($cache);
         echo 'Save your router result in' . \Hoa\Console\Chrome\Text::colorize(resolve($cache), 'foreground(green)') . "\n";
     }
     if ($reset === false && $generate === false) {
         return $this->usage();
     }
 }
Example #4
0
 /**
  * The entry method.
  *
  * @access  public
  * @return  int
  */
 public function main()
 {
     $command = null;
     while (false !== ($c = $this->getOption($v))) {
         switch ($c) {
             case 'h':
             case '?':
                 return $this->usage();
                 break;
         }
     }
     $cache = 'hoa://Application/Cache/Route.php';
     $route = 'hoa://Application/Config/Route.php';
     $core = Core::getInstance();
     $parameters = $core->getParameters();
     $cwd = $parameters->getKeyword('cwd');
     $parameters->setKeyword('cwd', $cwd . '/Public');
     $framework = new Framework();
     $router = $framework->getRouter();
     $router->construct();
     echo '# Router rules in ' . resolve($route) . "\n\n";
     echo Text::columnize($router->dump()) . "\n\n";
     return;
 }
Example #5
0
 public function setFramework(Framework $framework)
 {
     $this->_framework = $framework;
     $framework->kit('xyl', new Kit\Xyl());
     return $this;
 }
Example #6
0
<?php

use Sohoa\Framework\Framework;
require_once __DIR__ . '/../vendor/autoload.php';
$framework = new Framework();
$framework->run();