src/Dumper/SymfonyDumper.php
public function dump(SymfonyController $controller, $destination = '.')
    {
        $template = $this->twig->loadTemplate('controller.php.twig');

        if (!$template) {
            throw new \Exception('Unable to find template');
        }

        $output = $template->render(array('controller' => $controller));

        if (!$this->filesystem->exists($destination)) {
            throw new \InvalidArgumentException(sprintf('Folder %s does not exist', $destination));
        }

        $filepath = $this->getFilepath($controller, $destination);

        if ($this->filesystem->exists($filepath)) {

            $old = $filepath . '.old';
            $i = 1;
            while ($this->filesystem->exists($old)) {
                $i++;
                $old = $filepath . '.old~' .$i;
            }

            $this->filesystem->copy($filepath, $old);
        }

        $this->filesystem->dumpFile($filepath, $output);

        return $filepath;
    }
public function dump(SymfonyController $controller, $destination = '.')
    {
        $template = $this->twig->loadTemplate('controller.php.twig');

        if (!$template) {
            throw new \Exception('Unable to find template');
        }

        $output = $template->render(array('controller' => $controller));

        if (!$this->filesystem->exists($destination)) {
            throw new \InvalidArgumentException(sprintf('Folder %s does not exist', $destination));
        }

        $filepath = $this->getFilepath($controller, $destination);

        if ($this->filesystem->exists($filepath)) {

            $old = $filepath . '.old';
            $i = 1;
            while ($this->filesystem->exists($old)) {
                $i++;
                $old = $filepath . '.old~' .$i;
            }

            $this->filesystem->copy($filepath, $old);
        }

        $this->filesystem->dumpFile($filepath, $output);

        return $filepath;
    }
public function dump ( SymfonyController $ controller , $ destination = '.' ) { $ template = $ this -> twig -> loadTemplate ( 'controller.php.twig' ) ; if ( ! $ template ) { throw new \ Exception ( 'Unable to find template' ) ; } $ output = $ template -> render ( array ( 'controller' => $ controller ) ) ; if ( ! $ this -> filesystem -> exists ( $ destination ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Folder %s does not exist' , $ destination ) ) ; } $ filepath = $ this -> getFilepath ( $ controller , $ destination ) ; if ( $ this -> filesystem -> exists ( $ filepath ) ) { $ old = $ filepath . '.old' ; $ i = 1 ; while ( $ this -> filesystem -> exists ( $ old ) ) { $ i ++ ; $ old = $ filepath . '.old~' . $ i ; } $ this -> filesystem -> copy ( $ filepath , $ old ) ; } $ this -> filesystem -> dumpFile ( $ filepath , $ output ) ; return $ filepath ; }
{@inheritDoc}
{