Return a text string representing the selected default expiration for the handler.

@param \core\message\inbound\handler $handler handler instance.

@return string localised text string.
434260
protected function get_defaultexpiration_text(\core\message\inbound\handler $handler) {
        switch($handler->defaultexpiration) {
            case HOURSECS :
                    return get_string('onehour', 'tool_messageinbound');
            case DAYSECS :
                    return get_string('oneday', 'tool_messageinbound');
            case WEEKSECS :
                    return get_string('oneweek', 'tool_messageinbound');
            case YEARSECS :
                    return get_string('oneyear', 'tool_messageinbound');
            case 0:
                    return get_string('noexpiry', 'tool_messageinbound');
            default:
                    return ''; // Should never happen.
        }
    }
1339336
public function setExceptionHandler(callable $handler = null)
    {
        $prev = $this->exceptionHandler;
        $this->exceptionHandler = $handler;

        return $prev;
    }
297658
public function onText($regexp, \Closure $handler)
    {
        $this->managers[] = new Manager(function (Event $event) use ($regexp) {
            return (
                $event instanceof \Viber\Api\Event\Message
                && $event->getMessage() instanceof \Viber\Api\Message\Text
                && preg_match($regexp, $event->getMessage()->getText())
            );
        }, $handler);

        return $this;
    }
108448
public function setHandler(callable $handler = null)
    {
        $old = $this->handler;
        $this->handler = $handler;

        return $old;
    }
914785
public function extractFatalErrorAndCallHandler(IErrorHandler $handler) {
        $error = $this->getLastError();

        if ($error === null) {
            return;
        }

        if ( ! ErrorType::isFatal(array_get($error, 'type'))) {
            return;
        }

        $error = new FatalError(
            array_get($error, 'type'),
            array_get($error, 'message'),
            array_get($error, 'file'),
            array_get($error, 'line')
        );

        return $handler->handleFatalError($error);
    }
1109535
public function getHandler()
    {
        if (!$this->handler) {
            return $this->getDefaultHandler();
        }

        if (is_callable($this->handler)) {
            $this->handler = call_user_func($this->handler);
        }

        return $this->handler;
    }
1172186
protected function resolve(string $handler)
    {
        $handler = $this->split($handler);

        if (is_string($handler)) {
            return function_exists($handler) ? $handler : $this->createClass($handler);
        }

        list($class, $method) = $handler;

        if ((new ReflectionMethod($class, $method))->isStatic()) {
            return $handler;
        }

        return [$this->createClass($class), $method];
    }
1072530
protected static function ttlWithLock($handle): int {
		$content = '';
		while (!feof($handle)) {//循环读取，直至读取完整个文件
			$content .= fread($handle, 1024);
		}
		$expire    = (int)substr($content, 8, 12);
		$filemtime = (int)substr($content, 20, 12);
		$time      = static::getExpire($filemtime, $expire);
		if ($time === 0) {
			return -2;
		}
		return $time;
	}
936076
public static function model( $model, $handler = null ) 
	{
		$model_data = call_user_func( $model.'::_model' );
		return Query::select( $model_data['table'], null, $model_data['handler'] )
			->fetch_handler( $model.'::_fetch_handler' );
	}
1359511
private function fromAtNotation($handler)
    {
        $parts = explode(self::CHAR_AT, $handler);
        if (count($parts) != 2) {
            throw new \InvalidArgumentException('Invalid Class Method format from "at" notation.');
        }
        $this->class = $parts[0];
        $this->method = $parts[1];
    }
1235216
public function otherwise($handler)
	{
		return parent::otherwise(function($request, $error) use ($handler) {
			return $this->injector->invoke(
				Container::getDependencyArray($handler), 
				['Request' => $request, 'Error' => $error]
			);
		});
	}
834276
private function use_default_handler( Logger $logger ) {

		$handler = $this->handlers_registry->find( HandlersRegistry::DEFAULT_NAME );
		if ( ! $handler instanceof HandlerInterface ) {
			return NULL;
		}

		/**
		 * Filters whether to use the default handler.
		 *
		 * @param bool             $use_default_handler
		 * @param Logger           $logger
		 * @param HandlerInterface $handler
		 */
		if ( ! apply_filters( self::FILTER_USE_DEFAULT_HANDLER, TRUE, $logger, $handler ) ) {
			return NULL;
		}

		return $handler;
	}
1165095
public function handler($handler)
    {
        if ($this->formDtoMappingCallback) {
            if (!($handler instanceof IParameterizedActionHandler)) {
                list($handler, $parameterDtoType) = $this->wrapArrayParameterAsDto($handler);
                $handler = new CustomParameterizedActionHandler($handler, $this->returnDtoType, $parameterDtoType);
            }

            /** @var IStagedFormDtoMapping $mapping */
            $mapping = call_user_func($this->formDtoMappingCallback, $handler->getParameterTypeClass());

            call_user_func($this->callback, new ParameterizedAction(
                $this->name,
                $this->authSystem,
                $this->requiredPermissions,
                $mapping,
                $handler,
                $this->metadata
            ));
        } else {

            if (!($handler instanceof IUnparameterizedActionHandler)) {
                $handler = new CustomUnparameterizedActionHandler($handler, $this->returnDtoType);
            }

            call_user_func($this->callback, new UnparameterizedAction(
                $this->name,
                $this->authSystem,
                $this->requiredPermissions,
                $handler,
                $this->metadata
            ));
        }
    }
1143895
public function setExecutableByHandler($handler)
    {
        list($controller_name, $action_name) = $this->app->getControllerByHandler($handler);
        $controller = $this->app->createController($controller_name);

        $this->setExecutable([$controller, $action_name]);

        return $this;
    }
476445
private function parser($handler)
    {
        $parts = explode('://', $handler);
        if (count($parts) === 2) {
            $namespace = $parts[0];
            array_shift($parts);
        } else {
            $namespace = $this->app['upload.namespace'];
        }
        $prefix = rtrim($parts[0], '/') . '/';

        return [$namespace, $prefix];
    }
1278727
public static function last( $table, $key = null, $handler = null ) 
	{
		return Query::select( $table )->last( $key, $handler );
	}
545604
public function onStyleLoaderTag($tag, $handle): string
    {
        $tag    = (string) $tag;
        $handle = (string) $handle;

        if (!($style = $this->didEnqueueStyle($handle))) {
            return $tag; // We did not enqueue this style.
        }
        if ($style['sri'] !== '' && !preg_match('/\sintegrity\s*\=/ui', $tag)) {
            if (($sri = $style['sri']) || ($sri = $this->c::sri($style['url']))) {
                $tag = str_replace(' rel=', ' integrity="'.esc_attr($sri).'" crossorigin="anonymous" rel=', $tag);
            } // NOTE: SRI may or may not be possible right now. Always check if `$sri` is non-empty.
            // NOTE: `c::sri()` also will not return an SRI for local resources on the current hostname.
        }
        return $tag; // Possibly modifed above.
    }