phpffcms /
ffcms
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use Ffcms\Core\Helper\Date; |
||
| 4 | use Ffcms\Core\Helper\HTML\Form; |
||
| 5 | use Ffcms\Core\Helper\HTML\Table; |
||
| 6 | use Ffcms\Core\Helper\Type\Str; |
||
| 7 | use Ffcms\Core\Helper\Url; |
||
| 8 | |||
| 9 | /** @var $model Apps\Model\Front\Profile\FormIgnoreAdd */ |
||
| 10 | /** @var $this object */ |
||
| 11 | /** @var $records Apps\ActiveRecord\Blacklist */ |
||
| 12 | /** @var $pagination object */ |
||
| 13 | |||
| 14 | $this->title = __('Blacklist'); |
||
| 15 | |||
| 16 | $this->breadcrumbs = [ |
||
| 17 | Url::to('main/index') => __('Home'), |
||
| 18 | Url::to('profile/show', \App::$User->identity()->getId()) => __('Profile'), |
||
| 19 | __('Blacklist') |
||
| 20 | ]; |
||
| 21 | |||
| 22 | ?> |
||
| 23 | |||
| 24 | <?= $this->render('profile/_settingsTab') ?> |
||
| 25 | |||
| 26 | <h2><?= __('Add user ignore') ?></h2> |
||
| 27 | <hr /> |
||
| 28 | <?php $form = new Form($model, ['class' => 'form-horizontal', 'action' => '', 'method' => 'post']) ?> |
||
| 29 | |||
| 30 | <?= $form->start() ?> |
||
|
0 ignored issues
–
show
|
|||
| 31 | |||
| 32 | <?= $form->field('id', 'text', ['class' => 'form-control'], __('Enter id of user who you want to block')) ?> |
||
| 33 | <?= $form->field('comment', 'text', ['class' => 'form-control'], __('Remark memo about this block')) ?> |
||
| 34 | |||
| 35 | <div class="col-md-9 col-md-offset-3"><?= $form->submitButton(__('Block'), ['class' => 'btn btn-danger']) ?></div> |
||
| 36 | |||
| 37 | <?= $form->finish() ?> |
||
| 38 | |||
| 39 | <h2><?= __('List of blocked users') ?></h2> |
||
| 40 | <hr /> |
||
| 41 | <?php if ($records !== null && $records->count() > 0): ?> |
||
| 42 | <?php |
||
| 43 | $items = []; |
||
| 44 | foreach ($records as $row) { |
||
| 45 | $userProfile = $row->getUser()->getProfile(); |
||
| 46 | $userNick = Str::likeEmpty($userProfile->nick) ? __('No name') : \App::$Security->strip_tags($userProfile->nick); |
||
| 47 | $items[] = [ |
||
| 48 | ['text' => Url::link(['profile/show', $row->target_id], $userNick, ['target' => '_blank']), 'html' => true], |
||
|
0 ignored issues
–
show
It seems like
$userNick defined by \Ffcms\Core\Helper\Type\...ags($userProfile->nick) on line 46 can also be of type array; however, Ffcms\Core\Helper\Url::link() does only seem to accept string, maybe add an additional type check?
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check: /**
* @return array|string
*/
function returnsDifferentValues($x) {
if ($x) {
return 'foo';
}
return array();
}
$x = returnsDifferentValues($y);
if (is_array($x)) {
// $x is an array.
}
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue. Loading history...
|
|||
| 49 | ['text' => $row->comment], |
||
| 50 | ['text' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_DAY)], |
||
| 51 | ['text' => Url::link(['profile/unblock', $row->target_id], '<i class="fa fa-times"></i>'), 'html' => true, 'property' => ['class' => 'text-center']] |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | ?> |
||
| 55 | |||
| 56 | |||
| 57 | <?= Table::display([ |
||
| 58 | 'table' => ['class' => 'table table-bordered'], |
||
| 59 | 'thead' => [ |
||
| 60 | 'titles' => [ |
||
| 61 | ['text' => __('User')], |
||
| 62 | ['text' => __('Comment')], |
||
| 63 | ['text' => __('Add date')], |
||
| 64 | ['text' => __('Actions')] |
||
| 65 | ] |
||
| 66 | ], |
||
| 67 | 'tbody' => [ |
||
| 68 | 'items' => $items |
||
| 69 | ] |
||
| 70 | ]); ?> |
||
| 71 | <div class="text-center"> |
||
| 72 | <?= $pagination->display(['class' => 'pagination pagination-centered']) ?> |
||
| 73 | </div> |
||
| 74 | <?php else: ?> |
||
| 75 | <p><?= __('No users in blacklist!') ?></p> |
||
| 76 | <?php endif ?> |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.