1 | <?php |
||||
2 | |||||
3 | use Ffcms\Core\Helper\Date; |
||||
4 | use Ffcms\Core\Helper\Simplify; |
||||
5 | use Ffcms\Templex\Url\Url; |
||||
0 ignored issues
–
show
|
|||||
6 | |||||
7 | /** @var \Apps\ActiveRecord\CommentPost $record */ |
||||
8 | /** @var \Ffcms\Templex\Template\Template $this */ |
||||
9 | |||||
10 | $this->layout('_layouts/default', [ |
||||
11 | 'title' => __('View comment'), |
||||
12 | 'breadcrumbs' => [ |
||||
13 | Url::to('main/index') => __('Main'), |
||||
14 | Url::to('widget/index') => __('Widgets'), |
||||
15 | Url::to('comments/index') => __('Comments'), |
||||
16 | __('View comment') |
||||
17 | ] |
||||
18 | ]); |
||||
19 | ?> |
||||
20 | |||||
21 | <?php $this->start('body') ?> |
||||
22 | |||||
23 | <?= $this->insert('comments/_tabs') ?> |
||||
0 ignored issues
–
show
Are you sure the usage of
$this->insert('comments/_tabs') targeting League\Plates\Template\Template::insert() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
Loading history...
|
|||||
24 | |||||
25 | <h1><?= __('Read comment #%id%', ['id' => $record->id]) ?></h1> |
||||
26 | <div class="card"> |
||||
27 | <div class="card-header"> |
||||
28 | <?php |
||||
29 | $author = Simplify::parseUserNick($record->user_id, $record->guest_name); |
||||
30 | if ($record->user_id > 0) { |
||||
31 | $author = Url::a(['user/update', [$record->user_id]], $author); |
||||
0 ignored issues
–
show
It seems like
$author can also be of type null ; however, parameter $text of Ffcms\Templex\Url\Url::a() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
32 | } |
||||
33 | ?> |
||||
34 | <?= $author . ', ' . Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR) ?> |
||||
0 ignored issues
–
show
Are you sure
Ffcms\Core\Helper\Date::...r\Date::FORMAT_TO_HOUR) of type false|string can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
35 | <div class="pull-right"> |
||||
36 | <?php |
||||
37 | $btngrp = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']); |
||||
38 | if ($record->moderate) { |
||||
39 | $btngrp->add('<i class="fa fa-eye"></i>', ['comments/publish', ['comment', $record->id]], ['class' => 'btn btn-success', 'html' => true]); |
||||
40 | } |
||||
41 | $btngrp->add('<i class="fa fa-pencil"></i>', ['comments/edit', ['comment', $record->id]], ['class' => 'btn btn-primary', 'html' => true]); |
||||
42 | $btngrp->add('<i class="fa fa-trash-o"></i>', ['comments/delete', ['comment', $record->id]], ['class' => 'btn btn-danger', 'html' => true]); |
||||
43 | echo $btngrp->display(); |
||||
44 | ?> |
||||
45 | </div> |
||||
46 | </div> |
||||
47 | <div class="card-body<?= ((bool)$record->moderate ? ' text-warning' : null) ?>"> |
||||
48 | <?= $record->message ?> |
||||
49 | </div> |
||||
50 | </div> |
||||
51 | <?php |
||||
52 | /** @var \Apps\ActiveRecord\CommentAnswer[]|\Illuminate\Support\Collection $answers */ |
||||
53 | $answers = $record->answers; |
||||
54 | if (!$answers || $answers->count() < 1) { |
||||
55 | $this->stop(); |
||||
56 | return null; |
||||
57 | } |
||||
58 | ?> |
||||
59 | |||||
60 | <h2><?= __('Comment answers') ?></h2> |
||||
61 | <?php foreach ($answers as $answer):?> |
||||
62 | <div class="card" id="answer-<?= $answer->id ?>"> |
||||
63 | <div class="card-header"> |
||||
64 | <?php |
||||
65 | $answerAuthor = Simplify::parseUserLink($answer->user_id, $answer->guest_name, 'user/update'); |
||||
66 | ?> |
||||
67 | <?= $answerAuthor . ', ' . Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |
||||
0 ignored issues
–
show
Are you sure
Ffcms\Core\Helper\Date::...r\Date::FORMAT_TO_HOUR) of type false|string can be used in concatenation ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
68 | <div class="pull-right"> |
||||
69 | <?php |
||||
70 | $btngrp = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']); |
||||
71 | if ($answer->moderate) { |
||||
72 | $btngrp->add('<i class="fa fa-eye"></i>', ['comments/publish', ['answer', $answer->id]], ['class' => 'btn btn-success', 'html' => true]); |
||||
73 | } |
||||
74 | $btngrp->add('<i class="fa fa-pencil"></i>', ['comments/edit', ['answer', $answer->id]], ['class' => 'btn btn-primary', 'html' => true]); |
||||
75 | $btngrp->add('<i class="fa fa-trash-o"></i>', ['comments/delete', ['answer', $answer->id]], ['class' => 'btn btn-danger', 'html' => true]); |
||||
76 | echo $btngrp->display(); |
||||
77 | ?> |
||||
78 | </div> |
||||
79 | </div> |
||||
80 | <div class="card-body<?= ((bool)$answer->moderate ? ' text-warning' : null)?>"> |
||||
81 | <?= $answer->message ?> |
||||
82 | </div> |
||||
83 | </div> |
||||
84 | <?php endforeach; ?> |
||||
85 | |||||
86 | <?php $this->stop() ?> |
||||
87 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: