Showing 286 of 512 total issues
Method view
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function view(int $id, Request $request, Validator $validator)
{
$show = $request->input('show');
/** @var Vote $vote */
Function index
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$msg = $request->input('msg');
$type = int($request->input('type'));
- 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 handle
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function handle()
{
$lang1 = $this->argument('lang1');
$lang2 = $this->argument('lang2');
- 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 account
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function account(Request $request, Validator $validator)
{
$lang = $request->input('lang', 'ru');
$login = $request->input('login');
$password = $request->input('password');
Method getFeed
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFeed(): HtmlString
{
$polls = [];
$collect = new Collection();
Method index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(string $login, Request $request, Validator $validator)
{
$vote = $request->input('vote');
$user = getUserByLogin($login);
Method complaint
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function complaint(Request $request, Validator $validator): JsonResponse
{
$path = null;
$model = false;
$id = int($request->input('id'));
Method index
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$act = $request->input('act', 'mains');
if (! in_array($act, Setting::getActions(), true)) {
Method edit
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(Request $request, Validator $validator)
{
$user = User::query()->where('login', $request->input('user'))->with('lastBan')->first();
if (! $user) {
Method uploadFile
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function uploadFile(UploadedFile $file, bool $record = true): array
{
$mime = $file->getClientMimeType();
$extension = strtolower($file->getClientOriginalExtension());
$basename = getBodyName($file->getClientOriginalName());
Method edit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method edit
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method create
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator, Flood $flood)
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method edit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
{
$places = PaidAdvert::PLACES;
/** @var PaidAdvert $advert */
Function edit
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function edit(Request $request, Validator $validator): View|RedirectResponse
{
$user = getUserByLogin($request->input('user'));
if (! $user) {
- 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 index
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function index(string $login, Request $request, Validator $validator)
{
$vote = $request->input('vote');
$user = getUserByLogin($login);
- 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 statAdverts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function statAdverts(): array
{
return Cache::remember('paidAdverts', 3600, static function () {
$data = self::query()->where('deleted_at', '>', SITETIME)->orderBy('created_at')->get();
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator): View|RedirectResponse
{
$places = PaidAdvert::PLACES;
$advert = new PaidAdvert();
$place = $request->input('place');
Method index
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$user = getUser();
if ($user->newchat !== statsNewChat()) {
Method actionTopic
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function actionTopic(int $id, Request $request): RedirectResponse
{
$page = int($request->input('page', 1));
/** @var Topic $topic */