<commit_before><?php

namespace RodrigoPedra\RecordProcessor\Helpers\Excel;

use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class WorksheetConfigurator
{
    /**
     * @var Worksheet
     */
    private $worksheet;

    public function __construct( Worksheet $worksheet )
    {
        $this->worksheet = $worksheet;
    }

    public function setTitle( $title )
    {
        $this->worksheet->setTitle( $title );

        return $this;
    }

    public function setColumnFormat( array $formats )
    {
        // Loop through the columns
        foreach ($formats as $column => $format) {
            // Change the format for a specific cell or range
            $this->worksheet
                ->getStyle( $column )
                ->getNumberFormat()
                ->setFormatCode( $format );
        }

        return $this;
    }

    public function freezeFirstRow()
    {
        $this->worksheet->freezePane( 'A2' );

        return $this;
    }

    public function cells( $range, callable $callback )
    {
        $cells = new CellWriter( $range, $this->worksheet );

        if (is_callable( $callback )) {
            call_user_func( $callback, $cells );
        }

        return $this;
    }

    public function getStyle( $range )
    {
        return $this->worksheet->getStyle( $range );
    }
}<commit_msg>make worksheet accessbible from configurator<commit_after><?php

namespace RodrigoPedra\RecordProcessor\Helpers\Excel;

use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

class WorksheetConfigurator
{
    /** @var Worksheet */
    protected $worksheet;

    public function __construct( Worksheet $worksheet )
    {
        $this->worksheet = $worksheet;
    }

    public function setTitle( $title )
    {
        $this->worksheet->setTitle( $title );

        return $this;
    }

    public function setColumnFormat( array $formats )
    {
        // Loop through the columns
        foreach ($formats as $column => $format) {
            // Change the format for a specific cell or range
            $this->worksheet
                ->getStyle( $column )
                ->getNumberFormat()
                ->setFormatCode( $format );
        }

        return $this;
    }

    public function freezeFirstRow()
    {
        $this->worksheet->freezePane( 'A2' );

        return $this;
    }

    public function cells( $range, callable $callback )
    {
        $cells = new CellWriter( $range, $this->worksheet );

        if (is_callable( $callback )) {
            call_user_func( $callback, $cells );
        }

        return $this;
    }

    public function getStyle( $range )
    {
        return $this->worksheet->getStyle( $range );
    }

    public function getWorksheet()
    {
        return $this->worksheet;
    }
}
{'fraction_non_alphanumeric': 0.11147186147186147, 'fraction_numerical': 0.0007215007215007215, 'mean_word_length': 1.9913700107874865, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '7057438', 'n_tokens_mistral': 825, 'n_tokens_neox': 786, 'n_words': 189}