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;
        });
    }
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;
        });
    }
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 ; } ) ; }
register driver.

@param string       $name
@param string|array $scheme
register driver .