Esempio n. 1
0
 public function testClearAll()
 {
     Memory::set('x', 1);
     Memory::set('y', 1);
     Memory::clearAll();
     $this->assertEmpty(Memory::get('x'));
     $this->assertEmpty(Memory::get('y'));
     Memory::clearAll();
     $this->assertEmpty(Memory::get('x'));
     $this->assertEmpty(Memory::get('y'));
 }
Esempio n. 2
0
 public function renderContent($content, $file = '')
 {
     if (!empty($file)) {
         $template = Template::singleton();
         # Memory::get('template') eh setado na Factory
         if (Memory::get('template') == 'default') {
             foreach (Memory::get('templates', array()) as $name => $mustache) {
                 $content[$name] = $template->renderTemplate($mustache, $content);
             }
         }
         $template->showRenderTemplate($file, $content);
         if (Memory::get('debug', false)) {
             echo "<pre>";
             var_dump($content);
             echo "</pre>";
         }
     } else {
         //TODO o filename do page não está setado...
         dump("[o arquivo de template não foi configurado para a página solicitada] : o filename do page não está setado");
         dump($content);
     }
 }
Esempio n. 3
0
 /**
  * Return/Create the Logger object
  * 
  * Levels:
  * $log->trace("Finest-grained informational events.");
  * $log->debug("Fine-grained informational events that are most useful to debug an application.");
  * $log->info("Informational messages that highlight the progress of the application at coarse-grained level.");
  * $log->warn("Potentially harmful situations which still allow the application to continue running.");
  * $log->error("Error events that might still allow the application to continue running.");
  * $log->fatal("Very severe error events that will presumably lead the application to abort.");
  * 
  * @return Logger
  */
 public static function log()
 {
     if (defined("TEST_OR_INSTALL")) {
         require_once PATH_LOCAL . '/../vendor/apache/log4php/src/main/php/Logger.php';
     } else {
         require_once PATH_LOCAL . '/vendor/apache/log4php/src/main/php/Logger.php';
     }
     if (Memory::get('debug', false)) {
         return Logger::getLogger('debug');
     } else {
         return Logger::getLogger('main');
     }
 }