<commit_before><?php

namespace Coyote\Http\Controllers\Forum;

use Coyote\Http\Factories\FlagFactory;
use Coyote\Http\Factories\GateFactory;
use Coyote\Repositories\Contracts\ForumRepositoryInterface as ForumRepository;
use Coyote\Repositories\Contracts\TopicRepositoryInterface as TopicRepository;
use Coyote\Repositories\Contracts\PostRepositoryInterface as PostRepository;
use Coyote\Repositories\Contracts\UserRepositoryInterface;
use Coyote\Repositories\Criteria\Topic\BelongsToForum;
use Coyote\Repositories\Criteria\Topic\OnlyMine;
use Coyote\Repositories\Criteria\Topic\SkipLockedCategories;
use Coyote\Repositories\Criteria\Topic\Subscribes;
use Coyote\Repositories\Criteria\Topic\Unanswered;
use Coyote\Repositories\Criteria\Topic\OnlyThoseWithAccess;
use Coyote\Repositories\Criteria\Topic\WithTags;
use Illuminate\Http\Request;
use Lavary\Menu\Item;
use Lavary\Menu\Menu;
use Lavary\Menu\Builder;

class HomeController extends BaseController
{
    use GateFactory, FlagFactory;

    /**
     * @var Builder
     */
    private $tabs;

    /**
     * @param ForumRepository $forum
     * @param TopicRepository $topic
     * @param PostRepository $post
     */
    public function __construct(ForumRepository $forum, TopicRepository $topic, PostRepository $post)
    {
        parent::__construct($forum, $topic, $post);

        $this->tabs = app(Menu::class)->make('_forum', function (Builder $menu) {
            foreach (config('laravel-menu._forum') as $title => $row) {
                $data = array_pull($row, 'data');
                $menu->add($title, $row)->data($data);
            }
        })
        ->filter(function (Item $item) {
            if ($item->data('role') === true) {
                return $this->userId !== null;
            }

            return true;
        });

        $this->middleware(function (Request $request, $next) {
            // currently selected tab
            list(, $suffix) = explode('.', $request->route()->getName());

            if (in_array($suffix, ['categories', 'all', 'unanswered', 'subscribes', 'mine', 'interesting'])) {
                $this->setSetting('forum.tab', $suffix);
            }

            return $next($request);
        });
    }

    /**
     * @param string $view
     * @param array $data
     * @return \Illuminate\View\View
     */<commit_msg>bugfix: brakujace zakladki<commit_after><?php

namespace Coyote\Http\Controllers\Forum;

use Coyote\Http\Factories\FlagFactory;
use Coyote\Http\Factories\GateFactory;
use Coyote\Repositories\Contracts\ForumRepositoryInterface as ForumRepository;
use Coyote\Repositories\Contracts\TopicRepositoryInterface as TopicRepository;
use Coyote\Repositories\Contracts\PostRepositoryInterface as PostRepository;
use Coyote\Repositories\Contracts\UserRepositoryInterface;
use Coyote\Repositories\Criteria\Topic\BelongsToForum;
use Coyote\Repositories\Criteria\Topic\OnlyMine;
use Coyote\Repositories\Criteria\Topic\SkipLockedCategories;
use Coyote\Repositories\Criteria\Topic\Subscribes;
use Coyote\Repositories\Criteria\Topic\Unanswered;
use Coyote\Repositories\Criteria\Topic\OnlyThoseWithAccess;
use Coyote\Repositories\Criteria\Topic\WithTags;
use Illuminate\Http\Request;
use Lavary\Menu\Item;
use Lavary\Menu\Menu;
use Lavary\Menu\Builder;

class HomeController extends BaseController
{
    use GateFactory, FlagFactory;

    /**
     * @var Builder
     */
    private $tabs;

    /**
     * @param ForumRepository $forum
     * @param TopicRepository $topic
     * @param PostRepository $post
     */
    public function __construct(ForumRepository $forum, TopicRepository $topic, PostRepository $post)
    {
        parent::__construct($forum, $topic, $post);

        $this->tabs = app(Menu::class)->make('_forum', function (Builder $menu) {
            foreach (config('laravel-menu._forum') as $title => $row) {
                $data = array_pull($row, 'data');
                $menu->add($title, $row)->data($data);
            }
        });

        $this->middleware(function (Request $request, $next) {
            $this->tabs->filter(function (Item $item) {
                if ($item->data('role') === true) {
                    return $this->userId !== null;
                }

                return true;
            });

            // currently selected tab
            list(, $suffix) = explode('.', $request->route()->getName());

            if (in_array($suffix, ['categories', 'all', 'unanswered', 'subscribes', 'mine', 'interesting'])) {
                $this->setSetting('forum.tab', $suffix);
            }

            return $next($request);
        });
    }

    /**
     * @param string $view
     * @param array $data
     * @return \Illuminate\View\View
     */
{'fraction_non_alphanumeric': 0.13182395260262378, 'fraction_numerical': 0.0, 'mean_word_length': 2.9689336691855583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '2357986', 'n_tokens_mistral': 1426, 'n_tokens_neox': 1354, 'n_words': 264}