---------------------------------------------------------------------------- Mutual Information Provider ----------------------------------------------------------------------------
341178
function mutualInformationProvider(publicAPI, model) {
  let hasData = false;
  const onMutualInformationReady = publicAPI.onMutualInformationReady;
  const mutualInformationData = PMI.initializeMutualInformationData();
  const deltaHandling = {
    added: [],
    removed: [],
    modified: [],
    previousMTime: {},
    currentMTime: {},
    processed: true,
  };

  function updateHistogram2D(histograms) {
    // even if histograms only has maxCount = 0, run through PMI.updateMI
    // so deltaHandling.removed array is handled properly.
    const invalidAxis = [];
    // Extract mtime
    deltaHandling.modified = [];
    deltaHandling.previousMTime = deltaHandling.currentMTime;
    deltaHandling.currentMTime = {};
    if (Object.keys(histograms).length > 1) {
      model.mutualInformationParameterNames.forEach((name) => {
        if (histograms[name] && histograms[name][name]) {
          // Validate range
          if (histograms[name][name].x.delta === 0) {
            invalidAxis.push(name);
            deltaHandling.currentMTime[name] = 0;
          } else {
            deltaHandling.currentMTime[name] = histograms[name][name].x.mtime;
          }

          if (
            deltaHandling.added.indexOf(name) === -1 &&
            deltaHandling.currentMTime[name] &&
            (deltaHandling.previousMTime[name] || 0) <
              deltaHandling.currentMTime[name]
          ) {
            deltaHandling.modified.push(name);
          }
        }
      });
    }
    // Check mutualInformationParameterNames are consistent with the current set of data
    // if not just for the next notification...
    try {
      PMI.updateMutualInformation(
        mutualInformationData,
        [].concat(deltaHandling.added, deltaHandling.modified),
        [].concat(deltaHandling.removed, invalidAxis),
        histograms
      );

      // Push the new mutual info
      deltaHandling.processed = true;
      hasData = true;
      publicAPI.fireMutualInformationReady(mutualInformationData);
    } catch (e) {
      console.log('PMI error', e);
    }
  }

  publicAPI.onMutualInformationReady = (callback) => {
    if (hasData) {
      callback(mutualInformationData);
    }
    return onMutualInformationReady(callback);
  };

  publicAPI.setHistogram2dProvider = (provider) => {
    if (model.histogram2dProviderSubscription) {
      model.histogram2dProviderSubscription.unsubscribe();
    }
    model.histogram2dProvider = provider;
    if (provider) {
      model.histogram2dProviderSubscription = provider.subscribeToHistogram2D(
        updateHistogram2D,
        listToPair(model.mutualInformationParameterNames),
        { symmetric: true, partial: false }
      );
    }
  };

  publicAPI.setMutualInformationParameterNames = (names) => {
    if (deltaHandling.processed) {
      deltaHandling.added = names.filter(
        (name) => model.mutualInformationParameterNames.indexOf(name) === -1
      );
      deltaHandling.removed = model.mutualInformationParameterNames.filter(
        (name) => names.indexOf(name) === -1
      );
    } else {
      // We need to add to it
      deltaHandling.added = [].concat(
        deltaHandling.added,
        names.filter(
          (name) => model.mutualInformationParameterNames.indexOf(name) === -1
        )
      );
      deltaHandling.removed = [].concat(
        deltaHandling.removed,
        model.mutualInformationParameterNames.filter(
          (name) => names.indexOf(name) === -1
        )
      );
    }

    // Ensure uniqueness
    deltaHandling.added = unique(deltaHandling.added);
    deltaHandling.removed = unique(deltaHandling.removed);

    deltaHandling.processed = false;
    model.mutualInformationParameterNames = [].concat(names);

    if (model.histogram2dProviderSubscription) {
      model.histogram2dProviderSubscription.update(
        listToPair(model.mutualInformationParameterNames)
      );
    }
  };
}
1104931
public function doStatus()
	{
		assert($this->_dispatcher);
		assert($this->_container);

		$this->_clearStatProperties();
		$this->_dispatcher->dispatch(self::EVENT_INIT_SERVICE, OnInitService::create());

		try
		{
			$this->notify(self::STATE_FIRED);

			$modulesAndFiles = $this->_findModulesAndMigrationFiles();
			$migrations      = $this->_parseMigrationFiles($modulesAndFiles);

			$this->notify(self::STATE_FIND_MIGRATIONS);

			$actions         = $this->_askMigrationList($modulesAndFiles, $migrations);
			$actions         = $this->_sortMigrationsList($actions);

			$this->notify(self::STATE_MIGRATIONS_ASKED);
			$states = [self::STATE_MIGRATION_STORED, self::STATE_MIGRATION_ROLLBACK, self::STATE_MIGRATION_APPLY];

			foreach (array_combine($states, [$actions[2], $actions[0], $actions[1]]) as $state => $migrations)
			{
				foreach (array_keys($migrations) as $migrationName)
				{
					$this->_stateMigrationName = $migrationName;
					$this->notify($state);
				}
			}

			$this->notify(self::STATE_COMPLETE);
		}
		catch (Exception $exception)
		{
			$this->_printError($exception);
			$this->notify(self::STATE_COMPLETE);
		}
		finally
		{
			$this->_stateMigrationName = null;
			$this->_state = self::STATE_INITIALIZED;

			$this->_dispatcher->dispatch(self::EVENT_FREE_SERVICE, OnFreeService::create());
		}
	}
610043
function UMLConnector() {
        UMLUndirectedRelationship.apply(this, arguments);

        /** @member {UMLConnectorEnd} */
        this.end1 = new UMLConnectorEnd();
        this.end1._parent = this;

        /** @member {UMLConnectorEnd} */
        this.end2 = new UMLConnectorEnd();
        this.end2._parent = this;

        /** @member {UMLAssociation} */
        this.type = null;

        /** @member {UMLConnectorKind} */
        this.kind = CK_ASSEMBLY;
    }
1117094
private static function init()
    {
        $userAgentHandlerChain = new UserAgentHandlerChain();

        /** @var $genericNormalizers UserAgentNormalizer */
        $genericNormalizers = self::createGenericNormalizers();

        /**** Smart TVs ****/
        $userAgentHandlerChain->addUserAgentHandler(new SmartTVHandler($genericNormalizers));

        /**** Mobile devices ****/
        $userAgentHandlerChain->addUserAgentHandler(new KindleHandler($genericNormalizers));

        /**** UCWEB ****/
        $ucwebu3Normalizer = clone $genericNormalizers;
        $ucwebu3Normalizer->add(new UcwebU3());
        $userAgentHandlerChain->addUserAgentHandler(new UcwebU3Handler($ucwebu3Normalizer));

        $ucwebu2Normalizer = clone $genericNormalizers;
        $ucwebu2Normalizer->add(new UcwebU2());
        $userAgentHandlerChain->addUserAgentHandler(new UcwebU2Handler($ucwebu2Normalizer));

        /**** Mobile platforms ****/
        //Windows Phone must be above Android to resolve WP 8.1 and above UAs correctly
        $winPhoneNormalizer = clone $genericNormalizers;
        $winPhoneNormalizer->add(
            new WindowsPhone()
        );
        $userAgentHandlerChain->addUserAgentHandler(
            new WindowsPhoneHandler($winPhoneNormalizer)
        );

        // Android Matcher Chain
        $userAgentHandlerChain->addUserAgentHandler(
            new OperaMiniOnAndroidHandler($genericNormalizers)
        );
        $operaMobiNormalizer = clone $genericNormalizers;
        $operaMobiNormalizer->add(
            new OperaMobiOrTabletOnAndroid()
        );
        $userAgentHandlerChain->addUserAgentHandler(
            new OperaMobiOrTabletOnAndroidHandler($operaMobiNormalizer)
        );

        $userAgentHandlerChain->addUserAgentHandler(
            new FennecOnAndroidHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(
            new Ucweb7OnAndroidHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(
            new NetFrontOnAndroidHandler($genericNormalizers)
        );

        $androidNormalizer = clone $genericNormalizers;
        $androidNormalizer->add(new Android());
        $userAgentHandlerChain->addUserAgentHandler(new AndroidHandler($androidNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(new UbuntuTouchOSHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new TizenHandler($genericNormalizers));

        $appleNormalizer = clone $genericNormalizers;
        $appleNormalizer->add(new Apple());
        $userAgentHandlerChain->addUserAgentHandler(new AppleHandler($appleNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(
            new NokiaOviBrowserHandler($genericNormalizers)
        );

        /**** High workload mobile matchers ****/
        $userAgentHandlerChain->addUserAgentHandler(new NokiaHandler($genericNormalizers));

        $userAgentHandlerChain->addUserAgentHandler(new SamsungHandler($genericNormalizers));

        $userAgentHandlerChain->addUserAgentHandler(
            new BlackBerryHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(
            new SonyEricssonHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(new MotorolaHandler($genericNormalizers));

        /**** Other mobile matchers ****/
        $userAgentHandlerChain->addUserAgentHandler(new AlcatelHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new BenQHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new DoCoMoHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new GrundigHandler($genericNormalizers));

        $htcMacNormalizer = clone $genericNormalizers;
        $htcMacNormalizer->add(new HTCMac());
        $userAgentHandlerChain->addUserAgentHandler(new HTCMacHandler($htcMacNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(new HTCHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new KDDIHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new KyoceraHandler($genericNormalizers));

        $lgNormalizer = clone $genericNormalizers;
        $lgNormalizer->add(new LG());
        $userAgentHandlerChain->addUserAgentHandler(new LGHandler($lgNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(new LGUPLUSHandler($genericNormalizers));

        $maemoNormalizer = clone $genericNormalizers;
        $maemoNormalizer->add(new Maemo());
        $userAgentHandlerChain->addUserAgentHandler(new MaemoHandler($maemoNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(
            new MitsubishiHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(new NecHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new NintendoHandler($genericNormalizers));

        $userAgentHandlerChain->addUserAgentHandler(
            new PanasonicHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(new PantechHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new PhilipsHandler($genericNormalizers));

        $userAgentHandlerChain->addUserAgentHandler(
            new PortalmmmHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(new QtekHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new ReksioHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SagemHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SanyoHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SharpHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SiemensHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SkyfireHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new SPVHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new ToshibaHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new VodafoneHandler($genericNormalizers));

        $webOSNormalizer = clone $genericNormalizers;
        $webOSNormalizer->add(new WebOS());
        $userAgentHandlerChain->addUserAgentHandler(new WebOSHandler($webOSNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(
            new FirefoxOSHandler($genericNormalizers)
        );

        $userAgentHandlerChain->addUserAgentHandler(
            new OperaMiniHandler($genericNormalizers)
        );

        /**** Java Midlets ****/
        $userAgentHandlerChain->addUserAgentHandler(
            new JavaMidletHandler($genericNormalizers)
        );

        /**** Tablet Browsers ****/
        $userAgentHandlerChain->addUserAgentHandler(
            new WindowsRTHandler($genericNormalizers)
        );

        /**** Robots / Crawlers ****/
        $userAgentHandlerChain->addUserAgentHandler(
            new BotCrawlerTranscoderHandler($genericNormalizers)
        );

        /**** Game Consoles ****/
        $userAgentHandlerChain->addUserAgentHandler(new XboxHandler($genericNormalizers));

        /**** DesktopApplications ****/
        $desktopApplicationNormalizer = clone $genericNormalizers;
        $desktopApplicationNormalizer->add(new DesktopApplication());
        $userAgentHandlerChain->addUserAgentHandler(
            new DesktopApplicationHandler($desktopApplicationNormalizer)
        );

        /**** Desktop Browsers ****/
        //MSIE above Chrome/Opera after MSIE 12+ say Chrome
        $msieNormalizer = clone $genericNormalizers;
        $msieNormalizer->add(new MSIE());
        $userAgentHandlerChain->addUserAgentHandler(new MSIEHandler($msieNormalizer));

        $operaNormalizer = clone $genericNormalizers;
        $operaNormalizer->add(new Opera());
        $userAgentHandlerChain->addUserAgentHandler(new OperaHandler($operaNormalizer));

        $chromeNormalizer = clone $genericNormalizers;
        $chromeNormalizer->add(new Chrome());
        $userAgentHandlerChain->addUserAgentHandler(new ChromeHandler($chromeNormalizer));

        $firefoxNormalizer = clone $genericNormalizers;
        $firefoxNormalizer->add(new Firefox());
        $userAgentHandlerChain->addUserAgentHandler(new FirefoxHandler($firefoxNormalizer));

        $safariNormalizer = clone $genericNormalizers;
        $safariNormalizer->add(new Safari());
        $userAgentHandlerChain->addUserAgentHandler(new SafariHandler($safariNormalizer));

        $userAgentHandlerChain->addUserAgentHandler(
            new KonquerorHandler($genericNormalizers)
        );

        /**** All other requests ****/
        $userAgentHandlerChain->addUserAgentHandler(new CatchAllMozillaHandler($genericNormalizers));
        $userAgentHandlerChain->addUserAgentHandler(new CatchAllRisHandler($genericNormalizers));

        return $userAgentHandlerChain;
    }
971515
function UMLMessage() {
        UMLDirectedRelationship.apply(this, arguments);

        /** @member {string} */
        this.messageSort = MS_SYNCHCALL;

        /** @member {UMLOperation} */
        this.signature = null;

        /** @member {UMLConnector} */
        this.connector = null;

        /** @member {string} */
        this["arguments"] = '';

        /** @member {string} */
        this.assignmentTarget = '';

        /** @member {string} */
        this.guard = '';

        /** @member {string} */
        this.iteration = '';

        /** @member {boolean} */
        this.isConcurrentIteration = false;
    }
911857
function callBack($from,$to,$customerSerNum,$fromSerNum,$promptTone)
	  {
        //子帐号鉴权信息验证，对必选参数进行判空。
        $auth=$this->subAuth();
        if($auth!=""){
            return $auth;
        }
        // 拼接请求包体
        if($this->BodyType=="json"){
           $body= "{'from':'$from','to':'$to','customerSerNum':'$customerSerNum','fromSerNum':'$fromSerNum','promptTone':'$promptTone'}";
        }else{
           $body= "<CallBack>
                     <from>$from</from>
                     <to>$to</to>
                     <customerSerNum>$customerSerNum</customerSerNum>
                     <fromSerNum>$fromSerNum</fromSerNum>
                     <promptTone>$promptTone</promptTone>
                   </CallBack>";
        }
        $this->showlog("request body = ".$body);
        // 大写的sig参数
        $sig =  strtoupper(md5($this->SubAccountSid . $this->SubAccountToken . $this->Batch));
        // 生成请求URL
        $url="https://$this->ServerIP:$this->ServerPort/$this->SoftVersion/SubAccounts/$this->SubAccountSid/Calls/Callback?sig=$sig";
        $this->showlog("request url = ".$url);
        // 生成授权：子帐号Id + 英文冒号 + 时间戳
        $authen=base64_encode($this->SubAccountSid . ":" . $this->Batch);
        // 生成包头
        $header = array("Accept:application/$this->BodyType","Content-Type:application/$this->BodyType;charset=utf-8","Authorization:$authen");
        // 发请求
        $result = $this->curl_post($url,$body,$header);
        $this->showlog("response body = ".$result);
        if($this->BodyType=="json"){//JSON格式
           $datas=json_decode($result);
        }else{ //xml格式
           $datas = simplexml_load_string(trim($result," \t\n\r"));
        }
      //  if($datas == FALSE){
//            $datas = new stdClass();
//            $datas->statusCode = '172003';
//            $datas->statusMsg = '返回包体错误'; 
//        }
        return $datas;
	}
675279
public function describe()
    {
        $this->enableByDefault();
        $this->registerDefault(
            function (Settings $settings) {
                /** @var TransportInfrastructure $transportInfrastructure */
                $transportInfrastructure = $settings->get(TransportInfrastructure::class);
                $settings->setDefault(
                    KnownSettingsEnum::LOCAL_ADDRESS,
                    $transportInfrastructure->toTransportAddress($settings->get(KnownSettingsEnum::ENDPOINT_NAME))
                );
            }
        );
    }
550113
public function detailsAction()
    {
        
        // Getting the Site config "MelisDemoCms.config.php"
        $siteConfig = $this->getServiceLocator()->get('config');
        $siteConfig = $siteConfig['site']['MelisDemoCms'];
        $siteDatas = $siteConfig['datas'];
        
        $dateMax = date("Y-m-d H:i:s", strtotime("now"));
		$listNewsPluginView = $this->MelisCmsNewsShowNewsPlugin();
		$listNewsParameters = array(
		    'id' => 'newsDetails',
		    'template_path' => 'MelisDemoCms/plugin/news-details',
		);
		// add generated view to children views for displaying it in the contact view
		$this->view->addChild($listNewsPluginView->render($listNewsParameters), 'newsDetails');
		
		/**
		 * Generating Homepage Latest News slider using MelisCmsNewsLatestNewsPlugin Plugin
		 */
		$latestNewsPluginView = $this->MelisCmsNewsLatestNewsPlugin();
		$latestNewsParameters = array(
		    'template_path' => 'MelisDemoCms/plugin/latest-news',
            'pageIdNews' => $siteDatas['news_details_page_id'],
		    'filter' => array(
		        'column' => 'cnews_publish_date',
		        'order' => 'DESC',
		        'limit' => 10,
		        'unpublish_filter' => true,
		        'date_max' => null,
		        'site_id' => $siteDatas['site_id'],
		    )
		);
		// add generated view to children views for displaying it in the contact view
		$this->view->addChild($latestNewsPluginView->render($latestNewsParameters), 'latestNews');
        
        $this->view->setVariable('renderMode', $this->renderMode);
        $this->view->setVariable('idPage', $this->idPage);
        return $this->view;
    }
1033723
private void applyConnectionManagerConfiguration(ConnectionManagerConfiguration cmc,
      org.ironjacamar.common.api.metadata.common.XaPool xp)
   {
      if (xp != null)
      {
         if (xp.isIsSameRmOverride() != null)
            cmc.setIsSameRMOverride(xp.isIsSameRmOverride());

         if (xp.isPadXid() != null)
            cmc.setPadXid(xp.isPadXid());

         if (xp.isWrapXaResource() != null)
            cmc.setWrapXAResource(xp.isWrapXaResource());
      }
   }
497944
public void raActive() {
		
		try {
			final Properties properties = prepareRaProperties();
			this.sipFactory = SipFactory.getInstance();
			this.sipFactory.setPathName("org.mobicents.ext");
			this.sipStack = (SipStackImpl) this.sipFactory.createSipStack(properties);
			this.sipStack.start();
			this.activityManagement = new LocalSipActivityManagement();

			if (tracer.isFineEnabled()) {
				tracer
						.fine("---> START "
								+ Arrays.toString(transports.toArray()));
			}
			boolean created = false;
			for (String trans : transports) {
				ListeningPoint lp = this.sipStack.createListeningPoint(
						this.stackAddress, this.port, trans);
				if (!created) {
					this.provider = this.sipStack.createSipProvider(lp);
					this.provider.addSipListener(this);
					created = true;
				} else
					this.provider.addListeningPoint(lp);
			}

			// LETS CREATE FP
			// SipFactory sipFactory = SipFactory.getInstance();
			AddressFactory addressFactory = sipFactory.createAddressFactory();
			HeaderFactory headerFactory = sipFactory.createHeaderFactory();
			MessageFactory messageFactory = sipFactory.createMessageFactory();

			this.providerWrapper.raActive(addressFactory, headerFactory, messageFactory, sipStack, provider);

		} catch (Throwable ex) {
			String msg = "error in initializing resource adaptor";
			tracer.severe(msg, ex);
			throw new RuntimeException(msg,ex);
		}

		if (tracer.isFineEnabled()) {
			tracer.fine("Sip Resource Adaptor entity active.");
		}
	}
1315695
def Conectar(self, cache=None, url="", proxy="", wrapper="", cacert=None, timeout=30):
        ""
        # llamo al constructor heredado:
        ok = BaseWS.Conectar(self, cache, url, proxy, wrapper, cacert, timeout)
        if False and ok:        
            # corrijo ubicación del servidor (puerto htttp 80 en el WSDL)
            location = self.client.services['LumService']['ports']['LumEndPoint']['location']
            if location.startswith("http://"):
                print "Corrigiendo WSDL ...", location,
                location = location.replace("http://", "https://").replace(":80", ":443")
                self.client.services['LumService']['ports']['LumEndPoint']['location'] = location
                print location
        return ok
529065
function EStoreScraper() {
    _.defaults(this, {
        logger: new logging.Logger(),
        cookieJar: new CookieJar(),
        maxConcurrency: 10,
        startPage: '',
        agent: new http.Agent()        
    });
    
    this.agent.maxSockets = this.maxConcurrency;
    this.products = [];
    this.waiting = 0;
}
1041021
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
    for (var /** @type {?} */ i = 0; i < providers.length; i++) {
        var /** @type {?} */ provider = providers[i];
        var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
        if (existing) {
            if (provider.multiProvider !== existing.multiProvider) {
                throw new MixingMultiProvidersWithRegularProvidersError(existing, provider);
            }
            if (provider.multiProvider) {
                for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
                    existing.resolvedFactories.push(provider.resolvedFactories[j]);
                }
            }
            else {
                normalizedProvidersMap.set(provider.key.id, provider);
            }
        }
        else {
            var /** @type {?} */ resolvedProvider = void 0;
            if (provider.multiProvider) {
                resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
            }
            else {
                resolvedProvider = provider;
            }
            normalizedProvidersMap.set(provider.key.id, resolvedProvider);
        }
    }
    return normalizedProvidersMap;
}
747288
def hello(self,details=None):
        
        self._welcome_queue = queue.Queue()

        if details is None:
            details = {}
        if self.authid:
            details.setdefault('authid', self.authid)
        details.setdefault('agent', u'swampyer-1.0')
        details.setdefault('authmethods', self.authmethods or [u'anonymous'])
        details.setdefault('roles', {
                                        'subscriber': {},
                                        'publisher': {},
                                        'caller': {},
                                        'callee': {},
                                    })
        self._state = STATE_AUTHENTICATING
        self.send_message(HELLO(
                                realm = self.realm,
                                details = details
                            ))

        # Wait till we get a welcome message
        try:
            message = self._welcome_queue.get(block=True,timeout=self.timeout)
        except Exception as ex:
            raise ExWelcomeTimeout("Timed out waiting for WELCOME response")
        if message == WAMP_ABORT:
            raise ExAbort("Received abort when trying to connect: {}".format(
                    message.details.get('message',
                      message.reason)))
        self.session_id = message.session_id
        self.peer = message
        self._state = STATE_CONNECTED

        # And hook register/subscribe to anything that's required
        self.handle_join(message)
162899
void notifyConsumer(Map<String, ProviderGroup> newCache) {
        Map<String, ProviderGroup> oldCache = memoryCache;
        // 比较两个map的差异
        MapDifference<String, ProviderGroup> difference =
                new MapDifference<String, ProviderGroup>(newCache, oldCache);
        // 新的有，旧的没有，通知
        Map<String, ProviderGroup> onlynew = difference.entriesOnlyOnLeft();
        for (Map.Entry<String, ProviderGroup> entry : onlynew.entrySet()) {
            notifyConsumerListeners(entry.getKey(), entry.getValue());
        }
        // 旧的有，新的没有，全部干掉
        Map<String, ProviderGroup> onlyold = difference.entriesOnlyOnRight();
        for (Map.Entry<String, ProviderGroup> entry : onlyold.entrySet()) {
            notifyConsumerListeners(entry.getKey(), new ProviderGroup());
        }

        // 新旧都有，而且有变化
        Map<String, ValueDifference<ProviderGroup>> changed = difference.entriesDiffering();
        for (Map.Entry<String, ValueDifference<ProviderGroup>> entry : changed.entrySet()) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("{} has differente", entry.getKey());
            }
            ValueDifference<ProviderGroup> differentValue = entry.getValue();
            ProviderGroup innew = differentValue.leftValue();
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("new(right) is {}", innew);
            }
            // 只通知变化部分内容
            notifyConsumerListeners(entry.getKey(), innew);
        }
    }
1248121
protected function doRouteAfter()
    {
        // 记录匹配的路由信息
        $option = $this->rule->getOption();
        $matches = $this->rule->getVars();

        // 绑定模型数据
        if (!empty($option['model'])) {
            $this->createBindModel($option['model'], $matches);
        }

        // 指定Header数据
        if (!empty($option['header'])) {
            $header = $option['header'];
            $this->app['hook']->add('response_send', function ($response) use ($header) {
                $response->header($header);
            });
        }

        // 指定Response响应数据
        if (!empty($option['response'])) {
            foreach ($option['response'] as $response) {
                $this->app['hook']->add('response_send', $response);
            }
        }

        // 开启请求缓存
        if (isset($option['cache']) && $this->request->isGet()) {
            $this->parseRequestCache($option['cache']);
        }

        if (!empty($option['append'])) {
            $this->request->setRouteVars($option['append']);
        }
    }
24365
public function notify()
    {
        $notice['facId'] = isset($_REQUEST['facId']) ? $_REQUEST['facId'] : '';
        $notice['facMemId'] = isset($_REQUEST['facMemId']) ? $_REQUEST['facMemId'] : '';
        $notice['facTradeSeq'] = isset($_REQUEST['facTradeSeq']) ? $_REQUEST['facTradeSeq'] : '';
        $notice['tradeSeq'] = isset($_REQUEST['tradeSeq']) ? $_REQUEST['tradeSeq'] : '';
        $notice['CardId'] = isset($_REQUEST['CardId']) ? $_REQUEST['CardId'] : '';
        $notice['oProjNo'] = isset($_REQUEST['oProjNo']) ? $_REQUEST['oProjNo'] : '';
        $notice['CardKind'] = isset($_REQUEST['CardKind']) ? $_REQUEST['CardKind'] : '';
        $notice['CardPoint'] = isset($_REQUEST['CardPoint']) ? $_REQUEST['CardPoint'] : '';
        $notice['ReturnMsgNo'] = isset($_REQUEST['ReturnMsgNo']) ? $_REQUEST['ReturnMsgNo'] : '';
        $notice['ErrorMsgNo'] = isset($_REQUEST['ErrorMsgNo']) ? $_REQUEST['ErrorMsgNo'] : '';
        $notice['ErrorMsg'] = isset($_REQUEST['ErrorMsg']) ? $_REQUEST['ErrorMsg'] : '';
        $hash = isset($_REQUEST['hash']) ? $_REQUEST['hash'] : '';

        // 签名验证
        $str = '';
        $str .= $this->config['app_key1'];
        $str .= $notice['facId'];
        $str .= $notice['facMemId'];
        $str .= $notice['facTradeSeq'];
        $str .= $notice['tradeSeq'];
        $str .= $notice['CardId'];
        $str .= $notice['oProjNo'];
        $str .= $notice['CardKind'];
        $str .= $notice['CardPoint'];
        $str .= $notice['ReturnMsgNo'];
        $str .= $notice['ErrorMsgNo'];
        $str .= $notice['ErrorMsg'];
        $str .= $this->config['app_key2'];

        $transactionId = $notice['facTradeSeq'];

        if (hash('sha256', $str) != $hash) {
            throw new DefaultException('sign error');
        }

        $result = [
            'isSuccessful'         => true,
            'message'              => 'success',
            'transactionId'        => $transactionId,
            'transactionReference' => $notice['tradeSeq'],
            'amount'               => $notice['CardPoint'],
            'currency'             => 'TWD',
            'raw'                  => $notice,
        ];
        return $result;
    }