/**
  * {@inheritDoc}
  */
 public function generate($name)
 {
     if (!$this->isAbleToGenerate($name)) {
         throw new UnableToGenerateTypeOutlineException('Class type "' . $name . '" does not exist');
     }
     if (isset($this->loadedClasses[$name])) {
         return $this->loadedClasses[$name];
     }
     $classMeta = $this->classesConfig[$name];
     $parentClass = null;
     if (isset($classMeta['extend'])) {
         $parentClass = $this->schemaOutline->getTypeOutline($classMeta['extend']);
         if (!$parentClass instanceof ClassOutline) {
             $msg = 'Parent class "' . $classMeta['extend'] . '" must be a class outline instance';
             throw new UnableToGenerateTypeOutlineException($msg);
         }
     }
     $classOutline = new ClassOutline($name, array(), $parentClass);
     $this->loadedClasses[$name] = $classOutline;
     if (isset($classMeta['properties'])) {
         foreach ($classMeta['properties'] as $propertyName => $property) {
             $propertyOutline = new PropertyOutline($propertyName, $this->schemaOutline->getTypeOutline($property['type']));
             if (isset($property['default'])) {
                 $propertyOutline->setDefaultValue($property['default']);
             }
             if (isset($property['nullable'])) {
                 $propertyOutline->setIsNullable($property['nullable']);
             }
             $classOutline->addProperty($propertyOutline);
         }
     }
     unset($this->loadedClasses[$name]);
     return $classOutline;
 }
 public function testCannotBeNullableWhenHasDefaultValue()
 {
     $msg = 'Cannot set property to be nullable since it has default value';
     $this->setExpectedException('\\BadMethodCallException', $msg);
     $this->object->setDefaultValue('some')->setIsNullable(true);
 }