protected function exportCallback($namespace, callable $callback, $argument)
	{
		if (is_array($callback) && is_string($callback[0]))
		{
			// Replace ['foo', 'bar'] with 'foo::bar'
			$callback = $callback[0] . '::' . $callback[1];
		}

		if (!is_string($callback))
		{
			return 'call_user_func(' . var_export($callback, true) . ', ' . $argument . ')';
		}

		// Ensure that the callback starts with a \
		if ($callback[0] !== '\\')
		{
			$callback = '\\' . $callback;
		}

		// Replace \foo\bar::baz() with bar::baz() if we're in namespace foo
		if (substr($callback, 0, 2 + strlen($namespace)) === '\\' . $namespace . '\\')
		{
			$callback = substr($callback, 2 + strlen($namespace));
		}

		return $callback . '(' . $argument . ')';
	}
protected function exportCallback($namespace, callable $callback, $argument)
	{
		if (is_array($callback) && is_string($callback[0]))
		{
			// Replace ['foo', 'bar'] with 'foo::bar'
			$callback = $callback[0] . '::' . $callback[1];
		}

		if (!is_string($callback))
		{
			return 'call_user_func(' . var_export($callback, true) . ', ' . $argument . ')';
		}

		// Ensure that the callback starts with a \
		if ($callback[0] !== '\\')
		{
			$callback = '\\' . $callback;
		}

		// Replace \foo\bar::baz() with bar::baz() if we're in namespace foo
		if (substr($callback, 0, 2 + strlen($namespace)) === '\\' . $namespace . '\\')
		{
			$callback = substr($callback, 2 + strlen($namespace));
		}

		return $callback . '(' . $argument . ')';
	}
protected function exportCallback ( $ namespace , callable $ callback , $ argument ) { if ( is_array ( $ callback ) && is_string ( $ callback [ 0 ] ) ) { // Replace ['foo', 'bar'] with 'foo::bar' $ callback = $ callback [ 0 ] . '::' . $ callback [ 1 ] ; } if ( ! is_string ( $ callback ) ) { return 'call_user_func(' . var_export ( $ callback , true ) . ', ' . $ argument . ')' ; } // Ensure that the callback starts with a \ if ( $ callback [ 0 ] !== '\\' ) { $ callback = '\\' . $ callback ; } // Replace \foo\bar::baz() with bar::baz() if we're in namespace foo if ( substr ( $ callback , 0 , 2 + strlen ( $ namespace ) ) === '\\' . $ namespace . '\\' ) { $ callback = substr ( $ callback , 2 + strlen ( $ namespace ) ) ; } return $ callback . '(' . $ argument . ')' ; }
Export a given callback as PHP code

@param  string   $namespace Namespace in which the callback is execute
@param  callable $callback  Original callback
@param  string   $argument  Callback's argument (as PHP code)
@return string              PHP code
Export a given callback as PHP code