public function renderMaster($component)
 {
     static $benchmarkEnabled;
     if (!isset($benchmarkEnabled)) {
         $benchmarkEnabled = Kwf_Benchmark::isEnabled();
     }
     $content = false;
     if ($this->_enableCache) {
         $content = Kwf_Component_Cache::getInstance()->load($component->componentId, $this->_getRendererName(), 'fullPage');
         $this->_minLifetime = null;
     }
     Kwf_Benchmark::checkpoint('load fullPage cache');
     $statType = null;
     if (!$content) {
         if ($benchmarkEnabled) {
             $startTime = microtime(true);
         }
         if (!$this->_enableCache || ($content = Kwf_Component_Cache::getInstance()->load($component, $this->_getRendererName(), 'page')) === null) {
             $masterHelper = new Kwf_Component_View_Helper_Master();
             $masterHelper->setRenderer($this);
             $content = $masterHelper->master($component);
             if ($this->_enableCache) {
                 Kwf_Component_Cache::getInstance()->save($component, $content, $this->_getRendererName(), 'page', '', '', null);
                 $statType = 'miss';
             } else {
                 $statType = 'noviewcache';
             }
         } else {
             $statType = 'hit';
         }
         if ($statType) {
             Kwf_Benchmark::count("rendered {$statType}", $component->componentId . ': page');
         }
         Kwf_Benchmark::countLog('render-' . $statType);
         if ($benchmarkEnabled) {
             Kwf_Benchmark::subCheckpoint($component->componentId . ' page', microtime(true) - $startTime);
         }
         Kwf_Benchmark::checkpoint('render page');
         $pass1Cacheable = true;
         $content = $this->_renderPass1($content, $pass1Cacheable);
         Kwf_Benchmark::checkpoint('render pass 1');
         if ($this->_enableCache && $pass1Cacheable) {
             Kwf_Component_Cache::getInstance()->save($component, $content, $this->_getRendererName(), 'fullPage', '', '', $this->_minLifetime);
         }
         Kwf_Benchmark::count("rendered miss", $component->componentId . ': fullPage');
         Kwf_Benchmark::countLog('fullpage-miss');
     } else {
         Kwf_Benchmark::count("rendered hit", $component->componentId . ': fullPage');
         Kwf_Benchmark::countLog('fullpage-hit');
     }
     $content = $this->_renderPass2($content);
     Kwf_Benchmark::checkpoint('render pass 2');
     Kwf_Component_Cache::getInstance()->writeBuffer();
     return $content;
 }
 public function getContentSpans()
 {
     if ($this->_hasSetting('contentSpans')) {
         return $this->_getSetting('contentSpans');
     }
     if ($this->getData()->isPage) {
         $componentWithMaster = Kwf_Component_View_Helper_Master::getComponentsWithMasterTemplate($this->getData());
         $last = array_pop($componentWithMaster);
         if ($last && $last['type'] == 'master') {
             $p = $last['data'];
         } else {
             $p = Kwf_Component_Data_Root::getInstance();
             // for tests
         }
         return $p->getComponent()->_getMasterChildContentSpans($this->getData());
     } else {
         if (!$this->getData()->parent) {
             throw new Kwf_Exception("Can't detect contentSpans, use contentSpans setting for '" . $this->getData()->componentClass . "'");
         }
         return $this->getData()->parent->getComponent()->_getChildContentSpans($this->getData());
     }
 }
 public function getContentWidth(Kwf_Component_Data $data)
 {
     if ($this->_hasSetting('contentWidth')) {
         return $this->_getSetting('contentWidth');
     }
     if ($data->isPage || isset($data->box)) {
         $componentWithMaster = Kwf_Component_View_Helper_Master::getComponentsWithMasterTemplate($data);
         $last = array_pop($componentWithMaster);
         if ($last && $last['type'] == 'master') {
             $p = $last['data'];
         } else {
             $p = Kwf_Component_Data_Root::getInstance();
             // for tests
         }
         return Kwf_Component_MasterLayout_Abstract::getInstance($p->componentClass)->getContentWidth($data);
     } else {
         if (!$data->parent) {
             throw new Kwf_Exception("Can't detect contentWidth, use contentWidth setting for '" . $data->componentClass . "'");
         }
         return self::getInstance($data->parent->componentClass)->getChildContentWidth($data->parent, $data);
     }
 }