Declare exchange

@param string $name a name of exchange
@param array $options exchange options
@param callable|null $callback
@throws \InvalidArgumentException
@throws \PHPDaemon\Clients\AMQP\Driver\Protocol\Exception\AMQPProtocolException
348375
public function declareExchange($name, array $options = [], callable $callback = null)
    {
        $type = array_key_exists('type', $options) ? $options['type'] : null;
        $passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
        $durable = array_key_exists('durable', $options) ? (bool)$options['durable'] : null;
        $internal = array_key_exists('internal', $options) ? (bool)$options['internal'] : null;
        $autoDelete = array_key_exists('autoDelete', $options) ? (bool)$options['autoDelete'] : null;
        $noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
        $arguments = array_key_exists('arguments', $options) ? $options['arguments'] : null;

        $outputFrame = Exchange\ExchangeDeclareFrame::create(
            $name,
            $type,
            $passive,
            $durable,
            $autoDelete,
            $internal,
            $noWait,
            $arguments
        );
        $outputFrame->frameChannelId = $this->id;
        $this->connection->command($outputFrame);

        if (is_callable($callback)) {
            $this->on(self::EVENT_ON_CHANNEL_DECLARE_EXCHANGE_CALLBACK, $callback);
        }
    }
811342
public function addCallback($name, $callback, $prio = 10)
    {
        if (!is_callable($callback)) {
            throw new \Exception("Callback not callable.", 3);
            return false;
        }
        $key = $this->getCallbackKey($callback);
        if (!isset(self::$_baseRealCallbacks[$key])) {
            self::$_baseRealCallbacks[$key] = $callback;
        }

        $this->_callbacks[$name][$prio][] = $key;
        ksort($this->_callbacks[$name]);

        return $this;
    }
339731
protected function SetRequired($name, $errorPrefix = '')
    {
        $field = $this->GetElement($name);
        if (!$field instanceof FormField)
        {
            throw new \InvalidArgumentException("$name is not a field in the form elements");
        }
        if (!$errorPrefix)
        {
            $errorPrefix = $this->ErrorPrefix($name);
        }
        $field->SetRequired($errorPrefix);
    }
711576
public static function register($name, $callback) {
		$name = static::slug($name);
		if( empty(static::$hooks[$name]) ) {
			throw new \Exception('No hook with this name');
		}
		return static::$hooks[$name]->registerHook($callback);
	}
558692
public static function use(string $name, callable $callback)
    {
        $resource = static::getResource($name);
        $result = null;
        try{
            $result = call_user_func($callback, $resource, $resource->getInstance());
        }
        finally{
            static::releaseResource($resource);
        }
        return $result;
    }
131552
public function on($names, $callback)
    {
        if (! is_array($names)) {
            $names = [$names];
        }

        $callable = $this->getCallable($callback);

        foreach ($names as $name) {
            $this->events[] = [
                'name' => $name,
                'callback' => $callable,
            ];
        }
    }
514346
public function make($name, callable $callback) {
        $blueprint = new Blueprint($name, $this->config->getAdminURIPrefix());
        $callback($blueprint);
        $this->blueprints[$blueprint->getName()] = $blueprint;

        if($blueprint->hasPrimaryToolbarItem()) {
            $this->navigation->add($blueprint->getPrimaryToolbarItem());
        }
    }
759357
public function submit(string $name, array $options = []): FieldTypeInterface
    {
        return (new SubmitType($name))
            ->setLocale($this->app->getLocale())
            ->setViewFactory($this->viewFactory)
            ->setOptions($options);
    }
1012558
public function create($name, $callback)
    {
        $this->_name = $name;
        $this->_class = $callback();

        $GLOBALS['providers'][$this->_name] = $this->_class;
    }
969142
public function open($name, array $args = [])
    {
        if (! is_string($name)) {
            throw new InvalidArgumentException('Foil block name must be in a string.');
        }
        if (! array_key_exists($name, $this->blocks)) {
            throw new InvalidArgumentException("{$name} is not a registered Foil block.");
        }
        /** @var \Foil\Blocks\Block $buffer */
        $buffer = $this->blocks[$name];
        $buffer->open($args);
        $this->buffers->push([$buffer, $name]);
    }
148331
private function ConfirmationUrlCallback($callback, $name, $args)
    {
        if (call_user_func_array($callback, $args) !== true)
        {
            $message = 'The given ' . $name . ' confirmation callback function did not return TRUE';
            $fullMessage = 'Cannot handle confirmation URL. ' . $message;
            throw new CallbackResponseException($fullMessage);
        }
    }
285708
public function addTask($name, $callback)
    {
        if (!is_callable($callback)) {
            throw new \InvalidArgumentException('Task should be a callback.');
        }

        $this->tasks[$name] = $callback;

        return $this;
    }
120768
protected function addTwigFilter($name, $callback, $options = [])
    {
        // If we pass a callback as a simple string, we need to turn it into an array.
        if (is_string($callback) && method_exists($this, $callback)) {
            $callback = [$this, $callback];
        }

        $safe = method_exists($this, 'isSafe') && $this->isSafe();
        if (isset($options['safe'])) {
            $safe = (bool) $options['safe'];
            unset($options['safe']);
        }

        $this->twigFilters[] = new TwigFilter($name, $callback, $options);

        if ($safe) {
            $this->safeFilterNames[] = $name;
        }
    }
1227711
public function condition($name, callable $callback)
    {
        $this->conditions[$name] = $callback;

        // If
        $this->directive($name, function($expr) use ($name) {
            return $expr ? '<?php if ($__parser->check(\'' . $name . '\', $expr)): ?>'
                : '<?php if ($__parser->check(\'' . $name . '\')): ?>';
        });

        // elseif
        $this->directive('else' . $name, function($expr) use ($name) {
            return $expr ? '<?php elseif ($__parser->check(\'' . $name . '\', $expr)): ?>'
                : '<?php elseif ($__parser->check(\'' . $name . '\')): ?>';
        });

        // end
        $this->directive('end' . $name, function() {
            return '<?php endif; ?>';
        });
    }
269040
protected function setOption(Array $options, $name, $method)
    {
        if (isset($options[$name])) {
            $this->$method($options[$name]);
        }
    }
343035
public function createTable($name, callable $callback, $ifNotExists = true, $options = [])
    {
        $options = $this->prepareBCOptions($options);

        return $this->getTable($name)->create($callback, $ifNotExists, $options);
    }
11717
public function registerFilter($name, $callback, $wiringSchema = null)
    {
        if (!preg_match('#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#', $name)) {
            throw new InvalidArgumentException(
                "Invalid filter name given: '$name'. For filter names apply the same rules as for function names in PHP."
            );
        }
        if (isset($this->filters[$name])) {
            throw new InvalidArgumentException("Filter with name '$name' was already registered.");
        }
        if (!is_callable($callback, true)) {
            throw new InvalidArgumentException("Callback given for filter '$name' is not callable.");
        }
        $this->filters[$name] = [$callback, $this->translateWiringSchema($wiringSchema)];
    }