public function createMetadata($class, $name, $path, $scope = 'module') : ClassMetadata
    {
        $metadata = new ClassMetadata();
        $class = ltrim($class, '\\');
        $name = strtolower(ltrim($name, '\\'));
        $metadata->className = $class;
        $metadata->name = str_replace(['\\', '/'], '_', $name ?? $class);
        $metadata->scopes[] = Builder::SCOPE_SERVICES;
        $metadata->scopes[] = $scope;

        // TODO: Now we need to remove and change constructors
        $metadata->methodsMetadata['__construct'] = new MethodMetadata($metadata);

        // Iterate constructor arguments to preserve arguments order and inject dependencies
        foreach ((new \ReflectionMethod($class, '__construct'))->getParameters() as $parameter) {
            if ($parameter->getName() === 'path') {
                $metadata->methodsMetadata['__construct']->dependencies['path'] = $path;
            } elseif ($parameter->getName() === 'resources') {
                $metadata->methodsMetadata['__construct']->dependencies['resources'] = ResourceMap::class;
            } elseif ($parameter->getName() === 'system') {
                $metadata->methodsMetadata['__construct']->dependencies['system'] = Core::class;
            } elseif (!$parameter->isOptional()) {
                $metadata->methodsMetadata['__construct']->dependencies[$parameter->getName()] = '';
            }
        }
        return $metadata;
    }
public function createMetadata($class, $name, $path, $scope = 'module') : ClassMetadata
    {
        $metadata = new ClassMetadata();
        $class = ltrim($class, '\\');
        $name = strtolower(ltrim($name, '\\'));
        $metadata->className = $class;
        $metadata->name = str_replace(['\\', '/'], '_', $name ?? $class);
        $metadata->scopes[] = Builder::SCOPE_SERVICES;
        $metadata->scopes[] = $scope;

        // TODO: Now we need to remove and change constructors
        $metadata->methodsMetadata['__construct'] = new MethodMetadata($metadata);

        // Iterate constructor arguments to preserve arguments order and inject dependencies
        foreach ((new \ReflectionMethod($class, '__construct'))->getParameters() as $parameter) {
            if ($parameter->getName() === 'path') {
                $metadata->methodsMetadata['__construct']->dependencies['path'] = $path;
            } elseif ($parameter->getName() === 'resources') {
                $metadata->methodsMetadata['__construct']->dependencies['resources'] = ResourceMap::class;
            } elseif ($parameter->getName() === 'system') {
                $metadata->methodsMetadata['__construct']->dependencies['system'] = Core::class;
            } elseif (!$parameter->isOptional()) {
                $metadata->methodsMetadata['__construct']->dependencies[$parameter->getName()] = '';
            }
        }
        return $metadata;
    }
public function createMetadata ( $ class , $ name , $ path , $ scope = 'module' ) : ClassMetadata { $ metadata = new ClassMetadata ( ) ; $ class = ltrim ( $ class , '\\' ) ; $ name = strtolower ( ltrim ( $ name , '\\' ) ) ; $ metadata -> className = $ class ; $ metadata -> name = str_replace ( [ '\\' , '/' ] , '_' , $ name ?? $ class ) ; $ metadata -> scopes [ ] = Builder :: SCOPE_SERVICES ; $ metadata -> scopes [ ] = $ scope ; // TODO: Now we need to remove and change constructors $ metadata -> methodsMetadata [ '__construct' ] = new MethodMetadata ( $ metadata ) ; // Iterate constructor arguments to preserve arguments order and inject dependencies foreach ( ( new \ ReflectionMethod ( $ class , '__construct' ) ) -> getParameters ( ) as $ parameter ) { if ( $ parameter -> getName ( ) === 'path' ) { $ metadata -> methodsMetadata [ '__construct' ] -> dependencies [ 'path' ] = $ path ; } elseif ( $ parameter -> getName ( ) === 'resources' ) { $ metadata -> methodsMetadata [ '__construct' ] -> dependencies [ 'resources' ] = ResourceMap :: class ; } elseif ( $ parameter -> getName ( ) === 'system' ) { $ metadata -> methodsMetadata [ '__construct' ] -> dependencies [ 'system' ] = Core :: class ; } elseif ( ! $ parameter -> isOptional ( ) ) { $ metadata -> methodsMetadata [ '__construct' ] -> dependencies [ $ parameter -> getName ( ) ] = '' ; } } return $ metadata ; }
Create metadata for module

@param $class
@param $name
@param $path
@param string $scope
@return ClassMetadata
Create metadata for module