private function generateStubs($primitive, $layer, $qcn): array
    {
        $generated_stubs = [];
        
        //
        // 1. SRC stubs
        //
        foreach ($primitive->getSrcStubs() as $filename => $stub) {
            
            $filename = $this->replacePlaceholdersInText($filename);
            if (!preg_match("#\\.php$#", $filename)) {
                $filename .= ".php";
            }
            
            $target_path = $layer->getSrcDir()
                           . DIRECTORY_SEPARATOR . $qcn->toPSR4Path()
                           . DIRECTORY_SEPARATOR . $filename;
            
            $generated_stubs[$target_path] = $stub;
            
        }
        
        
        //
        // 2. TEST stubs
        //
        foreach ($primitive->getTestStubs() as $filename => $stub) {
            
            $filename = $this->replacePlaceholdersInText($filename);
            if (!preg_match("#\\.php$#", $filename)) {
                $filename .= ".php";
            }
            
            $target_path = $layer->getTestsDir()
                           . DIRECTORY_SEPARATOR . $qcn->toPSR4Path()
                           . DIRECTORY_SEPARATOR . $filename;
            
            $generated_stubs[$target_path] = $stub;
        }
        
        return $generated_stubs;
    }
private function generateStubs($primitive, $layer, $qcn): array
    {
        $generated_stubs = [];
        
        //
        // 1. SRC stubs
        //
        foreach ($primitive->getSrcStubs() as $filename => $stub) {
            
            $filename = $this->replacePlaceholdersInText($filename);
            if (!preg_match("#\\.php$#", $filename)) {
                $filename .= ".php";
            }
            
            $target_path = $layer->getSrcDir()
                           . DIRECTORY_SEPARATOR . $qcn->toPSR4Path()
                           . DIRECTORY_SEPARATOR . $filename;
            
            $generated_stubs[$target_path] = $stub;
            
        }
        
        
        //
        // 2. TEST stubs
        //
        foreach ($primitive->getTestStubs() as $filename => $stub) {
            
            $filename = $this->replacePlaceholdersInText($filename);
            if (!preg_match("#\\.php$#", $filename)) {
                $filename .= ".php";
            }
            
            $target_path = $layer->getTestsDir()
                           . DIRECTORY_SEPARATOR . $qcn->toPSR4Path()
                           . DIRECTORY_SEPARATOR . $filename;
            
            $generated_stubs[$target_path] = $stub;
        }
        
        return $generated_stubs;
    }
private function generateStubs ( $ primitive , $ layer , $ qcn ) : array { $ generated_stubs = [ ] ; // // 1. SRC stubs // foreach ( $ primitive -> getSrcStubs ( ) as $ filename => $ stub ) { $ filename = $ this -> replacePlaceholdersInText ( $ filename ) ; if ( ! preg_match ( "#\\.php$#" , $ filename ) ) { $ filename .= ".php" ; } $ target_path = $ layer -> getSrcDir ( ) . DIRECTORY_SEPARATOR . $ qcn -> toPSR4Path ( ) . DIRECTORY_SEPARATOR . $ filename ; $ generated_stubs [ $ target_path ] = $ stub ; } // // 2. TEST stubs // foreach ( $ primitive -> getTestStubs ( ) as $ filename => $ stub ) { $ filename = $ this -> replacePlaceholdersInText ( $ filename ) ; if ( ! preg_match ( "#\\.php$#" , $ filename ) ) { $ filename .= ".php" ; } $ target_path = $ layer -> getTestsDir ( ) . DIRECTORY_SEPARATOR . $ qcn -> toPSR4Path ( ) . DIRECTORY_SEPARATOR . $ filename ; $ generated_stubs [ $ target_path ] = $ stub ; } return $ generated_stubs ; }
generateStubs for given primitive in given layer


@param Primitive $primitive
@param Layer     $layer
@param FQCN      $qcn

@return array [final_path => stub_file]
generateStubs for given primitive in given layer