Esempio n. 1
0
 /**
  * @param string $stringType
  *
  * @return string
  */
 public function filterNamespace($stringType)
 {
     $type = new ModelType($stringType);
     if (!$type->isObject()) {
         return $stringType;
     }
     $fullyQualifiedName = new FullyQualifiedName($stringType);
     return $fullyQualifiedName->getName();
 }
 /**
  * {@inheritDoc}
  */
 public function validate($model)
 {
     $type = new Type($model->getType());
     $defaultValue = $model->getDefaultValue();
     if (!$type->isObject() || null === $defaultValue || 'null' === $defaultValue) {
         return new NoneViolation();
     }
     return new SomeViolation(sprintf('Object Argument "%s" can only default to null', $model->getName()));
 }
Esempio n. 3
0
 /**
  * @param string $current
  * @param array  $collection
  *
  * @return string
  */
 public function align($current, $collection)
 {
     $elementLength = strlen($current);
     $longestElement = $elementLength;
     foreach ($collection as $element) {
         if ('Memio\\Model\\Phpdoc\\ParameterTag' === get_class($element)) {
             $type = $element->getType();
             $modelType = new ModelType($element->getType());
             if ($modelType->isObject()) {
                 $fullyQualifiedName = new FullyQualifiedName($type);
                 $type = $fullyQualifiedName->getName();
             }
             $longestElement = max($longestElement, strlen($type));
         }
     }
     return $current . str_repeat(' ', $longestElement - $elementLength);
 }
Esempio n. 4
0
 /**
  * @return string
  */
 public function getType()
 {
     return $this->type->getName();
 }