<commit_before><?php

namespace TwigBridge\Extensions;

use Coyote\Declination;
use Twig_Extension;
use Twig_SimpleFunction;

class Misc extends Twig_Extension
{
    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return 'TwigBridge_Extension_Misc';
    }

    /**
     * @return array
     */
    public function getFunctions()
    {
        return [
            new Twig_SimpleFunction('timer', [$this, 'getGenerationTime']),
            new Twig_SimpleFunction('declination', [Declination::class, 'format']),
            new Twig_SimpleFunction(
                'sortable',
                function ($name) {
                    $args = func_get_args();

                    $column = array_shift($args);
                    $title = array_shift($args);
                    $default = array_shift($args);

                    $sort = request('sort', $default[0]);
                    $order = request('order', $default[1]);

                    $parameters = array_merge(
                        request()->all(),
                        ['sort' => $column, 'order' => $order == 'desc' ? 'asc' : 'desc']
                    );

                    return link_to(
                        request()->path() . '?' . http_build_query($parameters),
                        $title,
                        ['class' => "sort " . ($sort == $column ? strtolower($order) : '')]
                    );
                },
                [
                    'is_safe' => ['html'],
                ]
            ),
        ];
    }

    /**
     * Zwraca czas generowania strony w sekundach lub milisekundach
     *
     * @return string
     */
    public function getGenerationTime()
    {
        // w przypadku testow funkcjonalnych, stala ta nie jest deklarowana
        if (!defined('LARAVEL_START')) {
            return false;
        }

        $timer = microtime(true) - LARAVEL_START;

        if ($timer < 1) {
            return substr((string) $timer, 2, 3) . ' ms';
        } else {
            return number_format($timer, 2) . ' s';
        }
    }
}<commit_msg>rzutowanie na int<commit_after><?php

namespace TwigBridge\Extensions;

use Coyote\Declination;
use Twig_Extension;
use Twig_SimpleFunction;

class Misc extends Twig_Extension
{
    /**
     * {@inheritDoc}
     */
    public function getName()
    {
        return 'TwigBridge_Extension_Misc';
    }

    /**
     * @return array
     */
    public function getFunctions()
    {
        return [
            new Twig_SimpleFunction('timer', [$this, 'getGenerationTime']),
            new Twig_SimpleFunction('declination', [Declination::class, 'format']),
            new Twig_SimpleFunction(
                'sortable',
                function ($name) {
                    $args = func_get_args();

                    $column = array_shift($args);
                    $title = array_shift($args);
                    $default = array_shift($args);

                    $sort = request('sort', $default[0]);
                    $order = request('order', $default[1]);

                    $parameters = array_merge(
                        request()->all(),
                        ['sort' => $column, 'order' => $order == 'desc' ? 'asc' : 'desc']
                    );

                    return link_to(
                        request()->path() . '?' . http_build_query($parameters),
                        $title,
                        ['class' => "sort " . ($sort == $column ? strtolower($order) : '')]
                    );
                },
                [
                    'is_safe' => ['html'],
                ]
            ),
        ];
    }

    /**
     * Zwraca czas generowania strony w sekundach lub milisekundach
     *
     * @return string
     */
    public function getGenerationTime()
    {
        // w przypadku testow funkcjonalnych, stala ta nie jest deklarowana
        if (!defined('LARAVEL_START')) {
            return false;
        }

        $timer = microtime(true) - LARAVEL_START;

        if ($timer < 1) {
            return (int) substr((string) $timer, 2, 3) . ' ms';
        } else {
            return number_format($timer, 2) . ' s';
        }
    }
}
{'fraction_non_alphanumeric': 0.12962962962962962, 'fraction_numerical': 0.002849002849002849, 'mean_word_length': 1.382918552036199, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3091230', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1129, 'n_words': 237}