register driver.

@param string       $name
@param string|array $scheme
549557
protected static function registerDriver($name, $scheme)
    {
        // parse higher-order scheme
        $settings = [];
        if (is_array($scheme)) {
            $settings = self::parseScheme($scheme);
            $scheme = $settings['scheme'];
        }
        // register
        self::getTask()->driver("$name $scheme")->work(function (Driver $driver) use ($settings) {
            $agent = self::getAgent($driver->name, $settings);
            extract($driver->getTaskData());
            $template = isset($templates[$driver->name]) ? $templates[$driver->name] : null;
            $file = isset($files[$driver->name]) ? $files[$driver->name] : null;
            $params = isset($params[$driver->name]) ? $params[$driver->name] : [];
            if ($type === self::TYPE_VOICE) {
                $agent->sendVoice($to, $content, $template, $data, $code, $file, $params);
            } elseif ($type === self::TYPE_SMS) {
                $agent->sendSms($to, $content, $template, $data, $params);
            }
            $result = $agent->result();
            if ($result['success']) {
                $driver->success();
            }
            unset($result['success']);

            return $result;
        });
    }
1109564
private function set_scheme($scheme)
    {
        if ($scheme === null)
        {
            $this->scheme = null;
        }
        elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
        {
            $this->scheme = null;
            return false;
        }
        else
        {
            $this->scheme = strtolower($scheme);
        }
        return true;
    }
971542
protected static function register($name/* , ... $ctors */) {
			$key = get_called_class();

			if (static::isDone())
				throw new BadMethodCallException(sprintf('Registration has been halted for %s; cannot add %s to the enum list.',
					$key, $name));

			if (!array_key_exists($key, self::$types))
				self::$types[$key] = array();

			$ctors = func_get_args();
			array_shift($ctors);

			$refl = new ReflectionClass($key);
			$ctor = $refl->getConstructor();
			$ctor->setAccessible(true);

			/** @var Enum $inst */
			$inst = $refl->newInstanceWithoutConstructor();

			$ctor->invokeArgs($inst, $ctors);
			$ctor->setAccessible(false);

			$inst->setName($name);
			$inst->setOrdinal(sizeof(self::$types[$key]));

			self::$types[$key][$name] = $inst;
		}
617198
public function register($name, $callback)
    {
        if (! isset($this->registered_menus[$name])) {
            $this->registered_menus[$name] = [];
        }

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

        return $this;
    }
952378
public static function registerModule(string $name): void
    {
        if (!isset(static::$registeredModules[$name])) {
            $modulePath = static::getModulePath($name);

            static::prependIncludePath($modulePath . 'controllers', $modulePath . 'library');
            static::$registeredModules[$name] = true;
            $initPath = $modulePath . 'init.php';

            if (is_file($initPath)) {
                require $initPath;
            }
        }
    }
286013
protected function createRegistryDriver($name)
    {
        $config = Arr::get($this->config, "registry.{$name}", []);
        $cache  = $this->getCacheRepository($config);

        return $this->createProvider(Registry::getInstance($name, $config, $this->app, $cache));
    }
774043
public function registerService($service, $name = '') {
        if (empty($name)) {
            $name = Assist::classNameShort($service);
        }

        static::$container->offsetSet(strtolower($name), $service);
    }
1107745
public function register($name, FormatInterface $format)
    {
        if (isset($this->formats[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'Formatter with name "%s" is already registered',
                $name
            ));
        }

        $this->formats[$name] = $format;
    }
370212
public static function registerHelper($name, $helper)
    {
        Argument::i()
            //Argument 1 must be a string
            ->test(1, 'string')
            //Argument 2 must be a Closure of some kind
            ->test(2, 'Closure');
        
        self::$helpers[$name] = $helper;
    }
1073224
public function setDefaultDriverName($name)
    {
        $name = strtolower($name);

        if (! isset($this->drivers[$name])) {
            throw new InvalidArgumentException("[W002] Driver '{$name}' is not registered.");
        }

        $this->default_driver = $name;
    }
1099536
protected function registerService($name, $service)
    {
        $name = strtolower($name);

        if (!isset($this->services->$name)) {
            $this->services->$name = $service;
            return true;
        }
        return false;
    }
1345740
public static function register($name, Agent $agent)
    {
        if (!is_string($name) || $name == '') {
            throw new SmsException('代理器：' . $name . ' 无效！');
        }
        self::$agents[$name] = $agent;
    }
456088
protected function registerPlugin($name)
    {
        $view = $this->getView();

        MaterializePluginAsset::register($view);

        $id = $this->options['id'];

        if ($this->clientOptions !== false) {
            $options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
            $js = "jQuery('#$id').$name($options);";
            $view->registerJs($js);
        }

        $this->registerClientEvents();
    }
427959
function registerDriver(Driver, name, options) {
  if (this.drivers[name]) {
    log.error(new Error('Driver "' + name + '" is already registered.'));
    return;
  }
  if (!Driver || !Driver.prototype || typeof Driver.prototype.send !== 'function') {
    log.error(new Error('Driver "' + name + '" should implement "send" method.'));
    return;
  }
  this.drivers[name] = new Driver(options || {});
}
1214998
public function registerEvent(string $name, ?string $table = null, \Closure $action): void
    {
        $this->connection->getEventHandler()->registerEvent($name, $table, $action);
    }
795186
public function register($name)
	{
		return $this->addCommand(new Command($name, $this->input, $this->output));
	}
359508
public function register(string $name, string $class, string $description, array $options = [])
    {
        $name = strtolower($name);

        $this->app->getConfig()->write('collectors.' . $name, [
            'class' => $class,
            'description' => $description,
            'options' => $options,
        ]);
        $this->container->singleton($class);
        $this->container->alias($name, $class);
    }