Showing 286 of 512 total issues
Method dialogues
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function dialogues(Request $request): Response
{
/** @var User $user */
$user = $request->attributes->get('user');
Method edit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function edit(int $id, Request $request, Validator $validator)
{
$vote = Vote::query()->where('id', $id)->first();
if (! $vote) {
Method createSticker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function createSticker(Request $request, Validator $validator)
{
$cid = int($request->input('cid'));
$categories = StickersCategory::query()->get();
Method add
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function add(Request $request, Validator $validator, Flood $flood): RedirectResponse
{
$msg = $request->input('msg');
$user = getUser();
Method ban
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function ban(Request $request, Validator $validator)
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method editItem
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function editItem(int $id, Request $request, Validator $validator)
{
/** @var Item $item */
$item = Item::query()->find($id);
Method comments
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function comments(int $id, Request $request, Validator $validator, Flood $flood)
{
/** @var News $news */
$news = News::query()->find($id);
Method forums
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function forums(int $id): Response
{
/** @var Forum $forum */
$forum = Forum::query()->find($id);
Method userlist
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function userlist(Request $request)
{
$type = check($request->input('type', 'users'));
$sort = check($request->input('sort', 'point'));
$user = $request->input('user', getUser('login'));
Method edit
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function edit(int $id, Request $request, Validator $validator)
{
/** @var News $news */
$news = News::query()->find($id);
$page = int($request->input('page', 1));
Method comments
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function comments(int $id, Request $request, Validator $validator, Flood $flood): View|RedirectResponse
{
/** @var Down $down */
$down = Down::query()->find($id);
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function create(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$title = $request->input('title');
$text = $request->input('text');
Method vote
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function vote(int $id, Request $request, Validator $validator): RedirectResponse
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Function icons
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
function icons(string $ext): HtmlString
{
switch ($ext) {
case 'php':
$ico = 'fa-regular fa-file-code';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method zipView
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function zipView(int $id, int $fid): View
{
/** @var File $file */
$file = File::query()->where('relate_type', Down::$morphName)->find($id);
$down = $file?->relate;
Method comments
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function comments(int $id, Request $request, Validator $validator, Flood $flood)
{
/** @var Photo $photo */
$photo = Photo::query()->find($id);
Method topic
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function topic(int $id): View
{
$topic = Topic::query()->where('id', $id)->with('forum.parent')->first();
if (! $topic) {
Method surprise
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function surprise(): RedirectResponse
{
$money = mt_rand(10000, 50000);
$point = mt_rand(150, 250);
$rating = mt_rand(3, 10);
Method editPost
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function editPost(int $id, Request $request, Validator $validator)
{
$page = int($request->input('page'));
if (! $user = getUser()) {
Method index
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function index(Request $request, Validator $validator)
{
$type = $this->type;
if ($request->isMethod('post')) {