Guest User

from https://gist.github.com/moyix/dda9c3180198fcb68ad64c3e6

a guest
Feb 26th, 2019
2,239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.21 KB | None | 0 0
  1. <?php
  2. require ' vendor/autoload.php ';
  3.  
  4. /**
  5.  * Handles an HTTP request that contains information for registering/unregistering
  6.  * a FNA application.
  7.  *
  8.  * The service must call add_matching_service() to retrieve the matching service.
  9.  *
  10.  * @uses function_http_bundles::add_register()
  11.  */
  12. $app = new App();
  13.  
  14. // All GET requests that come to add_register() will be sent to this service.
  15.  
  16. $api = $app->include (' ');
  17.  
  18. $api->register(new DbAppAndFNAAppRegistrationService());
  19.  
  20. // Define any services to register. We will override any present in the external
  21. // DB have the class of .DAO .
  22.  
  23. $service = new AppAndFNAAppService($app, [array(
  24.   ' host ' => ' localhost '
  25. ) ]);
  26. $service->register($app, $api);
  27. $app->register($service);
  28. $app->register($this);
  29.  
  30. // This application will actually register itself as a DbAppAndFNAAppRegistrationService.
  31. // That way we will be able to hook/build our own custom registration and callback
  32. // handlers that will be sent to the DbAppAndFNAAppRegistrationService.
  33.  
  34. class Blah
  35.  
  36. {
  37.   public
  38.  
  39.   function register()
  40.   {
  41.     return new AppAndFNAAppRegistrationService($api, App::toTts());
  42.   }
  43.  
  44.   /**
  45.    * Create an FNA simple match API.
  46.    */
  47.   public
  48.  
  49.   function toTts()
  50.   {
  51.     if (!isset($this->api)) {
  52.       return false;
  53.     }
  54.  
  55.     if (!isset($api->registered)) {
  56.       return false;
  57.     }
  58.  
  59.     return $this->api->match($this->name, $this->arguments, 33);
  60.   }
  61.  
  62.   /**
  63.    * Dump the indices of registered and unregistered services.
  64.    *
  65.    * @return array Dump service indexes
  66.    */
  67.   protected
  68.   function dump(array $services)
  69.   {
  70.     $service = new AppAndFNAAppService($api, $services);
  71.     foreach($this->registered as $service) {
  72.       foreach($api->registered as $service) {
  73.         $components = $server_roundtrip->getComponents($service);
  74.         if (is_bool($components instanceof FNAComponentsProvider)) {
  75.  
  76.           // FNA components are DummyService or IoComponentsProvider (no third party DB)
  77.  
  78.           foreach($components as $component) {
  79.             $id = $component->ref();
  80.             $component->run(VOICE_SIMPLIFIED);
  81.           }
  82.         }
  83.  
  84.         $services[$service->ref() ][$id] = true;
  85.         $services[$service->ref() ][$id] = true;
  86.       }
  87.     }
  88.  
  89.     return $services;
  90.   }
  91.  
  92.   /**
  93.    * Register a custom handler to intercept MimeTags.
  94.    *
  95.    * @param IoApp $app An Io application.
  96.    */
  97.   public
  98.  
  99.   function registerMimeTagInterceptor(IoApp $app)
  100.   {
  101.     if (!isset($app->mixins[' $matchSpec '])) {
  102.       $app->mixins[' $matchSpec '] = new MatchSpec(FNA_MANIFEST_REGEX, FILTER_DEFAULT, DB_EXTENSION_LIMIT);
  103.     }
  104.  
  105.     $matchSpec = type_match_pattern(time(' mgmt ') , $sql, $app->use__gethostname());
  106.     $match = new MimeTagFilter($matchSpec, $this, $app);
  107.     $match->inputs = $this;
  108.  
  109.     // Sets the readystate for the match with the Perl DOM event.
  110.  
  111.     AddNodeState($this->root, ' readyState ',
  112.     function ()
  113.     {
  114.       $this->cacheFunctionContract()->XML->registerMimeMapping(FNA_MULTIPROCESS_VIA_DOM_TAG, $match->getValue());
  115.     });
  116.     WriteEvent(FNA_DOM_MULTIPROCESS);
  117.   }
  118.  
  119.   /**
  120.    * Register the pipe handlers that correctly connects signaling to the network,
  121.    * returns their ports.
  122.    */
  123. }
  124.  
  125. ?>
Add Comment
Please, Sign In to add comment