Ejemplo n.º 1
0
 /**
  * Analyses the type and then decides what to do with it
  *
  * @param Model $model
  *   The type we are analysing, for example 'private array'.
  *
  * @return string
  *   Possible values:
  *   - concatenation
  *   - method
  *   - property
  */
 protected function analyseType(Model $model)
 {
     $type = $model->getType();
     $multiline = $model->getMultiLineCodeGen();
     $concatenation = 'concatenation';
     $method = 'method';
     $property = 'property';
     $stop = 'stop';
     // Debug methods are always public.
     if ($type === 'debug method' || $this->counter === 0) {
         return $concatenation;
     }
     // Test for constants.
     if ($type === 'class internals' && $model->getName() === 'Constants') {
         // We must only take the stuff from the constant itself
         return $stop;
     }
     // Test for  multiline code generation.
     if (!empty($multiline)) {
         return $multiline;
     }
     // Test for protected or private.
     if (strpos($type, 'protected') === false && strpos($type, 'private') === false) {
         // Is not protected.
         return $concatenation;
     }
     // Test if we are inside the scope.
     if (self::isInScope($type)) {
         // We are inside the scope, this value, function or class is reachable.
         return $concatenation;
     }
     // We are still here? Must be a protected method or property.
     if (strpos($type, 'method') === false) {
         // This is not a method.
         return $property;
     } else {
         return $method;
     }
 }