Example #1
0
/**
 * Alias to Register Methods
 *
 * - $data 为 null => \Lego\Register\Register::get
 * - $data 不为 null => \Lego\Register\Register::register
 *
 * @param $class
 * @param string|null $path
 * @param array $data
 * @return \Lego\Register\Data\Data
 */
function lego_register($class, $path = null, array $data = null)
{
    if (is_null($data)) {
        return Register::get($class, $path);
    }
    return Register::register($class, $path, $data);
}
Example #2
0
 public static function add($path, \Closure $closure)
 {
     return Register::register(self::class, self::class, [$path => $closure]);
 }
Example #3
0
 public static function global($name, \Closure $callable)
 {
     return Register::register(self::class, self::class, [$name => $callable]);
 }
Example #4
0
/**
 * Alias to Register Methods
 *
 * - $data 为 null => \Lego\Register\Register::get
 * - $data 不为 null => \Lego\Register\Register::register
 *
 * @param $name
 * @param mixed $data
 * @param string|null $dataName
 * @return \Lego\Register\Data\Data
 */
function lego_register($name, $data = null, $dataName = null)
{
    return Register::register($name, $data, $dataName);
}
Example #5
0
 /**
  * 自动补全的结果集
  * @param callable $callable
  */
 public function match($callable)
 {
     $responsePath = $this->responsePath();
     Register::register(AutoCompleteData::class, $this->source()->original(), [$responsePath => $callable]);
     $this->remote = ResponseData::url($responsePath);
 }