<commit_before><?php

namespace App\Http\Controllers;

use App\Models\TestDate;
use Illuminate\Support\Facades\DB;
use Khill\Lavacharts\Lavacharts;

class SurveyCalendarController extends Controller
{
    /*
     * Show a page of Google Calendar Charts for each year of surveys.
     */
    public function index()
    {
        $years = TestDate::select(DB::raw('year(test_date) as years'))
            ->distinct()
            ->orderBy('years', 'desc')
            ->get();

        // Collect survey count data for each year in the database
        foreach ($years as $y) {
            // Create an array of data tables for each year
            $surveyCalendar = \Lava::DataTable();
            $surveyCalendar->addDateColumn('Date')
                ->addNumberColumn('Num Surveys');

            // Get the number of surveys for each day of the current year $y
            $chartData = TestDate::year($y->years)
                ->get()
                ->countBy('test_date');

            // Add survey date and count data to the data table
            foreach ($chartData as $d=>$count) {
                $surveyCalendar->addRow(
                    [$d, $count]);
            }

            // Create a column chart
            \Lava::CalendarChart(
                'Daily survey count - '.$y->years,
                $surveyCalendar,
                [
                    'title' => 'Daily survey counts - '.$y->years,
                    'titleTextStyle' => [
                        'fontSize' => 14,
                        'color' => 'black',],
                    'yearLabel' => [
                        'color' => 'black',],
                    'legend' => [
                        'position' => 'top',],
                    'colorAxis' => [
                        'colors' => ['#c0d4ff', '#4273e0'],
                    ],
                ]
            );

            // Clear variables for the next loop iteration
            unset($surveyCalendar);
            unset($chartData);
        }

        return view('dashboard.survey_calendar', [
            'years' => $years,
        ]);
    }
}
<commit_msg>Apply fixes from StyleCI<commit_after><?php

namespace App\Http\Controllers;

use App\Models\TestDate;
use Illuminate\Support\Facades\DB;

class SurveyCalendarController extends Controller
{
    /*
     * Show a page of Google Calendar Charts for each year of surveys.
     */
    public function index()
    {
        $years = TestDate::select(DB::raw('year(test_date) as years'))
            ->distinct()
            ->orderBy('years', 'desc')
            ->get();

        // Collect survey count data for each year in the database
        foreach ($years as $y) {
            // Create an array of data tables for each year
            $surveyCalendar = \Lava::DataTable();
            $surveyCalendar->addDateColumn('Date')
                ->addNumberColumn('Num Surveys');

            // Get the number of surveys for each day of the current year $y
            $chartData = TestDate::year($y->years)
                ->get()
                ->countBy('test_date');

            // Add survey date and count data to the data table
            foreach ($chartData as $d=>$count) {
                $surveyCalendar->addRow(
                    [$d, $count]
                );
            }

            // Create a column chart
            \Lava::CalendarChart(
                'Daily survey count - '.$y->years,
                $surveyCalendar,
                [
                    'title'          => 'Daily survey counts - '.$y->years,
                    'titleTextStyle' => [
                        'fontSize' => 14,
                        'color'    => 'black', ],
                    'yearLabel' => [
                        'color' => 'black', ],
                    'legend' => [
                        'position' => 'top', ],
                    'colorAxis' => [
                        'colors' => ['#c0d4ff', '#4273e0'],
                    ],
                ]
            );

            // Clear variables for the next loop iteration
            unset($surveyCalendar);
            unset($chartData);
        }

        return view('dashboard.survey_calendar', [
            'years' => $years,
        ]);
    }
}

{'fraction_non_alphanumeric': 0.12318160488033787, 'fraction_numerical': 0.004223369310183012, 'mean_word_length': 1.2944025834230355, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '4434305', 'n_tokens_mistral': 1135, 'n_tokens_neox': 1058, 'n_words': 283}