Build basic fieldset.

@param  string|\Closure  $name
@param  \Closure|null  $callback

@return void
423741
protected function buildBasic($name, Closure $callback = null): void
    {
        if ($name instanceof Closure) {
            $callback = $name;
            $name = null;
        }

        ! empty($name) && $this->legend($name);

        $callback($this);
    }
875409
public function macro($name, Closure $callback){
        $this->macros[$name] = Closure::bind($callback, $this, get_class());

        return $this;
    }
694175
protected function buildControl($name, $callback = null, $type = null)
    {
        list($label, $name, $callback) = $this->buildFluentAttributes($name, $callback);

        $control = new Field([
            'id'         => $name,
            'name'       => $name,
            'value'      => null,
            'label'      => $label,
            'attributes' => [],
            'options'    => [],
            'checked'    => false,
            'type'       => $type,
            'field'      => null,
        ]);
        is_callable($callback) && call_user_func($callback, $control);

        return [$name, $control];
    }
1286063
public function build($name, Collection $fields = null)
    {
        $path = $this->getClassFilePath($name);

        $contents = view('_hierarchy::entities.form', [
            'name'   => $this->getClassName($name),
            'fields' => $fields ?: []
        ])->render();

        $this->write($path, $contents);
    }
196724
public static function set(string $name, callable $callback)
    {
        if ($name = \trim($name)) {
            self::$validators[$name] = $callback;
        }
    }
762033
public function let($name, \Closure $closure)
    {
        $this->__stack->top()->getContext()->setFactory($name, $closure);
    }
940022
public function bind(string $name, callable $callback): self
    {
        $this->data->bind($name, $callback);
        return $this;
    }
309092
public function group($name, $action, Closure $callback)
    {
        static::$groups[$name] = [
            'action' => $action,
            'callback' => $callback
        ];

        return $this;
    }
971315
public function table($table, Closure $callback) {
        $blueprint = $this->createBlueprint($table, $callback);
        $this->build($blueprint);
        $class = $this->connection->getClient()->makeClass($blueprint->getTable());
        $class->setProperty($blueprint->getColumns());
        $class->saveProperties();
    }
713363
public function mapSurname(Closure $callback)
    {
        if (!static::$surnamesHandle instanceof SplFileObject) {
            static::$surnamesHandle = $this->openFile($this->path.'/surnames');
        }

        $this->traversing($this->getGenerator([static::$surnamesHandle]), $callback);
    }
907375
public function make(string $name, ?Closure $callback = null) : Collection {
        return $this->collection($name, $callback);
    }
675103
public function when($name, callable $callback, callable $default = null, array $context = [])
    {
        if ($this->isActive($name, $context)) {
            return $callback($this->params($name), $context);
        } elseif ($default) {
            return $default($this->params($name), $context);
        }

        return $this;
    }
462331
public function addResolver(string $name, callable $callback)
    {
        //if it's a closure, they meant to bind the callback
        if ($callback instanceof Closure) {
            //so there's no scope
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getResolverHandler()->register($name, $callback);

        return $this;
    }
13198
public function add($name, Closure $callback = null)
    {
        try
        {
            $path = $this->finder->find($name);

            if (isset($this->assets[$path]))
            {
                $asset = $this->assets[$path];
            }
            else
            {
                $asset = $this->factory->get('asset')->make($path);

                $asset->isRemote() and $asset->raw();
            }

            is_callable($callback) and call_user_func($callback, $asset);

            return $this->assets[$path] = $asset;
        }
        catch (AssetNotFoundException $e)
        {
            $this->getLogger()->error(sprintf('Asset "%s" could not be found in "%s"', $name, $this->path));

            return $this->factory->get('asset')->make(null);
        }
    }
878895
public function group($name, Closure $callback = null)
    {
        if ($this->groups->has($name)) {
            $group = $this->groups->get($name);
        } else {
            $group = $this->container->make('Maatwebsite\Sidebar\Group');
            $group->name($name);
        }

        $this->call($callback, $group);

        $this->addGroup($group);

        return $group;
    }
131211
protected function registerEvent($name, Closure $callback)
    {
        if (! isset(static::$dispatcher)) {
            $this->initEventDispatcher();
        }

        static::$dispatcher->listen($name, $callback);
    }
914172
public function addConstraint($name, $closure = null)
    {
        if ($name instanceof \Closure) {
            $closure = $name;
            $name = null;
        }

        if ($name == null) {
            $this->constraints[] = $closure;
        } else {
            $this->getField($name)->addConstraint($closure);
        }
    }