<commit_before><?php

namespace Czogori\DamiBundle\Helper;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;

class PreparationMigrationDirectory
{
    private $baseDirectory;
    private $bundles;

    public function __construct($baseDirectory, $bundles)
    {
        $this->baseDirectory = $baseDirectory;
        $this->bundles = $bundles;
        $this->fileSystem = new Filesystem();
    }

    public function prepare()
    {
        $migrationDirectory = $this->getDirectory();
        $this->createDirectory($migrationDirectory);

        foreach ($this->bundles as $bundle) {
            $bundleMigrationDirectory = $bundle->getPath() . '/Resources/migrations';
            if (file_exists($bundleMigrationDirectory)) {
                $finder = new Finder();
                $finder->files('*.php')->in($bundleMigrationDirectory);
                foreach ($finder as $file) {
                   $this->fileSystem->copy($file->getRealpath(), $migrationDirectory . $file->getFilename(), true);
                }
            }
        }
    }

    private function createDirectory($migrationDirectory)
    {
        try {
            $this->fileSystem->mkdir($migrationDirectory);
        } catch (IOException $e) {
            echo 'Nie można utworzyć katalogu ' . $migrationDirectory;
        }
    }

    private function getDirectory()
    {
        return $this->baseDirectory . '/migrations/';<commit_msg>Added some comments<commit_after><?php

namespace Czogori\DamiBundle\Helper;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;

class PreparationMigrationDirectory
{
    private $baseDirectory;
    private $bundles;

    /**
     * Constructor
     * 
     * @param string                                                 $baseDirectory Base directory for migrations.
     * @param Symfony\Component\HttpKernel\Bundle\BundleInterface[]  $bundles       Array of BunleInterface instances.
     */
    public function __construct($baseDirectory, $bundles)
    {
        $this->baseDirectory = $baseDirectory;
        $this->bundles = $bundles;
        $this->fileSystem = new Filesystem();
    }

    /**
     * Prepare migration directory to use.
     * @return void
     */
    public function prepare()
    {
        $migrationDirectory = $this->getDirectory();
        try {
            $this->fileSystem->mkdir($migrationDirectory);
        } catch (IOException $e) {
            echo 'Nie można utworzyć katalogu ' . $migrationDirectory;
        }

        foreach ($this->bundles as $bundle) {
            $bundleMigrationDirectory = $bundle->getPath() . '/Resources/migrations';
            if (file_exists($bundleMigrationDirectory)) {
                $finder = new Finder();
                $finder->files('*.php')->in($bundleMigrationDirectory);
                foreach ($finder as $file) {
                   $this->fileSystem->copy($file->getRealpath(), $migrationDirectory . $file->getFilename(), true);
                }
            }
        }
    }

    /**
     * Get migrations directory.
     * 
     * @return string Migrations directory.
     */
    private function getDirectory()
    {
        return $this->baseDirectory . '/migrations/';
{'fraction_non_alphanumeric': 0.11885612153708669, 'fraction_numerical': 0.0, 'mean_word_length': 2.2889324191968656, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3734224', 'n_tokens_mistral': 888, 'n_tokens_neox': 885, 'n_words': 172}