src/Container/Javascript.php
public function build($selector, $function, ...$params)
    {
        $attributes = [];


        foreach($params as $p) {
            $attributes[] = $this->encode($p);
        }

        //n concatenation du json
        $attributes =  implode(',', $attributes);

        // gestion des functions
        $attributes = preg_replace('#\"(function\([^\{]+{.*\})\",#', '$1,', $attributes);

        return sprintf('$("%s").%s(%s);', $selector, $function, $attributes);
    }
public function build($selector, $function, ...$params)
    {
        $attributes = [];


        foreach($params as $p) {
            $attributes[] = $this->encode($p);
        }

        //n concatenation du json
        $attributes =  implode(',', $attributes);

        // gestion des functions
        $attributes = preg_replace('#\"(function\([^\{]+{.*\})\",#', '$1,', $attributes);

        return sprintf('$("%s").%s(%s);', $selector, $function, $attributes);
    }
public function build ( $ selector , $ function , ... $ params ) { $ attributes = [ ] ; foreach ( $ params as $ p ) { $ attributes [ ] = $ this -> encode ( $ p ) ; } //n concatenation du json $ attributes = implode ( ',' , $ attributes ) ; // gestion des functions $ attributes = preg_replace ( '#\"(function\([^\{]+{.*\})\",#' , '$1,' , $ attributes ) ; return sprintf ( '$("%s").%s(%s);' , $ selector , $ function , $ attributes ) ; }
Build a jquery call javascript code

@param $selector
@param $function
@param ...$params
@return string
Build a jquery call javascript code