<commit_before><?php
/**
 * Created by PhpStorm.
 * User: daniel
 * Date: 19/11/15
 * Time: 17:13
 */

namespace oconnedk\id3\command;

use oconnedk\id3\CMP3File;
use oconnedk\id3\MediaLocator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;

class FindCommand extends Command
{
    const COMMAND_NAME = 'find';
    const PATH_ARGUMENT = 'path';
    const FIND_MEDIATYPE = 'mp3';

    protected function configure()
    {
        $cmd = self::COMMAND_NAME;
        $this->setName($cmd)
            ->setDescription('Finds media requiring ID3 tags in the specified path')
            ->setDefinition([
                new InputArgument(self::PATH_ARGUMENT, InputArgument::REQUIRED, 'The directory containing your media', null),
            ])
            ->setHelp(<<<EOT
The <info>$cmd</info> command locates any albums in your specified media directory requiring ID3 tags
EOT
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output) {
        $needingID3Tags = [];
        foreach (MediaLocator::find($input->getArgument(self::PATH_ARGUMENT), self::FIND_MEDIATYPE) as $mediaEntry) {
            $path = $mediaEntry->getPath();
            $file = new CMP3File($path);
            if ($file->needsID3Info())
            {
                $needingID3Tags[] = $path;
            }
        }
        if ($needingID3Tags)
        {
            $output->writeln("These files need ID3 tags:");
            $output->writeln(implode(PHP_EOL, $needingID3Tags));
        }
    }

} <commit_msg>PSR-2 compliance<commit_after><?php
/**
 * Created by PhpStorm.
 * User: daniel
 * Date: 19/11/15
 * Time: 17:13
 */

namespace oconnedk\id3\command;

use oconnedk\id3\CMP3File;
use oconnedk\id3\MediaLocator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;

class FindCommand extends Command
{
    const COMMAND_NAME = 'find';
    const PATH_ARGUMENT = 'path';
    const FIND_MEDIATYPE = 'mp3';

    protected function configure()
    {
        $cmd = self::COMMAND_NAME;
        $this->setName($cmd)
            ->setDescription('Finds media requiring ID3 tags in the specified path')
            ->setDefinition([
                new InputArgument(
                    self::PATH_ARGUMENT,
                    InputArgument::REQUIRED,
                    'The directory containing your media',
                    null
                ),
            ])
            ->setHelp(<<<EOT
The <info>$cmd</info> command locates any albums in your specified media directory requiring ID3 tags
EOT
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $needingID3Tags = [];
        foreach (MediaLocator::find($input->getArgument(self::PATH_ARGUMENT), self::FIND_MEDIATYPE) as $mediaEntry) {
            $path = $mediaEntry->getPath();
            $file = new CMP3File($path);
            if ($file->needsID3Info()) {
                $needingID3Tags[] = $path;
            }
        }
        if ($needingID3Tags) {
            $output->writeln("These files need ID3 tags:");
            $output->writeln(implode(PHP_EOL, $needingID3Tags));
        }
    }
}
{'fraction_non_alphanumeric': 0.11677774558099102, 'fraction_numerical': 0.014198782961460446, 'mean_word_length': 2.4623871614844535, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 25, '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': '4303949', 'n_tokens_mistral': 1041, 'n_tokens_neox': 1013, 'n_words': 218}