Example #1
0
 /**
  * Determine and validate the object class name from its type
  *
  * @param Type $type Object type
  * @return string Object class name
  * @throws InvalidArgumentException If the object type is invalid
  */
 protected static function objectClassFromType(Type $type)
 {
     // If the object type is invalid
     $objectType = $type->getType();
     $objectClass = 'Apparat\\Object\\Application\\Model\\Object\\' . ucfirst($objectType);
     if (!TypeService::isEnabled($objectType) || !class_exists($objectClass)) {
         throw new InvalidArgumentException(sprintf('Invalid object type "%s"', $objectType), InvalidArgumentException::INVALID_OBJECT_TYPE);
     }
     return $objectClass;
 }
Example #2
0
 /**
  * Return all supported object types
  *
  * @return array Supported object types
  */
 public static function getSupportedTypes()
 {
     return TypeService::getSupportedTypes();
 }