Showing 286 of 512 total issues
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');
Method delComment
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delComment(Request $request, Validator $validator): JsonResponse
{
if (! isAdmin()) {
return response()->json([
'success' => false,
Method newMessages
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function newMessages(Request $request): Response
{
if (! $request->ajax()) {
return redirect('/');
}
Method editSticker
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function editSticker(int $id, Request $request, Validator $validator)
{
/** @var Sticker $sticker */
$sticker = Sticker::query()->find($id);
$page = int($request->input('page', 1));
Method getCounter
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCounter(int $online): void
{
$counter = $this->getResultCounter();
if (! $counter) {
Method edit
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function edit(Request $request, Validator $validator)
{
$id = int($request->input('id'));
$status = Status::query()->find($id);
Method moveArticle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function moveArticle(int $id, Request $request, Validator $validator)
{
/** @var Article $article */
$article = Article::query()->find($id);
Method moveTopic
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function moveTopic(int $id, Request $request, Validator $validator)
{
/** @var Topic $topic */
$topic = Topic::query()->find($id);
Method edit
has 28 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 reply
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function reply(int $id, Request $request, Validator $validator)
{
$offer = Offer::query()->where('id', $id)->first();
if (! $offer) {
Method searchTag
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchTag(string $tag, Request $request): View|RedirectResponse
{
$tag = urldecode($tag);
if (! isUtf($tag)) {
Function index
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function index(int $id): View
{
$user = getUser();
$topic = Topic::query()
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
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 editTopic
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function editTopic(int $id, Request $request, Validator $validator)
{
/** @var Topic $topic */
$topic = Topic::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 edit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function edit(Request $request, Validator $validator)
{
$user = User::query()->where('login', $request->input('user'))->with('lastBan')->first();
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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function create(Request $request, Validator $validator)
{
if ($request->isMethod('post')) {
$title = $request->input('title');
$text = $request->input('text');
- 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"