protected function & setHandler (array & $handlers, callable $handler, $priorityIndex = NULL) {
		// there is possible to call any `callable` as closure function in variable
		// except forms like `'ClassName::methodName'` and `['childClassName', 'parent::methodName']`
		// and `[$childInstance, 'parent::methodName']`.
		$closureCalling = (
			(is_string($handler) && strpos($handler, '::') !== FALSE) ||
			(is_array($handler) && strpos($handler[1], '::') !== FALSE)
		) ? FALSE : TRUE;
		if ($priorityIndex === NULL) {
			$handlers[] = [$closureCalling, $handler];
		} else {
			if (isset($handlers[$priorityIndex])) {
				array_splice($handlers, $priorityIndex, 0, [$closureCalling, $handler]);
			} else {
				$handlers[$priorityIndex] = [$closureCalling, $handler];
			}
		}
		/** @var $this \MvcCore\Application */
		return $this;
	}
protected function & setHandler (array & $handlers, callable $handler, $priorityIndex = NULL) {
		// there is possible to call any `callable` as closure function in variable
		// except forms like `'ClassName::methodName'` and `['childClassName', 'parent::methodName']`
		// and `[$childInstance, 'parent::methodName']`.
		$closureCalling = (
			(is_string($handler) && strpos($handler, '::') !== FALSE) ||
			(is_array($handler) && strpos($handler[1], '::') !== FALSE)
		) ? FALSE : TRUE;
		if ($priorityIndex === NULL) {
			$handlers[] = [$closureCalling, $handler];
		} else {
			if (isset($handlers[$priorityIndex])) {
				array_splice($handlers, $priorityIndex, 0, [$closureCalling, $handler]);
			} else {
				$handlers[$priorityIndex] = [$closureCalling, $handler];
			}
		}
		/** @var $this \MvcCore\Application */
		return $this;
	}
protected function & setHandler ( array & $ handlers , callable $ handler , $ priorityIndex = NULL ) { // there is possible to call any `callable` as closure function in variable // except forms like `'ClassName::methodName'` and `['childClassName', 'parent::methodName']` // and `[$childInstance, 'parent::methodName']`. $ closureCalling = ( ( is_string ( $ handler ) && strpos ( $ handler , '::' ) !== FALSE ) || ( is_array ( $ handler ) && strpos ( $ handler [ 1 ] , '::' ) !== FALSE ) ) ? FALSE : TRUE ; if ( $ priorityIndex === NULL ) { $ handlers [ ] = [ $ closureCalling , $ handler ] ; } else { if ( isset ( $ handlers [ $ priorityIndex ] ) ) { array_splice ( $ handlers , $ priorityIndex , 0 , [ $ closureCalling , $ handler ] ) ; } else { $ handlers [ $ priorityIndex ] = [ $ closureCalling , $ handler ] ; } } /** @var $this \MvcCore\Application */ return $ this ; }
Set pre-route, pre-dispatch or post-dispatch handler under specific priority index.
@param array $handlers Application handlers collection reference.
@param callable $handler
@param int|NULL $priorityIndex
@return \MvcCore\Application
Set pre - route pre - dispatch or post - dispatch handler under specific priority index .