<commit_before><?php
namespace CLMVC\Controllers;


use CLMVC\Core\AoiSoraSettings;

class Views {
    private $controller;

    /**
     * @param BaseController $controller
     */
    public function __construct($controller) {
        $this->controller = $controller;
    }
    /**
     * @param string $controller
     * @param string $action
     * @param string $template
     * @return string Empty string if path is not found.
     */
    public function findView($controller, $action, $template = 'php') {
        if ($this->controller->getViewPath()) {
            if (file_exists(rtrim($this->controller->getViewPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . DIRECTORY_SEPARATOR . $action . '.' . $template))
                return rtrim($this->controller->getViewPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . DIRECTORY_SEPARATOR . $action . '.' . $template;
            if (file_exists(rtrim($this->controller->getViewPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . '-'. $action . '.' . $template))
                return rtrim($this->controller->getViewPath(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . '-' . $action . '.' . $template;
        }
        $apps = AoiSoraSettings::getApplications();
        $lc_controller = strtolower($controller);
        $lc_action = strtolower($action);
        foreach ($apps as $app) {<commit_msg>add View filter for viewpath<commit_after><?php
namespace CLMVC\Controllers;


use CLMVC\Core\AoiSoraSettings;
use CLMVC\Events\Filter;

class Views {
    private $controller;

    /**
     * @param BaseController $controller
     */
    public function __construct($controller) {
        $this->controller = $controller;
    }
    /**
     * @param string $controller
     * @param string $action
     * @param string $template
     * @return string Empty string if path is not found.
     */
    public function findView($controller, $action, $template = 'php') {
        $viewPath = Filter::run("cl-view-path", [$this->controller->getViewPath(), $this->controller, $controller, $action]);
        $viewPath = Filter::run("cl-view-path-{$controller}", [$viewPath, $this->controller, $controller, $action]);
        if ($viewPath) {
            if (file_exists(rtrim($viewPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . DIRECTORY_SEPARATOR . $action . '.' . $template))
                return rtrim($viewPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . DIRECTORY_SEPARATOR . $action . '.' . $template;
            if (file_exists(rtrim($viewPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . '-'. $action . '.' . $template))
                return rtrim($viewPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $controller . '-' . $action . '.' . $template;
        }
        $apps = AoiSoraSettings::getApplications();
        $lc_controller = strtolower($controller);
        $lc_action = strtolower($action);
        foreach ($apps as $app) {
{'fraction_non_alphanumeric': 0.14157824933687002, 'fraction_numerical': 0.0, 'mean_word_length': 3.022666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3711328', 'n_tokens_mistral': 905, 'n_tokens_neox': 872, 'n_words': 184}