Showing 286 of 512 total issues
Function file
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function file(?UploadedFile $input, array $rules, $label, bool $required = true): Validator
{
if (! $required && blank($input)) {
return $this;
}
- 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 profile
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function profile(Request $request, Validator $validator)
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method edit
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
{
$cid = int($request->input('category'));
/** @var Down $down */
Method generateLogin
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateLogin($network, string $delimiter = '-'): ?string
{
$firstName = ucfirst(Str::slug($network->first_name, $delimiter));
$lastName = ucfirst(Str::slug($network->last_name, $delimiter));
$firstLetter = $firstName[0];
Function edit
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
$vote = Vote::query()->where('id', $id)->first();
if (! $vote) {
- 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 icons
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
function icons(string $ext): HtmlString
{
switch ($ext) {
case 'php':
$ico = 'fa-regular fa-file-code';
File BBCode.php
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace App\Classes;
File admin.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
return [
'antimat' => [
'text' => '
File admin.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
return [
'antimat' => [
'text' => '
File admin.php
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
return [
'antimat' => [
'text' => '
ArticleController
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ArticleController extends Controller
{
/**
* Главная страница
*/
Method create
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
{
$cid = int($request->input('cid'));
if (! isAdmin() && ! setting('blog_create')) {
Method key
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function key(Request $request, Validator $validator)
{
/* @var User $user */
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
Function index
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$act = $request->input('act', 'mains');
if (! in_array($act, Setting::getActions(), true)) {
- 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
Function getFeed
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function getFeed(): HtmlString
{
$polls = [];
$collect = new Collection();
- 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 create
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood)
{
$bid = int($request->input('bid'));
if (! $user = getUser()) {
Method talk
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function talk(string $login, Request $request): Response
{
/** @var User $user */
$user = $request->attributes->get('user');
Method create
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
if ($this->user->point < setting('rekuserpoint')) {
abort(200, __('adverts.advert_point', ['point' => plural(50, setting('scorename'))]));
}
Method up
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function up(): void
{
if (! Schema::hasTable('users')) {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
Method create
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$sheets = check($request->input('sheets'));
$method = $request->input('method');