<commit_before><?php

require "../../src/razorflow.php";

class SampleDashboard extends StandaloneDashboard {
    public function initialize () {
        $kpi = new KPIComponent("kpi1");
        $kpi->setCaption("Hello world");
        $kpi->setValue(42);
        $kpi->setDimensions(4, 4);
        $this->addComponent ($kpi);

        // $table = new TableComponent('table1');
        // $table->setCaption("Table 1");
        // $table->setDimensions (6,6);
        // $table->addColumn('colA', "Column A");
        // $table->addColumn('colB', "Column B");
        // for ($i = 0; $i < 10; $i ++) {
        //     $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
        // }
        // $this->addComponent ($table);

        $kpi2 = new KPIComponent("kpi2");
        $kpi2->setCaption("KPI 2");
        $kpi2->setValue(45);
        $kpi2->setDimensions(4, 4);
        $this->addComponent ($kpi2);

        // $chart = new ChartComponent('my_chart');
        // $chart->setCaption("Chart 1");
        // $chart->setDimensions(4,4);
        // $chart->setLabels(['January', 'February', 'March', 'April', 'May']);
        // $chart->addSeries("seriesA", "Series A", [1, 3, 5, 1, 9], null);
        // $chart->addSeries("seriesB", "Series B", [3, 1, 9, 2, 3], null);
        // $this->addComponent ($chart);

        $kpi->bindToEvent ("kpiClick", array($kpi2), "handleKPIClick");
    }

    public function handleKPIClick ($source, $targets, $params) {
        $kpi2 = $this->getComponentByID("kpi2");
        $kpi2->setValue (55);
    }
}

$db = new SampleDashboard();
$db->setStaticRoot("http://localhost:9090");
$db->renderStandalone();

<commit_msg>testcase code to verify changes<commit_after><?php

require "../../src/razorflow.php";

class SampleDashboard extends StandaloneDashboard {
    public function initialize () {
        $kpi = new KPIComponent("kpi1");
        $kpi->setCaption("Hello world");
        $kpi->setValue(42);
        $kpi->setDimensions(4, 4);
        $this->addComponent ($kpi);

        // $table = new TableComponent('table1');
        // $table->setCaption("Table 1");
        // $table->setDimensions (6,6);
        // $table->addColumn('colA', "Column A");
        // $table->addColumn('colB', "Column B");
        // for ($i = 0; $i < 10; $i ++) {
        //     $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
        // }
        // $this->addComponent ($table);

        $kpi2 = new KPIComponent("kpi2");
        $kpi2->setCaption("KPI 2");
        $kpi2->setValue(45);
        $kpi2->setDimensions(4, 4);
        $this->addComponent ($kpi2);

        // $chart = new ChartComponent('my_chart');
        // $chart->setCaption("Chart 1");
        // $chart->setDimensions(4,4);
        // $chart->setLabels(['January', 'February', 'March', 'April', 'May']);
        // $chart->addSeries("seriesA", "Series A", [1, 3, 5, 1, 9], null);
        // $chart->addSeries("seriesB", "Series B", [3, 1, 9, 2, 3], null);
        // $this->addComponent ($chart);

        $kpi->bindToEvent ("kpiClick", array($kpi2), "handleKPIClick");
    }

    public function handleKPIClick ($source, $targets, $params) {
        $kpi2 = $this->getComponentByID("kpi2");
        $kpi2->setValue (55);
        $kpi2->setDimensions (5, 5);
        $kpi2->setCaption ("Hello to you too");
    }
}

$db = new SampleDashboard();
$db->setStaticRoot("http://localhost:9090");
$db->renderStandalone();


{'fraction_non_alphanumeric': 0.2148880488514103, 'fraction_numerical': 0.029659784821168943, 'mean_word_length': 2.506625891946993, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 59, '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': '5489727', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1179, 'n_words': 228}