<commit_before><?php

/**
 * This file is part of frontend-block
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE
 */

namespace Bldr\Block\Frontend\Task;

use Bldr\Block\Core\Task\AbstractTask;
use Bldr\Block\Core\Task\Traits\FinderAwareTrait;
use Less_Parser;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\SplFileInfo;

/**
 * @author <NAME> <<EMAIL>>
 */
class LessTask extends AbstractTask
{
    use FinderAwareTrait;

    /**
     * @var Less_Parser $less
     */
    private $less;

    /**
     * {@inheritDoc}
     */
    public function configure()
    {
        $this->setName('less')
            ->setDescription('Compiles the `src` less files')
            ->addParameter('src', true, 'Less files to compile')
            ->addParameter('dest', true, 'Destination to save to')
            ->addParameter('compress', false, 'Should bldr remove whitespace and comments')
            ->addParameter('sourceMap', false, 'Should bldr create a source map')
            ->addParameter(
                'sourceMapWriteTo',
                false,
                'Where should bldr write to? If this isn\'t set, it will be written to the compiled file.'
            )
            ->addParameter('sourceMapURL', false, 'Url to use for the source map');
    }

    /**
     * {@inheritDoc}
     */
    public function run()
    {

        $this->less = new Less_Parser($this->getLessOptions());

        $source = $this->getParameter('src');
        $files = $this->getFiles($source);

        $this->compileFiles($output, $files, $this->getParameter('dest'));
    }

    /**
     * @return array
     * @throws \RuntimeException
     */
    private function getLessOptions()
    {
        $options = [];
        if ($this->getParameter('compress') === true) {
            $options['compres'] = true;
        }

        if ($this->hasParameter('sourceMap')) {
            $options['sourceMap'] = $this->getParameter('sourceMap');
        }

        if ($this->hasParameter('sourceMapWriteTo')) {
            $options['sourceMapWriteTo'] = $this->getParameter('sourceMapWriteTo');
        }

        if ($this->hasParameter('sourceMapURL')) {<commit_msg>Fixing task<commit_after><?php

/**
 * This file is part of frontend-block
 *
 * (c) <NAME> <<EMAIL>>
 *
 * This source file is subject to the license that is bundled
 * with this source code in the file LICENSE
 */

namespace Bldr\Block\Frontend\Task;

use Bldr\Block\Core\Task\AbstractTask;
use Bldr\Block\Core\Task\Traits\FinderAwareTrait;
use Less_Parser;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\SplFileInfo;

/**
 * @author <NAME> <<EMAIL>>
 */
class LessTask extends AbstractTask
{
    use FinderAwareTrait;

    /**
     * @var Less_Parser $less
     */
    private $less;

    /**
     * {@inheritDoc}
     */
    public function configure()
    {
        $this->setName('less')
            ->setDescription('Compiles the `src` less files')
            ->addParameter('src', true, 'Less files to compile')
            ->addParameter('dest', true, 'Destination to save to')
            ->addParameter('compress', false, 'Should bldr remove whitespace and comments')
            ->addParameter('sourceMap', false, 'Should bldr create a source map')
            ->addParameter(
                'sourceMapWriteTo',
                false,
                'Where should bldr write to? If this isn\'t set, it will be written to the compiled file.'
            )
            ->addParameter('sourceMapURL', false, 'Url to use for the source map');
    }

    /**
     * {@inheritDoc}
     */
    public function run(OutputInterface $output)
    {

        $this->less = new Less_Parser($this->getLessOptions());

        $source = $this->getParameter('src');
        $files = $this->getFiles($source);

        $this->compileFiles($output, $files, $this->getParameter('dest'));
    }

    /**
     * @return array
     * @throws \RuntimeException
     */
    private function getLessOptions()
    {
        $options = [];
        if ($this->getParameter('compress') === true) {
            $options['compres'] = true;
        }

        if ($this->hasParameter('sourceMap')) {
            $options['sourceMap'] = $this->getParameter('sourceMap');
        }

        if ($this->hasParameter('sourceMapWriteTo')) {
            $options['sourceMapWriteTo'] = $this->getParameter('sourceMapWriteTo');
        }

        if ($this->hasParameter('sourceMapURL')) {
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.4618235730170497, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 55, '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': '1420322', 'n_tokens_mistral': 1348, 'n_tokens_neox': 1325, 'n_words': 324}