protected function generateFunction(array $config, array $params)
	{
		// returnFalse() and returnTrue() can be used as-is
		if ($config['js'] == 'returnFalse' || $config['js'] == 'returnTrue')
		{
			return new Code((string) $config['js']);
		}

		// Add an empty list of params if none is set
		$config += ['params' => []];

		$src  = $this->getHeader($params);
		$src .= 'function(' . implode(',', array_keys($params)) . '){';
		$src .= 'return ' . $this->parenthesizeCallback($config['js']);
		$src .= '(' . $this->buildCallbackArguments($config['params'], $params) . ');}';

		return new Code($src);
	}
protected function generateFunction(array $config, array $params)
	{
		// returnFalse() and returnTrue() can be used as-is
		if ($config['js'] == 'returnFalse' || $config['js'] == 'returnTrue')
		{
			return new Code((string) $config['js']);
		}

		// Add an empty list of params if none is set
		$config += ['params' => []];

		$src  = $this->getHeader($params);
		$src .= 'function(' . implode(',', array_keys($params)) . '){';
		$src .= 'return ' . $this->parenthesizeCallback($config['js']);
		$src .= '(' . $this->buildCallbackArguments($config['params'], $params) . ');}';

		return new Code($src);
	}
protected function generateFunction ( array $ config , array $ params ) { // returnFalse() and returnTrue() can be used as-is if ( $ config [ 'js' ] == 'returnFalse' || $ config [ 'js' ] == 'returnTrue' ) { return new Code ( ( string ) $ config [ 'js' ] ) ; } // Add an empty list of params if none is set $ config += [ 'params' => [ ] ] ; $ src = $ this -> getHeader ( $ params ) ; $ src .= 'function(' . implode ( ',' , array_keys ( $ params ) ) . '){' ; $ src .= 'return ' . $ this -> parenthesizeCallback ( $ config [ 'js' ] ) ; $ src .= '(' . $ this -> buildCallbackArguments ( $ config [ 'params' ] , $ params ) . ');}' ; return new Code ( $ src ) ; }
Generate a function from a callback config

@param  array $config Callback config
@param  array $params Param names as keys, param types as values
@return Code
Generate a function from a callback config