public function setHelpers($helpers)
    {
        if ($helpers instanceof HelpersInterface) {
            $helpers = $helpers->toArray();
        }

        if (!is_array($helpers) && !$helpers instanceof Traversable) {
            throw new InvalidArgumentException(sprintf(
                'setHelpers expects an array of helpers, received %s',
                (is_object($helpers) ? get_class($helpers) : gettype($helpers))
            ));
        }

        $this->helpers = [];
        foreach ($helpers as $name => $helper) {
            $this->addHelper($name, $helper);
        }

        return $this;
    }
public function setHelpers($helpers)
    {
        if ($helpers instanceof HelpersInterface) {
            $helpers = $helpers->toArray();
        }

        if (!is_array($helpers) && !$helpers instanceof Traversable) {
            throw new InvalidArgumentException(sprintf(
                'setHelpers expects an array of helpers, received %s',
                (is_object($helpers) ? get_class($helpers) : gettype($helpers))
            ));
        }

        $this->helpers = [];
        foreach ($helpers as $name => $helper) {
            $this->addHelper($name, $helper);
        }

        return $this;
    }
public function setHelpers ( $ helpers ) { if ( $ helpers instanceof HelpersInterface ) { $ helpers = $ helpers -> toArray ( ) ; } if ( ! is_array ( $ helpers ) && ! $ helpers instanceof Traversable ) { throw new InvalidArgumentException ( sprintf ( 'setHelpers expects an array of helpers, received %s' , ( is_object ( $ helpers ) ? get_class ( $ helpers ) : gettype ( $ helpers ) ) ) ) ; } $ this -> helpers = [ ] ; foreach ( $ helpers as $ name => $ helper ) { $ this -> addHelper ( $ name , $ helper ) ; } return $ this ; }
Set the engine's helpers.

@param  array|Traversable|HelpersInterface $helpers Mustache helpers.
@throws InvalidArgumentException If the given helper(s) are invalid.
@return MustacheEngine Chainable
Set the engine s helpers .