Create a new menu builder instance.

@param string   $name
@param callable $callback

@return Builder
480836
public function makeOnce($name, $callback)
    {
        if ($this->exists($name)) {
            return null;
        }

        return $this->make($name, $callback);
    }
76262
protected function createStringCallback($callback, array $parameters)
    {
        if (function_exists($callback)) {
            return $this->createCallableCallback($callback, $parameters);
        } else {
            return $this->createClassesCallback($callback, $parameters);
        }
    }
123110
protected function callCustomCreator($name, array $config)
    {
        $driver = $config['driver'];

        $callback = $this->customCreators[$driver];

        return call_user_func($callback, $this->app, $name, $config);
    }
264525
public function singleton(string $name, callable $callback = null)
    {
        static $instance = [];

        // if closure callback given we will create a singleton instance of class
        // and return it to user
        if ($callback instanceof Closure) {
            if (!isset($instance[$name])) {
                $instance[$name] = $callback($this);
            }

            return $this->stack[$name] = $instance[$name];
        }

        /*
         | If callback is not instance of closure then we will simply
         | create a singleton instance and return it
         */
        if (!isset($instance[$name])) {
            $instance[$name] = new $name();
        }

        return $instance[$name];
    }
1373117
public function build($name = null, array $attributes = [], $callback = null)
    {
        if (!isset($attributes['response-container'])) {
            array_set($attributes, 'response-container', 'test-response');
        }
        if (!isset($attributes['form-container'])) {
            array_set($attributes, 'form-container', 'tester-form');
        }
        $script    = is_null($name) ? 'round' : $name;
        $container = app('antares.asset')->container('antares/foundation::scripts');
        $container->inlineScript($script, $this->generateScripts($attributes));
        if ($callback instanceof Closure) {
            call_user_func($callback, $container);
        }
    }
795764
public function callback(string $name, callable $callback): self
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
335751
public function withAttribute($name, $callback = null)
    {
        if (is_array($name)) {
            foreach ($name as $key => $val) {
                $key = Db::parseName($key);

                $this->withAttr[$key] = $val;
            }
        } else {
            $name = Db::parseName($name);

            $this->withAttr[$name] = $callback;
        }

        return $this;
    }
1104930
public function addFilter($name, callable $callback)
	{
		$filter = new Filter($name, $callback);

		$this->filters->add($filter);

		return $filter;
	}
343035
public function createTable($name, callable $callback, $ifNotExists = true, $options = [])
    {
        $options = $this->prepareBCOptions($options);

        return $this->getTable($name)->create($callback, $ifNotExists, $options);
    }
210475
public function addActionCallback($key, $name, $callback = null)
	{
		$this->addActionCheck($key);

		$params = ['__id' => $this->primary_key];

		$this->actions[$key] = $action = new Column\ActionCallback($this, $key, $name, $params);

		if ($callback) {
			if (!is_callable($callback)) {
				throw new DataGridException('ActionCallback callback has to be callable.');
			}

			$action->onClick[] = $callback;
		}

		return $action;
	}
906213
public function create($name){
        $this->menuCollection[$name] = new MenuCollection;
        $this->menuCollection[$name]->setName($name);

        return $this->menuCollection[$name];
    }
475367
public static function script($name, $callback) 
    {
        if (phpQueryPlugin_Scripts::$scriptMethods[$name]) {
            throw new Exception("Script name conflict - '$name'");
        }
        phpQueryPlugin_Scripts::$scriptMethods[$name] = $callback;
    }
66878
public function table($name, callable $callback)
    {
        $blueprint = new Blueprint($name, $callback);

        $this->blueprints[$name] = $blueprint->build();
    }
1185979
public function menu($name = 'default')
    {
        if (!isset($this->menus[$name])) {
            $this->menus[$name] = new Menu($this);
        }

        return $this->menus[$name];
    }
558028
public function fill($items, callable $callback)
    {
        $menu = $this;

        foreach ($items as $key => $item) {
            $menu = $callback($menu, $item, $key) ?: $menu;
        }

        return $menu;
    }
396972
public function fieldset($name, Closure $callback = null): FieldsetContract
    {
        $fieldset = new Fieldset($this->app, $this->templates, $name, $callback);

        if (\is_null($name = $fieldset->getName())) {
            $name = \sprintf('fieldset-%d', $this->fieldsets->count());
        } else {
            $name = Str::slug($name);
        }

        $this->keyMap[$name] = $fieldset;

        $this->fieldsets->push($fieldset);

        return $fieldset;
    }
148328
public function of($name, $callback = null)
    {

        $type = $this->definition['name'];

        if (is_null($type) || !property_exists($this, $type)) {
            throw new RuntimeException('Not supported.');
        } elseif (!isset($this->keyMap[$name])) {
            throw new InvalidArgumentException("Name [{$name}] is not available.");
        }

        $id = $this->keyMap[$name];

        if (is_callable($callback)) {
            call_user_func($callback, $this->{$type}[$id]);
        }


        return $this->{$type}[$id];
    }