lib/FunctionWrapper.php
public function add_to_twig( $twig ) {
		$wrapper = $this;

		try {
			$twig->addFunction( new Twig_Function( $this->_function, function() use ( $wrapper ) {
				return call_user_func_array( array( $wrapper, 'call' ), func_get_args() );
			} ) );

		// Use empty 'catch' block and not 'finally', because finally needs PHP 5.5 to work.
		} catch ( \Exception $e ) {}

		return $twig;
	}
public function add_to_twig( $twig ) {
		$wrapper = $this;

		try {
			$twig->addFunction( new Twig_Function( $this->_function, function() use ( $wrapper ) {
				return call_user_func_array( array( $wrapper, 'call' ), func_get_args() );
			} ) );

		// Use empty 'catch' block and not 'finally', because finally needs PHP 5.5 to work.
		} catch ( \Exception $e ) {}

		return $twig;
	}
public function add_to_twig ( $ twig ) { $ wrapper = $ this ; try { $ twig -> addFunction ( new Twig_Function ( $ this -> _function , function ( ) use ( $ wrapper ) { return call_user_func_array ( array ( $ wrapper , 'call' ) , func_get_args ( ) ) ; } ) ) ; // Use empty 'catch' block and not 'finally', because finally needs PHP 5.5 to work. } catch ( \ Exception $ e ) { } return $ twig ; }
Make function available in Twig.

When a function is added more than once, addFunction() will throw a LogicException that states that the function
is already registered. By catching this exception, we can prevent a fatal error.
@see Twig_Extension_Staging::addFunction()

@deprecated since 1.3.0
@todo remove in 1.4.0
@param \Twig_Environment $twig
@return \Twig_Environment
Make function available in Twig .