Creates a new shortcut.

@param string $name The name of the shortcut property.
@param callable $callback The callback to return the shortcut value.
@return self Returns a reference to itself.
489929
public function add(string $name, callable $callback): self
    {
        call_user_func($this->addCallback, $name, $callback);
        return $this;
    }
940022
public function bind(string $name, callable $callback): self
    {
        $this->data->bind($name, $callback);
        return $this;
    }
1012558
public function create($name, $callback)
    {
        $this->_name = $name;
        $this->_class = $callback();

        $GLOBALS['providers'][$this->_name] = $this->_class;
    }
437233
public function set(string $name, callable $callback): void
    {
        $this->services[$name] = function ($c) use ($callback) {
            static $object;

            if ($object === null) {
                $object = $callback($c);
            }

            return $object;
        };
    }
175805
public function unless($name, callable $callback, callable $default = null, array $context = [])
    {
        if ($this->isInactive($name, $context)) {
            return $callback($this->params($name), $context);
        } elseif ($default) {
            return $default($this->params($name), $context);
        }

        return $this;
    }
1121391
public function mixin(string $name, callable $callback): self
    {
        $this->data->mixin($name, $callback);
        return $this;
    }
379748
public function addCallback(string $key, callable $callback): self
    {
        if (!isset($this->callbacks[$key])) {
            $this->callbacks[$key] = $callback;
        } else {
            throw new \Exception("Callback with key ($key) already exists");
        }

        return $this;
    }
883622
public function addMethod(string $name, callable $callback = null): self
    {
        if ($this->isFinalized) {
            throw new FinalizedMockException();
        }
        if (!$callback) {
            $callback = $this->emptyCallback;
        }

        $this->customMethods[$name] = [
            $callback,
            $this->invocableInspector->callbackReflector($callback),
        ];

        return $this;
    }
916546
public static function libRepo($name, $callback = false) {
		
		if ($callback !== false and is_callable($callback)) {
			static::$libs_callbacks[$name] = $callback;
		} else {
			return static::$libs_callbacks[$name];
		}
		
	}
1347719
public function send($name = '', callable $callback)
    {
        $configs = Config::get($name);
        $driver = $this->driver(isset($configs['driver']) ? $configs['driver']: 'swift', $configs);

        return $callback($driver);
    }
95916
public function javascript($name, Closure $callback = null)
    {
        return $this->add($name, function($asset) use ($callback)
        {
            $asset->setGroup('javascripts');

            is_callable($callback) and call_user_func($callback, $asset);
        });
    }
962586
public function extend($name, Closure $callback)
    {
        $this->parsers[Str::camel($name)] = Str::title($name);

        return parent::extend($name, $callback);
    }
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];
    }
1195541
function createIndex($name, $callback = false)
    {

        $index = new Index($name, $callback);

        $index->connection = $this->connection;

        return $index->create();
    }
243042
public function addTab($name, $callback = null)
    {
        $c = parent::addTab($name, $callback);

        return $c->add([$this->formLayout, 'form' => $this->form]);
    }
134154
public function make($name, Closure $callback)
    {
        $this->add($name, Menu::make($name, $callback));
    }
389088
public static function make(Closure $callback = null)
    {
        if ($callback instanceof Closure) {
            return $callback(new static(Security::create()));
        }

        return new static(Security::create());
    }