public function getServiceSpecification($entity)
    {
        if (!is_object($entity)) {
            if ((is_string($entity) && (!class_exists($entity))) // non-existent class
                    || (!is_string($entity)) // not an object or string
            ) {
                throw new Exception\InvalidArgumentException(sprintf(
                        '%s expects an object or valid class name; received "%s"',
                        __METHOD__,
                        var_export($entity, 1)
                ));
            }
        }
    
        $serviceSpec = new ArrayObject();
        $serviceSpec['operations'] = new ArrayObject();
    
        $reflection  = new ClassReflection($entity);
        $this->parseClassSpecifications($reflection, $serviceSpec);
        
        return $serviceSpec;
    }