/** * @return MetaClassProperty **/ private function makeProperty($name, $type, MetaClass $class, $size) { Assert::isFalse(strpos($name, '_'), 'naming convention violation spotted'); if (!$name || !$type) { throw new WrongArgumentException('strange name or type given: "' . $name . '" - "' . $type . '"'); } if (is_readable(ONPHP_META_TYPES . $type . 'Type' . EXT_CLASS)) { $typeClass = $type . 'Type'; } else { $typeClass = 'ObjectType'; } $property = new MetaClassProperty($name, new $typeClass($type), $class); if ($size) { $property->setSize($size); } else { Assert::isTrue(!$property->getType() instanceof FixedLengthStringType && !$property->getType() instanceof NumericType && !$property->getType() instanceof HttpUrlType, 'size is required for "' . $property->getName() . '"'); } return $property; }