protected function cleanAttributes(array $input, array $valid): array
    {
        foreach ($input as $key => $value) {
            if (preg_match('/^data-(.+)/', $key) || in_array($key, $valid)) {
                continue;
            }
            unset($input[$key]);
        }
        return $input;
    }
protected function cleanAttributes(array $input, array $valid): array
    {
        foreach ($input as $key => $value) {
            if (preg_match('/^data-(.+)/', $key) || in_array($key, $valid)) {
                continue;
            }
            unset($input[$key]);
        }
        return $input;
    }
protected function cleanAttributes ( array $ input , array $ valid ) : array { foreach ( $ input as $ key => $ value ) { if ( preg_match ( '/^data-(.+)/' , $ key ) || in_array ( $ key , $ valid ) ) { continue ; } unset ( $ input [ $ key ] ) ; } return $ input ; }
Cleans array of attributes based on valid input.

@param array $input
@param array $valid
@return array
Cleans array of attributes based on valid input .