Exemplo n.º 1
0
 /**
  * Renders the info of a single method.
  *
  * @return string
  *   The generated markup.
  */
 public function callMe()
 {
     $data = $this->parameters['data'];
     $output = '';
     foreach ($data as $key => $string) {
         $model = new Model($this->storage);
         $model->setData($string)->setName($key)->setType('reflection')->setConnector2('=');
         if ($key !== 'comments' && $key !== 'declared in' && $key !== 'source') {
             $model->setNormal($string);
         } else {
             $model->setNormal('. . .');
             $model->hasExtras();
         }
         $output .= $this->storage->render->renderSingleChild($model);
     }
     return $output;
 }
Exemplo n.º 2
0
 /**
  * Render a dump for a string value.
  *
  * @param Model $model
  *   The data we are analysing.
  *
  * @return string
  *   The rendered markup.
  */
 public function analyseString(Model $model)
 {
     $json = array();
     $json['type'] = 'string';
     $data = $model->getData();
     // Extra ?
     if (strlen($data) > 50) {
         $cut = substr($this->storage->encodeString($data), 0, 50) . '. . .';
         $model->hasExtras();
     } else {
         $cut = $this->storage->encodeString($data);
     }
     $json['encoding'] = @mb_detect_encoding($data);
     // We need to take care for mixed encodings here.
     $json['length'] = (string) ($strlen = @mb_strlen($data, $json['encoding']));
     if ($strlen === false) {
         // Looks like we have a mixed encoded string.
         $json['length'] = '~ ' . strlen($data);
         $strlen = ' broken encoding ' . $json['length'];
         $json['encoding'] = 'broken';
     }
     $data = $this->storage->encodeString($data);
     $model->setData($data)->setNormal($cut)->setType($model->getAdditional() . 'string' . ' ' . $strlen)->setJson($json);
     // Check if this is a possible callback.
     // We are not going to analyse this further, because modern systems
     // do not use these anymore.
     if (is_callable($data)) {
         $model->setIsCallback(true);
     }
     return $this->storage->render->renderSingleChild($model);
 }