protected function formatDefinition($class, $definition)
    {
        if (empty($definition)) {
            return ['class' => $class];
        } elseif (is_callable($definition, false) || is_object($definition)) {
            return $definition;
        } elseif (is_string($definition)) {
        	if (strpos($definition, ':') !== false) {
        		return $definition;
        	}
        	
            return ['class' => $definition];
        } elseif (is_array($definition)) {
            if (!isset($definition['class'])) {
                if (strpos($class, '\\') !== false) {
                    $definition['class'] = $class;
                } elseif (isset($definition[0]) && is_string($definition[0]) && strpos($definition[0], '\\') !== false) {
                    $definition['class'] = $definition[0];
                    unset($definition[0]);
                } else {
                    throw new InvalidConfigException("A class definition requires a \"class\" member.");
                }
            }
            return $definition;
        } else {
            throw new InvalidConfigException("Unsupported definition type for \"$class\": " . gettype($definition));
        }
    }
protected function formatDefinition($class, $definition)
    {
        if (empty($definition)) {
            return ['class' => $class];
        } elseif (is_callable($definition, false) || is_object($definition)) {
            return $definition;
        } elseif (is_string($definition)) {
        	if (strpos($definition, ':') !== false) {
        		return $definition;
        	}
        	
            return ['class' => $definition];
        } elseif (is_array($definition)) {
            if (!isset($definition['class'])) {
                if (strpos($class, '\\') !== false) {
                    $definition['class'] = $class;
                } elseif (isset($definition[0]) && is_string($definition[0]) && strpos($definition[0], '\\') !== false) {
                    $definition['class'] = $definition[0];
                    unset($definition[0]);
                } else {
                    throw new InvalidConfigException("A class definition requires a \"class\" member.");
                }
            }
            return $definition;
        } else {
            throw new InvalidConfigException("Unsupported definition type for \"$class\": " . gettype($definition));
        }
    }
protected function formatDefinition ( $ class , $ definition ) { if ( empty ( $ definition ) ) { return [ 'class' => $ class ] ; } elseif ( is_callable ( $ definition , false ) || is_object ( $ definition ) ) { return $ definition ; } elseif ( is_string ( $ definition ) ) { if ( strpos ( $ definition , ':' ) !== false ) { return $ definition ; } return [ 'class' => $ definition ] ; } elseif ( is_array ( $ definition ) ) { if ( ! isset ( $ definition [ 'class' ] ) ) { if ( strpos ( $ class , '\\' ) !== false ) { $ definition [ 'class' ] = $ class ; } elseif ( isset ( $ definition [ 0 ] ) && is_string ( $ definition [ 0 ] ) && strpos ( $ definition [ 0 ] , '\\' ) !== false ) { $ definition [ 'class' ] = $ definition [ 0 ] ; unset ( $ definition [ 0 ] ) ; } else { throw new InvalidConfigException ( "A class definition requires a \"class\" member." ) ; } } return $ definition ; } else { throw new InvalidConfigException ( "Unsupported definition type for \"$class\": " . gettype ( $ definition ) ) ; } }
format the class definition.

@param  string $class class name
@param  string|array|callable $definition the class definition
@return array the formated class definition
@throws InvalidConfigException if the definition is invalid.
format the class definition .