Passed
Push — master ( 6084dc...68443e )
by Mihail
05:40
created

Apps/View/Front/default/profile/wall_delete.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

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\Url;
6
7
/** @var $post Apps\ActiveRecord\WallPost */
8
/** @var $model Apps\Model\Front\FormWallPostDelete */
9
10
$this->title = __('Delete post');
11
12
$this->breadcrumbs = [
13
    Url::to('main/index') => __('Home'),
14
    Url::to('profile/index') => __('Users'),
15
    __('Delete post')
16
];
17
18
?>
19
<h1><?= __('Delete wall post') ?></h1>
20
<hr />
21
<p><?= __('Are you sure to delete this post? No more attention will be displayed!') ?></p>
22
<?php
23
/** @var $referObject object */
24
$referObject = \App::$User->identity($post->sender_id);
25
$referNickname = ($referObject->getProfile()->nick == null ? __('No name') : \App::$Security->strip_tags($referObject->getProfile()->nick));
26
?>
27
<div class="row wall-post" id="wall-post-<?= $post->id ?>">
28
    <div class="col-md-2">
29
        <div class="text-center"><img class="img-responsive img-rounded" alt="Avatar of <?= $referNickname ?>"
30
                                      src="<?= $referObject->getProfile()->getAvatarUrl('small') ?>" />
31
        </div>
32
    </div>
33
    <div class="col-md-10">
34
        <h5 style="margin-top: 0;">
35
            <i class="fa fa-pencil"></i> <?= Url::link(['profile/show', $post->sender_id], $referNickname) ?>
0 ignored issues
show
It seems like $referNickname defined by $referObject->getProfile...ct->getProfile()->nick) on line 25 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...
36
            <small class="pull-right"><?= Date::convertToDatetime($post->updated_at, Date::FORMAT_TO_SECONDS); ?></small>
37
        </h5>
38
        <div class="wall-post-text">
39
            <?= \App::$Security->strip_tags($post->message); ?>
40
        </div>
41
    </div>
42
</div>
43
44
<?php $form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post']); ?>
45
<?= $form->start() ?>
46
<?= $form->field('id', 'hidden', null, null, '%item%'); ?>
47
<?= $form->submitButton(__('Delete'), ['class' => 'btn btn-danger']) ?>
48
<?= $form->finish(false) ?>