Implements hook "dashboard.handlers"
@param array $handlers
508316
public function hookDashboardHandlers(array &$handlers)
    {
        $weight = count($handlers);
        $model = $this->getModel();
        $settings = $this->module->getSettings('ga_report');

        foreach ($model->getHandlers() as $id => $handler) {

            if (!in_array($id, $settings['dashboard'])) {
                continue;
            }

            $weight++;

            $report = $model->get($handler, $settings);

            $handlers["ga_$id"] = array(
                'status' => true,
                'weight' => $weight,
                'title' => $handler['name'],
                'template' => $handler['template'],
                'handlers' => array(
                    'data' => function () use ($handler, $report, $settings) {
                        return array(
                            'report' => $report,
                            'handler' => $handler,
                            'settings' => $settings
                        );
                    }
                )
            );
        }
    }
191729
def _add_static_handlers(self, handlers):
        
        for url, path in self.static_dirs:
            handlers.append((url.rstrip("/") + "/(.*)", StaticFileHandler, {"path": path}))
1150391
protected function loadHooks(array $services)
    {
        foreach ($services as $service => $value) {
            if (!isset($value[ 'hooks' ])) {
                continue;
            }
            foreach ($value[ 'hooks' ] as $key => $hook) {
                $this->hooks[ $key ][ $service ] = $hook;
            }
        }
    }
906161
public function ProcessCustomHandlers (& $handlers = []) {
		if (!$handlers || $this->request->IsInternalRequest() === TRUE) return TRUE;
		$result = TRUE;
		foreach ($handlers as $handlerRecord) {
			list ($closureCalling, $handler) = $handlerRecord;
			$subResult = NULL;
			try {
				if ($closureCalling) {
					$subResult = $handler($this->request, $this->response);
				} else {
					$subResult = call_user_func($handler, $this->request, $this->response);
				}
				if ($subResult === FALSE) {
					$result = FALSE;
					break;
				}
			} catch (\Exception $e) {
				$this->DispatchException($e);
				$result = FALSE;
				break;
			}
		}
		return $result;
	}
964821
function mountHandlers() {
  var self = this;

  for (var id in this.handlers) {
    this.handlers[id].forEach(function(handler) {
      self.namespace.on(id, handler);
    });
  }
}
918358
public function add_events( array $stops ): void {

		$this->events = array_merge( $this->events, $stops );

		/**
		 * @var int|string $key
		 * @var array      $data
		 */
		foreach ( $stops as $key => $data ) {

			if ( is_int( $key ) ) {
				/** @var array{0:string} $data */
				$this->add_event( ...$data );
				continue;
			}

			/** @var int $priority */
			foreach ( array_keys( $data ) as $priority ) {
				add_action( $key, [ $this, 'tick' ], $priority );
			}
		}
	}
418735
private function setPrefixes( array $prefixes ) {
		foreach ( $prefixes as $prefix => $iri ) {
			$this->expressionValidator->validate( $prefix, ExpressionValidator::VALIDATE_PREFIX );
			$this->expressionValidator->validate( $iri, ExpressionValidator::VALIDATE_IRI );

			$this->prefixes[$prefix] = $iri;
		}

		$this->usageValidator->trackDefinedPrefixes( array_keys( $this->prefixes ) );
	}
41644
public function setEvents(array $events)
	{
		if ($events) {
			$this->ensureEvents();
			
			foreach ($events as $name => $handler) {
				$this->on($name, $handler);
			}
		}
	}
1277523
protected function init_handlers() {
		$keys = [ self::KEY_SCRIPTS, self::KEY_STYLES ];
		foreach ( $keys as $key ) {
			if ( $this->hasConfigKey( $key ) ) {
				$this->add_handler( $key );
			}
		}
	}
46879
function getHandlers(handlers) {
        if (typeof handlers === 'string') {
          prev[c.script].handlers.push(handlers)
        } else if (Array.isArray(c.handlers)) {
          c.handlers.forEach(h => {
            prev[c.script].handlers.push(h)
          })
        } else {
          Object.keys(handlers).forEach(k => getHandlers(handlers[k]))
        }
      }
527144
public static function call($handlers, $handler_id, $method, $arguments = array())
    {
        $callback = static::get($handlers, $handler_id, $method);
        return call_user_func_array($callback, $arguments);
    }
1338969
public function registerListeners(array $listeners)
    {
        foreach ($listeners as $event => $listener) {
            $this->events[$event][] = $listener;
        }
    }
396342
protected function call_handler($name, array $params = array())
    {
        if(array_key_exists($name,$this->call_handlers)) {
            go(function () use ($name, $params) {
                sd_call_user_func_array($this->call_handlers[$name], $params);
            });
        }
    }
1255784
public static function handlers($handlers = [], $append = true)
    {
        if (!func_num_args()) {
            return static::$_handlers;
        }
        if ($append) {
            static::$_handlers = array_merge(static::$_handlers, $handlers);
        } else {
            static::$_handlers = $handlers;
        }
        return static::handlers();
    }
447730
public function init( $config = [ ] )
    {
        $handlers = array_values( $config[ 'handlers' ] );

        foreach ( $handlers as $conf )
        {
            $class = $conf[ 'class' ];

            $handler = new $class( $conf );

            $this->addHandler( $handler );
        }
    }
109583
public function messageinbound_handlers_table(array $handlers) {
        global $CFG;

        $table = new html_table();
        $handlername = new html_table_cell(get_string('name', 'tool_messageinbound') . "\n" .
                html_writer::tag('span', get_string('classname', 'tool_messageinbound'), array('class' => 'handler-function')));

        // Prepare some of the rows with additional styling.
        $enabled = new html_table_cell(get_string('enabled', 'tool_messageinbound'));
        $enabled->attributes['class'] = 'state';
        $edit = new html_table_cell(get_string('edit', 'tool_messageinbound'));
        $edit->attributes['class'] = 'edit';
        $table->head  = array(
                $handlername,
                get_string('description', 'tool_messageinbound'),
                $enabled,
                $edit,
            );
        $table->attributes['class'] = 'admintable generaltable messageinboundhandlers';

        $yes = get_string('yes');
        $no = get_string('no');

        $data = array();

        // Options for description formatting.
        $descriptionoptions = new stdClass();
        $descriptionoptions->trusted = false;
        $descriptionoptions->noclean = false;
        $descriptionoptions->smiley = false;
        $descriptionoptions->filter = false;
        $descriptionoptions->para = true;
        $descriptionoptions->newlines = false;
        $descriptionoptions->overflowdiv = true;

        $editurlbase = new moodle_url('/admin/tool/messageinbound/index.php');
        foreach ($handlers as $handler) {
            $handlername = new html_table_cell($handler->name . "\n" .
                    html_writer::tag('span', $handler->classname, array('class' => 'handler-function')));
            $handlername->header = true;

            $editurl = new moodle_url($editurlbase, array('classname' => $handler->classname));
            $editlink = $this->action_icon($editurl, new pix_icon('t/edit',
                    get_string('edithandler', 'tool_messageinbound', $handler->classname)));

            // Prepare some of the rows with additional styling.
            $enabled = new html_table_cell($handler->enabled ? $yes : $no);
            $enabled->attributes['class'] = 'state';
            $edit = new html_table_cell($editlink);
            $edit->attributes['class'] = 'edit';

            // Add the row.
            $row = new html_table_row(array(
                        $handlername,
                        format_text($handler->description, FORMAT_MARKDOWN, $descriptionoptions),
                        $enabled,
                        $edit,
                    ));

            if (!$handler->enabled) {
                $row->attributes['class'] = 'disabled';
            }
            $data[] = $row;
        }
        $table->data = $data;
        return html_writer::table($table);
    }
539179
public function setHandlers($handlers)
    {
        $this->handlers = $handlers;
        $this->setKey($this->getKey());

        return $this;
    }