Showing 286 of 512 total issues
Method parsePhpModules
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function parsePhpModules(): array
{
ob_start();
phpinfo(INFO_MODULES);
$s = ob_get_clean();
Method createDialogue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createDialogue(User $user, ?User $author, string $text, bool $withAuthor)
{
$authorId = $author->id ?? 0;
$message = self::query()->create([
Method getLevelByKey
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getLevelByKey(string $level): string
{
switch ($level) {
case self::BOSS:
$status = __('main.boss');
Function editPost
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function editPost(int $id, Request $request, Validator $validator)
{
$page = int($request->input('page'));
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 editItem
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function editItem(int $id, Request $request, Validator $validator)
{
/** @var Item $item */
$item = Item::query()->find($id);
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$type = $this->type;
if ($request->isMethod('post')) {
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
$user = getUser();
if ($user->newchat !== statsNewChat()) {
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function index(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$message = $request->input('message');
$name = $request->input('name');
- 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 delete
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function delete(int $id, Request $request, Validator $validator): RedirectResponse
{
$del = intar($request->input('del'));
$page = int($request->input('page'));
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public static function statAdverts(): array
{
return Cache::remember('adminAdverts', 1800, static function () {
$data = self::query()->where('deleted_at', '>', SITETIME)->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
Function create
has a Cognitive Complexity of 9 (exceeds 5 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')) {
- 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 profile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function profile(Request $request, Validator $validator)
{
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
Function restatement
has a Cognitive Complexity of 9 (exceeds 5 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)');
- 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 view
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function view(int $id, Request $request, Validator $validator)
{
$show = $request->input('show');
/** @var Vote $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
Function edit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! isAdmin(User::BOSS)) {
abort(403, __('errors.forbidden'));
}
- 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 delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function delete(Request $request, Validator $validator): RedirectResponse
{
if (! is_writable(resource_path('views/' . $this->path))) {
abort(200, __('admin.files.directory_not_writable', ['dir' => $this->path]));
}
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
public function edit(int $id, Request $request, Validator $validator)
{
if (! isAdmin(User::BOSS)) {
abort(403, __('errors.forbidden'));
}
- 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 install
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function install(Request $request): RedirectResponse
{
$moduleName = $request->input('module');
$enable = int($request->input('enable'));
$update = int($request->input('update'));
- 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
Avoid deeply nested control flow statements. Open
if ($files->isNotEmpty()) {
foreach ($files as $file) {
$file->delete();
}
}
Avoid deeply nested control flow statements. Open
if ($files->isNotEmpty()) {
foreach ($files as $file) {
$file->delete();
}
}