<commit_before><?php

namespace Numa\DOAAdminBundle\Command;


use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Validator\Constraints\NotNull;

class ImageCommand extends ContainerAwareCommand
{

    protected function configure()
    {
        //set_error_handler( array( $this, 'myErrorHandler' ) );
        $this
            ->setName('numa:image')
            ->addArgument('function', InputArgument::OPTIONAL, 'Command name')
            ->addArgument('param1', InputArgument::OPTIONAL, 'param1');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $command = $input->getArgument('function');
        $param1 = $input->getArgument('param1');

        $em = $this->getContainer()->get('doctrine')->getManager();

        if ($command == 'resize') {
            $this->resize($param1);
        }
    }

    public function resize($period)
    {
        $image_path = $this->getContainer()->getParameter("web_path");
        $dir = $image_path . '/upload/itemsimages'; // path from top
        $scanedFiles = scandir($dir);

        $files = array_diff($scanedFiles, array('.', '..'));

        foreach ($files as $file) {
            $filename = $dir . "/" . $file;
            if (is_file($filename) && file_exists($filename)) {

                dump($filename);
                $this->getContainer()->get("numa.dms.images")->downsizeImage($filename, "downscale_resize");
            }
        }

        die();

    }

}<commit_msg>code fix<commit_after><?php

namespace Numa\DOAAdminBundle\Command;


use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Validator\Constraints\NotNull;

class ImageCommand extends ContainerAwareCommand
{

    protected function configure()
    {
        $this
            ->setName('numa:image')
            ->addArgument('function', InputArgument::OPTIONAL, 'Command name')
            ->addArgument('param1', InputArgument::OPTIONAL, 'param1');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $command = $input->getArgument('function');
        $param1 = $input->getArgument('param1');
        if ($command == 'resize') {
            $this->resize($param1);
        }
    }

    public function resize()
    {
        $image_path = $this->getContainer()->getParameter("web_path");
        $dir = $image_path . '/upload/itemsimages'; // path from top
        $scannedFiles = scandir($dir);

        $files = array_diff($scannedFiles, array('.', '..'));

        foreach ($files as $file) {
            $filename = $dir . "/" . $file;
            if (is_file($filename) && file_exists($filename)) {

                dump($filename);
                $this->getContainer()->get("numa.dms.images")->downsizeImage($filename, "downscale_resize");
            }
        }
    }

}
{'fraction_non_alphanumeric': 0.14617239300783605, 'fraction_numerical': 0.0030138637733574444, 'mean_word_length': 2.9001175088131608, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '6808757', 'n_tokens_mistral': 934, 'n_tokens_neox': 914, 'n_words': 156}