Showing 512 of 512 total issues
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) {
Method edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
$page = int($request->input('page', 1));
$link = Advert::query()->find($id);
Method edit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
$page = int($request->input('page', 1));
if (! $user = getUser()) {
Method restatement
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function restatement(string $mode)
{
switch ($mode) {
case 'forums':
DB::update('update topics set count_posts = (select count(*) from posts where topics.id = posts.topic_id)');
Method close
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function close(int $id, Request $request, Validator $validator): RedirectResponse
{
if (! $user = getUser()) {
abort(403, __('main.not_authorized'));
}
Method create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$type = $request->input('type');
$name = $request->input('name');