public static function isParity($value, array $params, Template $template)
    {
        if (empty($params) || count($params) < 1 || !isset($params['then'])) {
            throw new TemplateException(TemplateException::UNKNOWN_PARAM_FILTER, ['name' => __METHOD__]);
        }
        $params['else'] = isset($params['else']) ? $params['else'] : null;
        $template = clone $template;
        $placeholders = [];
        $placeholders['output'] = $value;

        return NumericHelper::isParity($value)
            ? $template->replace($params['then'], $placeholders)
            : $template->replace($params['else'], $placeholders);
    }