Code Duplication    Length = 17-17 lines in 2 locations

src/OpenSkill/Datatable/Providers/CollectionProvider.php 1 location

@@ 77-93 (lines=17) @@
74
     * @param ColumnConfiguration[] $columnConfiguration
75
     * @return mixed
76
     */
77
    public function prepareForProcessing(QueryConfiguration $queryConfiguration, array $columnConfiguration)
78
    {
79
        $this->queryConfiguration = $queryConfiguration;
80
        $this->columnConfiguration = $columnConfiguration;
81
82
        // generate a custom search function for each column
83
        foreach ($this->columnConfiguration as $col) {
84
            if (!array_key_exists($col->getName(), $this->columnSearchFunction)) {
85
                $this->columnSearchFunction[$col->getName()] = function ($data, ColumnSearch $search) use ($col) {
86
                    if (str_contains(mb_strtolower($data[$col->getName()]), mb_strtolower($search->searchValue()))) {
87
                        return true;
88
                    }
89
                    return false;
90
                };
91
            }
92
        }
93
    }
94
95
    /**
96
     * This method should process all configurations and prepare the underlying data for the view. It will arrange the

src/OpenSkill/Datatable/Providers/QueryBuilderProvider.php 1 location

@@ 86-102 (lines=17) @@
83
     * @param ColumnConfiguration[] $columnConfiguration
84
     * @return mixed
85
     */
86
    public function prepareForProcessing(QueryConfiguration $queryConfiguration, array $columnConfiguration)
87
    {
88
        $this->queryConfiguration = $queryConfiguration;
89
        $this->columnConfiguration = $columnConfiguration;
90
91
        // generate a custom search function for each column
92
        foreach ($this->columnConfiguration as $col) {
93
            if (!array_key_exists($col->getName(), $this->columnSearchFunction)) {
94
                $this->columnSearchFunction[$col->getName()] = function ($data, ColumnSearch $search) use ($col) {
95
                    if (str_contains(mb_strtolower($data[$col->getName()]), mb_strtolower($search->searchValue()))) {
96
                        return true;
97
                    }
98
                    return false;
99
                };
100
            }
101
        }
102
    }
103
104
    /**
105
     * This method should process all configurations and prepare the underlying data for the view. It will arrange the