public function transform(ProjectDescriptor $project, Transformation $transformation): void
    {
        $template_path = $this->getTemplatePath($transformation);

        $finder = new Pathfinder();
        $nodes = $finder->find($project, $transformation->getQuery());

        foreach ($nodes as $node) {
            if (!$node) {
                continue;
            }

            $destination = $this->getDestinationPath($node, $transformation);
            if ($destination === false) {
                continue;
            }

            $environment = $this->initializeEnvironment($project, $transformation, $destination);
            $environment->addGlobal('node', $node);

            $html = $environment->render(substr($transformation->getSource(), strlen($template_path)));
            file_put_contents($destination, $html);
        }
    }
public function transform(ProjectDescriptor $project, Transformation $transformation): void
    {
        $template_path = $this->getTemplatePath($transformation);

        $finder = new Pathfinder();
        $nodes = $finder->find($project, $transformation->getQuery());

        foreach ($nodes as $node) {
            if (!$node) {
                continue;
            }

            $destination = $this->getDestinationPath($node, $transformation);
            if ($destination === false) {
                continue;
            }

            $environment = $this->initializeEnvironment($project, $transformation, $destination);
            $environment->addGlobal('node', $node);

            $html = $environment->render(substr($transformation->getSource(), strlen($template_path)));
            file_put_contents($destination, $html);
        }
    }
public function transform ( ProjectDescriptor $ project , Transformation $ transformation ) : void { $ template_path = $ this -> getTemplatePath ( $ transformation ) ; $ finder = new Pathfinder ( ) ; $ nodes = $ finder -> find ( $ project , $ transformation -> getQuery ( ) ) ; foreach ( $ nodes as $ node ) { if ( ! $ node ) { continue ; } $ destination = $ this -> getDestinationPath ( $ node , $ transformation ) ; if ( $ destination === false ) { continue ; } $ environment = $ this -> initializeEnvironment ( $ project , $ transformation , $ destination ) ; $ environment -> addGlobal ( 'node' , $ node ) ; $ html = $ environment -> render ( substr ( $ transformation -> getSource ( ) , strlen ( $ template_path ) ) ) ; file_put_contents ( $ destination , $ html ) ; } }
This method combines the ProjectDescriptor and the given target template
and creates a static html page at the artifact location.

@param ProjectDescriptor $project Document containing the structure.
@param Transformation $transformation Transformation to execute.
This method combines the ProjectDescriptor and the given target template and creates a static html page at the artifact location .