private function register($type, $actions, Generator $generator)
    {
        $classes = [
            'Query' =>[
                'namespace' => 'GraphQL\\Query',
                'template' => 'Query.tpl.php',
            ],
            'Mutation' =>[
                'namespace' => 'GraphQL\\Mutation',
                'template' => 'Mutation.tpl.php',
            ],
        ];
    
        $class = $classes[$type];
        $classNameDetails = $generator->createClassNameDetails(
            $type.'Type',
            $class['namespace']
        );
    
        $classFields = [];
        $fileName = $this->fileManager->getRelativePathForFutureClass($classNameDetails->getFullName());
        $classObjectFullName = $classNameDetails->getFullName();
        if(is_file($fileName)) {
            $classObject = $this->{lcfirst($type).'Type'};
            foreach ($classObject->getFields() as $classField) {
                $classFields[] = [
                    'fullName' => get_class($classField),
                    'shortName' => Str::getShortClassName(get_class($classField))
                ];
            }

            $tmpFileName = $fileName.'.bak';
            rename($fileName, $tmpFileName);
        }
        
        $generator->generateClass(
            $classNameDetails->getFullName(),
            dirname(dirname(__FILE__)) . '/Resources/skeleton/' . $class['template'],
            [
                'fields' => array_merge($classFields, [$actions])
            ]
            
        );
        
        $generator->writeChanges();
        
        if(is_file($fileName) && isset($tmpFileName)) {
            unlink($tmpFileName);
        }
    }
private function register($type, $actions, Generator $generator)
    {
        $classes = [
            'Query' =>[
                'namespace' => 'GraphQL\\Query',
                'template' => 'Query.tpl.php',
            ],
            'Mutation' =>[
                'namespace' => 'GraphQL\\Mutation',
                'template' => 'Mutation.tpl.php',
            ],
        ];
    
        $class = $classes[$type];
        $classNameDetails = $generator->createClassNameDetails(
            $type.'Type',
            $class['namespace']
        );
    
        $classFields = [];
        $fileName = $this->fileManager->getRelativePathForFutureClass($classNameDetails->getFullName());
        $classObjectFullName = $classNameDetails->getFullName();
        if(is_file($fileName)) {
            $classObject = $this->{lcfirst($type).'Type'};
            foreach ($classObject->getFields() as $classField) {
                $classFields[] = [
                    'fullName' => get_class($classField),
                    'shortName' => Str::getShortClassName(get_class($classField))
                ];
            }

            $tmpFileName = $fileName.'.bak';
            rename($fileName, $tmpFileName);
        }
        
        $generator->generateClass(
            $classNameDetails->getFullName(),
            dirname(dirname(__FILE__)) . '/Resources/skeleton/' . $class['template'],
            [
                'fields' => array_merge($classFields, [$actions])
            ]
            
        );
        
        $generator->writeChanges();
        
        if(is_file($fileName) && isset($tmpFileName)) {
            unlink($tmpFileName);
        }
    }
private function register ( $ type , $ actions , Generator $ generator ) { $ classes = [ 'Query' => [ 'namespace' => 'GraphQL\\Query' , 'template' => 'Query.tpl.php' , ] , 'Mutation' => [ 'namespace' => 'GraphQL\\Mutation' , 'template' => 'Mutation.tpl.php' , ] , ] ; $ class = $ classes [ $ type ] ; $ classNameDetails = $ generator -> createClassNameDetails ( $ type . 'Type' , $ class [ 'namespace' ] ) ; $ classFields = [ ] ; $ fileName = $ this -> fileManager -> getRelativePathForFutureClass ( $ classNameDetails -> getFullName ( ) ) ; $ classObjectFullName = $ classNameDetails -> getFullName ( ) ; if ( is_file ( $ fileName ) ) { $ classObject = $ this -> { lcfirst ( $ type ) . 'Type' } ; foreach ( $ classObject -> getFields ( ) as $ classField ) { $ classFields [ ] = [ 'fullName' => get_class ( $ classField ) , 'shortName' => Str :: getShortClassName ( get_class ( $ classField ) ) ] ; } $ tmpFileName = $ fileName . '.bak' ; rename ( $ fileName , $ tmpFileName ) ; } $ generator -> generateClass ( $ classNameDetails -> getFullName ( ) , dirname ( dirname ( __FILE__ ) ) . '/Resources/skeleton/' . $ class [ 'template' ] , [ 'fields' => array_merge ( $ classFields , [ $ actions ] ) ] ) ; $ generator -> writeChanges ( ) ; if ( is_file ( $ fileName ) && isset ( $ tmpFileName ) ) { unlink ( $ tmpFileName ) ; } }
Register class in main query

@param $type
@param $actions
@param Generator $generator
@throws \Exception
Register class in main query