/**
     * @see ContentModifierInterface::modify()
     */
    public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
    {
        $options = $this->resolver->resolve($data);
        // retrieve target location
        $targetRoutingFilepath = $this->resolveTargetFilePath($options['target'], $generatedFile->getPath());
        // build content
        $routing = sprintf('
%s:
    resource: "%s"
    %s', $inflector->translate($options['route']), $inflector->translate($options['resource']), is_null($options['prefix']) ? '' : sprintf("prefix: %s\n", $inflector->translate($options['prefix'])));
        $routingFile = new SplFileInfo($targetRoutingFilepath, '', '');
        $routingContent = $routingFile->getContents();
        // is routing not already registered ?
        if (strpos($routingContent, trim($routing)) !== false) {
            $this->logger->debug(sprintf('Routing file "%s" is already registered into "%s". Abording.', $generatedFile->getFilename(), $targetRoutingFilepath));
            return $generatedFile->getContents();
        }
        $this->filesystem->dumpFile($routingFile->getRealpath(), sprintf('%s%s', $routingContent, $routing));
        $this->logger->info(sprintf('file updated : %s', $routingFile->getRealpath()));
        return $generatedFile->getContents();
    }
 /**
  * @see ContentModifierInterface::modify()
  */
 public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
 {
     $options = $this->resolver->resolve($data);
     $fileContent = $generatedFile->getContents();
     // current file is a bundle ?
     $isInBundle = preg_match(sprintf('/namespace (.*%s.*Bundle);/', $inflector->translate('MajoraNamespace')), $fileContent, $inBundleMatches);
     $isABundle = preg_match(sprintf('/class (([\\w]*)%s[\\w]*Bundle) extends [\\w]*Bundle/', $inflector->translate('MajoraNamespace')), $fileContent, $isBundleMatches);
     if (!$isInBundle || !$isABundle) {
         $this->logger->notice(sprintf('Try to register "%s" file into Kernel which isnt a bundle. Abording.', $generatedFile->getFilename()));
         return $fileContent;
     }
     $bundleInclusion = sprintf('new %s\\%s(),', $inBundleMatches[1], $isBundleMatches[1]);
     $kernelFile = new SplFileInfo(sprintf('%s/%s', $this->kernelDir, $options['kernel_filename']), '', '');
     $kernelContent = $kernelFile->getContents();
     // is bundle not already registered ?
     if (strpos($kernelContent, $bundleInclusion) !== false) {
         $this->logger->debug(sprintf('Bundle "%s" is already registered. Abording.', $generatedFile->getFilename()));
         return $fileContent;
     }
     $this->filesystem->dumpFile($kernelFile->getPathname(), preg_replace('/(Bundle\\(\\)\\,)(\\n[\\s]+\\);)/', sprintf("\$1\n            %s\$2", $bundleInclusion), $kernelContent));
     $this->logger->info(sprintf('file updated : %s', $kernelFile->getPathname()));
     return $fileContent;
 }
 /**
  * @see ContentModifierInterface::modify()
  */
 public function modify(SplFileInfo $generatedFile, array $data, Inflector $inflector, SplFileInfo $templateFile)
 {
     $options = $this->resolver->resolve($data);
     // retrieve target location
     $targetServicesFilepath = $this->resolveTargetFilePath($options['target'], $generatedFile->getPath());
     // build content
     $import = sprintf('<import resource="%s" />', $inflector->translate($options['resource']));
     $servicesFile = new SplFileInfo($targetServicesFilepath, '', '');
     $servicesContent = $servicesFile->getContents();
     // are services not already registered ?
     if (strpos($servicesContent, $import) !== false) {
         $this->logger->debug(sprintf('Service file "%s" is already registered into "%s". Abording.', $generatedFile->getFilename(), $targetServicesFilepath));
         return $generatedFile->getContents();
     }
     $this->filesystem->dumpFile($servicesFile->getRealpath(), str_replace('    </imports>', sprintf("        %s\n    </imports>", $import), $servicesContent));
     $this->logger->info(sprintf('file updated : %s', $servicesFile->getRealpath()));
     return $generatedFile->getContents();
 }
 /**
  * generate targer file path from source path.
  *
  * @param SplFileInfo $fileinfo
  * @param string      $skeletonPath
  * @param string      $targetPath
  * @param Inflector   $inflector
  *
  * @return string
  */
 protected function generatePath(SplFileInfo $fileinfo, $skeletonPath, $targetPath, Inflector $inflector)
 {
     return $inflector->translate(sprintf('%s%s', $targetPath, str_replace($skeletonPath, '', $fileinfo->getRealPath())));
 }