<commit_before><?php

namespace Gear\Helpers;

use Gear\Core;
use Gear\Library\GHelper;

/**
 * Хелпер для работы с HTML
 *
 * @package Gear Framework
 * @author <NAME>
 * @copyright 2016 <NAME>
 * @license http://www.spdx.org/licenses/MIT MIT License
 * @since 0.0.1
 * @version 0.0.1
 */
class HHtml extends GHelper
{
    /* Traits */
    /* Const */
    /* Private */
    /* Protected */
    /* Public */

    /**
     * Возвращает сформированный урл
     *
     * @param string $controller
     * @param string $api
     * @param array $params
     * @return string
     * @throws \CoreException
     * @since 0.0.1
     * @version 0.0.1
     */
    public static function helpUrl(string $controller = '', string $api = '', array $params = []): string
    {
        foreach ($params as $name => &$value) {
            $value = "$name=" . urlencode($value);
        }
        unset($value);
        if (Core::app()->controllers->rewrite) {
            $params = implode('&', $params);
            $url = '/' . ($controller ? $controller . '/' : '') . ($api ? "a/$api/" : '') . ($params ? "?$params" : '');
        } else {
            if ($controller) {
                array_unshift($params, "r=$controller" . ($api ? "/a/$api" : ''));
            }
            $params = implode('&', $params);
            $url = '/' . ($params ? "?$params" : '');
        }
        return $url;
    }
}<commit_msg>Fix Html helper<commit_after><?php

namespace Gear\Helpers;

use Gear\Core;
use Gear\Library\GHelper;

/**
 * Хелпер для работы с HTML
 *
 * @package Gear Framework
 * @author <NAME>
 * @copyright 2016 <NAME>
 * @license http://www.spdx.org/licenses/MIT MIT License
 * @since 0.0.1
 * @version 0.0.1
 */
class HHtml extends GHelper
{
    /* Traits */
    /* Const */
    /* Private */
    /* Protected */
    /* Public */

    /**
     * Возвращает сформированный урл
     *
     * @param string $controller
     * @param string $api
     * @param array $params
     * @return string
     * @throws \CoreException
     * @since 0.0.1
     * @version 0.0.1
     */
    public static function helpUrl(string $controller = '', string $api = '', array $params = []): string
    {
        foreach ($params as $name => &$value) {
            $value = "$name=" . urlencode($value);
        }
        unset($value);
        if (Core::app()->{Core::props('routerName')}->rewrite) {
            $params = implode('&', $params);
            $url = '/' . ($controller ? $controller . '/' : '') . ($api ? "a/$api/" : '') . ($params ? "?$params" : '');
        } else {
            if ($controller) {
                array_unshift($params, "r=$controller" . ($api ? "/a/$api" : ''));
            }
            $params = implode('&', $params);
            $url = '/' . ($params ? "?$params" : '');
        }
        return $url;
    }
}
{'fraction_non_alphanumeric': 0.19121813031161472, 'fraction_numerical': 0.0113314447592068, 'mean_word_length': 1.8974358974358974, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3476357', 'n_tokens_mistral': 935, 'n_tokens_neox': 913, 'n_words': 208}