Showing 286 of 512 total issues
Method restore
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function restore(Request $request, Validator $validator)
{
if (getUser()) {
setFlash('danger', __('main.already_authorized'));
Method index
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$advert = AdminAdvert::query()
->where('user_id', getUser('id'))
->firstOrNew();
Method handle
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle()
{
$lang1 = $this->argument('lang1');
$lang2 = $this->argument('lang2');
Method delete
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(int $id, Request $request, Validator $validator): RedirectResponse
{
$del = intar($request->input('del'));
$page = int($request->input('page'));
Method dateFixed
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function dateFixed(
DateTimeInterface|int|null $timestamp,
string $format = 'd.m.Y / H:i',
bool $original = false,
): string {
Function uploadFile
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function uploadFile(Request $request, Validator $validator): JsonResponse
{
$imageTypes = [
Article::$morphName,
Item::$morphName,
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$page = int($request->input('page', 1));
$choice = intar($request->input('choice'));
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function create(int $id, Request $request, Validator $validator, Flood $flood): RedirectResponse
{
$msg = $request->input('msg');
if (! $user = getUser()) {
- 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 parsePhpModules
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function parsePhpModules(): array
{
ob_start();
phpinfo(INFO_MODULES);
$s = ob_get_clean();
- 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 makeCalendar
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function makeCalendar(int $month, int $year): array
{
$date = date('w', mktime(0, 0, 0, $month, 1, $year));
if ($date === '0') {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$find = $request->input('find');
$type = $request->input('type') === 'title' ? 'title' : 'text';
$data = collect();
- 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 edit
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator): View|RedirectResponse
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
- 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 index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(): View
{
$count = statsCounter();
$online = statsOnline();
Method index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$find = $request->input('find');
$type = $request->input('type') === 'title' ? 'title' : 'text';
$data = collect();
Method pagination
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pagination(string $url = '/topics'): ?HtmlString
{
if (! $this->count_posts) {
return null;
}
Method users
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function users(string $login): Response
{
$user = getUserByLogin($login);
if (! $user) {
Method edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! isAdmin(User::BOSS)) {
abort(403, __('errors.forbidden'));
}
Method edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! isAdmin(User::BOSS)) {
abort(403, __('errors.forbidden'));
}
Method zip
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function zip(int $id): View
{
/** @var File $file */
$file = File::query()->where('relate_type', Down::$morphName)->find($id);
$down = $file?->relate;
Method edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
$offer = Offer::query()->where('id', $id)->first();
if (! $offer) {