public static function buildFromReflection(\ReflectionClass $class)
    {
        $classDefinition = new self($class->getNamespaceName(), $class->getName(), $class->getShortName());

        $methods = $class->getMethods();
        if (\count($methods) > 0) {
            foreach ($methods as $method) {
                $parameters = [];

                foreach ($method->getParameters() as $row) {
                    $params = [
                        'type' => 'parameter',
                        'name' => $row->getName(),
                        'const' => 0,
                        'data-type' => 'variable',
                        'mandatory' => !$row->isOptional(),
                    ];
                    if (!$params['mandatory']) {
                        try {
                            $params['default'] = $row->getDefaultValue();
                        } catch (\ReflectionException $e) {
                            // TODO: dummy default value
                            $params['default'] = true;
                        }
                    }
                    $parameters[] = $params;
                }

                $classMethod = new ClassMethod(
                    $classDefinition,
                    [],
                    $method->getName(),
                    new ClassMethodParameters($parameters)
                );
                $classMethod->setIsStatic($method->isStatic());
                $classMethod->setIsBundled(true);
                $classDefinition->addMethod($classMethod);
            }
        }

        $constants = $class->getConstants();
        if (\count($constants) > 0) {
            foreach ($constants as $constantName => $constantValue) {
                $type = self::_convertPhpConstantType(\gettype($constantValue));
                $classConstant = new ClassConstant($constantName, ['value' => $constantValue, 'type' => $type], null);
                $classDefinition->addConstant($classConstant);
            }
        }

        $properties = $class->getProperties();
        if (\count($properties) > 0) {
            foreach ($properties as $property) {
                $visibility = [];

                if ($property->isPublic()) {
                    $visibility[] = 'public';
                }

                if ($property->isPrivate()) {
                    $visibility[] = 'private';
                }

                if ($property->isProtected()) {
                    $visibility[] = 'protected';
                }

                if ($property->isStatic()) {
                    $visibility[] = 'static';
                }

                $classProperty = new ClassProperty(
                    $classDefinition,
                    $visibility,
                    $property->getName(),
                    null,
                    null,
                    null
                );
                $classDefinition->addProperty($classProperty);
            }
        }

        $classDefinition->setIsBundled(true);

        return $classDefinition;
    }