<commit_before><?php
/*
 * This file is part of the Onema ClassyFile Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */
namespace Onema\ClassyFile\Plugin;

use League\Flysystem\FilesystemInterface;
use Onema\ClassyFile\Event\ClassyFileEvent;
use Onema\ClassyFile\Event\GetClassEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;


/**
 * GenerateClassFile - Description. 
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, onema.io
 */
class GenerateClassFile implements EventSubscriberInterface
{
    /**
     * @var \League\Flysystem\FilesystemInterface
     */
    private $filesystem;

    public function __construct(FilesystemInterface $filesystem)
    {
        $this->filesystem = $filesystem;
    }

    /**
     * @return array The event names to listen to
     */
    public static function getSubscribedEvents()
    {
        return [ClassyFileEvent::AFTER_GET_CLASS => 'onGetClassGenerateFile'];
    }

    /**
     * Use flysystem to save the file in the desired location.
     *
     * @param \Onema\ClassyFile\Event\GetClassEvent $event
     */
    public function onGetClassGenerateFile(GetClassEvent $event)
    {
        $statement = $event->getStatements();
        $fileLocation = $event->getFileLocation();
        $code = $event->getCode();
        $name = $statement->name;

        if (!$this->filesystem->has($fileLocation)) {
            // dir doesn't exist, make it
            $this->filesystem->createDir($fileLocation);
        }

        $location = sprintf('%s/%s.php', $fileLocation, $name);
        $this->filesystem->put($location, $code);
    }
}
<commit_msg>Update priority and re-set the new file location.<commit_after><?php
/*
 * This file is part of the Onema ClassyFile Package.
 * For the full copyright and license information, 
 * please view the LICENSE file that was distributed 
 * with this source code.
 */
namespace Onema\ClassyFile\Plugin;

use League\Flysystem\FilesystemInterface;
use Onema\ClassyFile\Event\ClassyFileEvent;
use Onema\ClassyFile\Event\GetClassEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;


/**
 * GenerateClassFile - Description. 
 *
 * @author <NAME> <<EMAIL>>
 * @copyright (c) 2015, onema.io
 */
class GenerateClassFile implements EventSubscriberInterface
{
    /**
     * @var \League\Flysystem\FilesystemInterface
     */
    private $filesystem;

    public function __construct(FilesystemInterface $filesystem)
    {
        $this->filesystem = $filesystem;
    }

    /**
     * @return array The event names to listen to
     */
    public static function getSubscribedEvents()
    {
        return [ClassyFileEvent::AFTER_GET_CLASS => ['onGetClassGenerateFile', 10]];
    }

    /**
     * Use flysystem to save the file in the desired location.
     *
     * @param \Onema\ClassyFile\Event\GetClassEvent $event
     */
    public function onGetClassGenerateFile(GetClassEvent $event)
    {
        $statement = $event->getStatements();
        $fileLocation = $event->getFileLocation();
        $code = $event->getCode();
        $name = $statement->name;

        if (!$this->filesystem->has($fileLocation)) {
            // dir doesn't exist, make it
            $this->filesystem->createDir($fileLocation);
        }

        $location = sprintf('%s/%s.php', $fileLocation, $name);
        $this->filesystem->put($location, $code);
        $event->setFileLocation($location);
    }
}

{'fraction_non_alphanumeric': 0.11952191235059761, 'fraction_numerical': 0.0028457598178713715, 'mean_word_length': 3.0263459335624283, 'pattern_counts': {'":': 0, '<': 11, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '224765', 'n_tokens_mistral': 1030, 'n_tokens_neox': 996, 'n_words': 241}