src/Crawler/AdCrawler.php
private function sanitize($key, $value)
    {
        $key = (new KeySanitizer)->clean($key);

        if ($key == 'ville') {
            return [
                'ville' => (new CitySanitizer)->clean($value),
                'cp'    => (new CpSanitizer)->clean($value),
            ];
        }

        $filteClass = 'Lbc\\Filter\\' . ucfirst($key) . 'Sanitizer';

        if (!class_exists($filteClass)) {
            $filteClass = 'Lbc\\Filter\\DefaultSanitizer';
        }

        return [
            $key => call_user_func_array([(new $filteClass), 'clean'], [$value]),
        ];
    }
private function sanitize($key, $value)
    {
        $key = (new KeySanitizer)->clean($key);

        if ($key == 'ville') {
            return [
                'ville' => (new CitySanitizer)->clean($value),
                'cp'    => (new CpSanitizer)->clean($value),
            ];
        }

        $filteClass = 'Lbc\\Filter\\' . ucfirst($key) . 'Sanitizer';

        if (!class_exists($filteClass)) {
            $filteClass = 'Lbc\\Filter\\DefaultSanitizer';
        }

        return [
            $key => call_user_func_array([(new $filteClass), 'clean'], [$value]),
        ];
    }
private function sanitize ( $ key , $ value ) { $ key = ( new KeySanitizer ) -> clean ( $ key ) ; if ( $ key == 'ville' ) { return [ 'ville' => ( new CitySanitizer ) -> clean ( $ value ) , 'cp' => ( new CpSanitizer ) -> clean ( $ value ) , ] ; } $ filteClass = 'Lbc\\Filter\\' . ucfirst ( $ key ) . 'Sanitizer' ; if ( ! class_exists ( $ filteClass ) ) { $ filteClass = 'Lbc\\Filter\\DefaultSanitizer' ; } return [ $ key => call_user_func_array ( [ ( new $ filteClass ) , 'clean' ] , [ $ value ] ) , ] ; }
Transform the properties name into a snake_case string and sanitize
the value

@param string $key
@param string $value
@return string
Transform the properties name into a snake_case string and sanitize the value