Example #1
0
 /**
  * Renders whole configuration.
  *
  * @return string
  *   The generated markup.
  */
 public function callMe()
 {
     $configOutput = '';
     // We need to "explode" our config array into the
     // sections again, for better readability.
     $sections = array();
     foreach ($this->storage->config->settings as $name => $setting) {
         $sections[$setting->getSection()][$name] = $setting;
     }
     foreach ($sections as $sectionName => $sectionData) {
         // Render a whole section.
         $model = new Model($this->storage);
         $model->setName($sectionName)->setType('Config')->setAdditional('. . .')->addParameter('data', $sectionData)->initCallback('Analyse\\ConfigSection');
         $configOutput .= $this->storage->render->renderExpandableChild($model);
     }
     // Render the dev-handle field.
     $editableModel = new Model($this->storage);
     $data = 'Local open function';
     $editableModel->setData($data)->setName($this->storage->config->getDevHandler())->setNormal('\\krexx::')->setType('Input')->setHelpid('localFunction');
     $configOutput .= $this->storage->render->renderSingleEditableChild($editableModel);
     // Render the reset-button which will delete the debug-cookie.
     $buttonModel = new Model($this->storage);
     $buttonModel->setName('resetbutton')->setNormal('Reset local settings')->setHelpid('resetbutton');
     $configOutput .= $this->storage->render->renderButton($buttonModel);
     return $configOutput;
 }
Example #2
0
 /**
  * Dump the possible result of all getter methods
  *
  * @param \ReflectionClass $ref
  *
  * @param object $data
  *   The object we are currently analysing.
  *
  * @return string
  *   The generated markup.
  */
 protected function getAllGetterData(\ReflectionClass $ref, $data)
 {
     // Get all public mehtods.
     $methodList = get_class_methods($data);
     if (!empty($methodList)) {
         // Filter them.
         foreach ($methodList as $key => $method) {
             if (strpos($method, 'get') !== 0) {
                 unset($methodList[$key]);
             } else {
                 // We only dump those that have no parameters.
                 $reflectionMethod = $ref->getMethod($method);
                 if (!empty($reflectionMethod->getParameters())) {
                     unset($methodList[$key]);
                 }
             }
         }
         if (!empty($methodList)) {
             // Got some getters right here.
             $model = new Model($this->storage);
             // We need to set al least one connector here to activate
             // code generation, even if it is a space.
             $model->setName('Getter')->setType('class internals')->setHelpid('getterHelpInfo')->addParameter('ref', $ref)->addParameter('methodList', $methodList)->addParameter('data', $data)->initCallback('Iterate\\ThroughGetter');
             return $this->storage->render->renderExpandableChild($model);
         }
     }
     // There are no getter methods in here.
     return '';
 }
Example #3
0
 /**
  * Analysis a backtrace.
  *
  * We need to format this one a little bit different than a
  * normal array.
  *
  * @param array $backtrace
  *   The backtrace.
  * @param int $offset
  *   For some reason, we have an offset of -1 for fatal error backtrace
  *   line number.
  *
  * @return string
  *   The rendered backtrace.
  */
 public function analysisBacktrace(array &$backtrace, $offset = 0)
 {
     $output = '';
     foreach ($backtrace as $step => $stepData) {
         $model = new Model($this->storage);
         $model->setName($step)->setType('Stack Frame')->addParameter('data', $stepData)->addParameter('offset', $offset)->initCallback('Analyse\\BacktraceStep');
         $output .= $this->storage->render->renderExpandableChild($model);
     }
     return $output;
 }
Example #4
0
 /**
  * Render a dump for method info.
  *
  * @param array $data
  *   The method analysis results in an array.
  * @param string $name
  *   The name of the object.
  *
  * @return string
  *   The generated markup.
  */
 protected function dumpMethodInfo(array $data, $name)
 {
     $paramList = '';
     $connector1 = '->';
     foreach ($data as $key => $string) {
         // Getting the parameter list.
         if (strpos($key, 'Parameter') === 0) {
             $paramList .= trim($string) . ', ';
         }
         if (strpos($data['declaration keywords'], 'static') !== false) {
             $connector1 = '::';
         }
     }
     $paramList = str_replace(array('<required> ', '<optional> '), '', $this->storage->encodeString($paramList));
     // Remove the ',' after the last char.
     $paramList = '<small>' . trim($paramList, ', ') . '</small>';
     $model = new Model($this->storage);
     $model->setName($name)->setType($data['declaration keywords'] . ' method')->setConnector1($connector1)->setConnector2('(' . $paramList . ')')->addParameter('data', $data)->initCallback('Iterate\\ThroughMethodAnalysis');
     return $this->storage->render->renderExpandableChild($model);
 }
Example #5
0
 /**
  * Simply renders the footer and output current settings.
  *
  * @param array $caller
  *   Where was kreXX initially invoked from.
  * @param bool $isExpanded
  *   Are we rendering an expanded footer?
  *   TRUE when we render the settings menu only.
  *
  * @return string
  *   The generated markup.
  */
 protected function outputFooter($caller, $isExpanded = false)
 {
     // Now we need to stitch together the content of the ini file
     // as well as it's path.
     if (!is_readable($this->storage->config->krexxdir . 'config/Krexx.ini')) {
         // Project settings are not accessible
         // tell the user, that we are using fallback settings.
         $path = 'Krexx.ini not found, using factory settings';
         // $config = array();
     } else {
         $path = 'Current configuration';
     }
     $model = new Model($this->storage);
     $model->setName($path)->setType($this->storage->config->krexxdir . 'config/Krexx.ini')->setHelpid('currentSettings')->initCallback('Iterate\\ThroughConfig');
     $configOutput = $this->storage->render->renderExpandableChild($model, $isExpanded);
     return $this->storage->render->renderFooter($caller, $configOutput, $isExpanded);
 }