Passed
Push — master ( 9c6499...c22bc5 )
by Jens
04:52 queued 02:21
created

function.renderFolder.php ➔ renderFolder()   B

Complexity

Conditions 6
Paths 8

Size

Total Lines 40
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 31
nc 8
nop 5
dl 0
loc 40
rs 8.439
c 0
b 0
f 0
1
<?
2
/**
3
 * @param CloudControl\Cms\storage\Document $document
4
 * @param string $cmsPrefix
5
 * @param string $slugPrefix
6
 * @param bool $root
7
 * @param \CloudControl\Cms\cc\Request $request
8
 */
9
function renderFolder($document, $cmsPrefix, $slugPrefix = '', $root = false, $request)
10
{ ?>
11
  <div class="grid-box-8">
12
    <h3>
13
      <a class="btn documentTitle openFolder" data-slug="<?= $slugPrefix . $document->slug ?>" title="Open">
14
        <i class="fa fa-folder-o "></i> <?= $document->title ?>
15
      </a>
16
    </h3>
17
  </div>
18
  <div class="documentActions grid-box-4">
19
      <? renderAction('Edit',
20
          '',
21
          $request::$subfolders . $cmsPrefix . '/documents/edit-folder?slug=' . $slugPrefix . $document->slug,
22
          'pencil'); ?>
23
      <? renderAction('Delete',
24
          'error',
25
          $request::$subfolders . $cmsPrefix . '/documents/delete-folder?slug=' . $slugPrefix . $document->slug,
26
          'trash',
27
          'return confirm(\'Are you sure you want to delete this document?\');'); ?>
0 ignored issues
show
Documentation introduced by
'return confirm(\'Are yo...ete this document?\');' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
28
  </div>
29
  <ul class="documents grid-wrapper nested<?= $root ? ' root' : '' ?>">
30
      <? foreach ($document->getContent() as $subDocument) : ?>
31
        <li class="grid-container">
32
            <? if ($subDocument->type == 'document') : ?>
33
                <? renderDocument($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', $request); ?>
34
            <? elseif ($subDocument->type == 'folder') : ?>
35
                <? renderFolder($subDocument, $cmsPrefix, $slugPrefix . $document->slug . '/', false, $request); ?>
36
            <? endif ?>
37
        </li>
38
      <? endforeach ?>
39
      <? if (count($document->getContent()) == 0) : ?>
40
        <li class="grid-container">
41
          <div class="grid-box-12">
42
            <i class="fa fa-ellipsis-h empty"></i>
43
            <i>Empty</i>
44
          </div>
45
        </li>
46
      <? endif ?>
47
  </ul>
48
<? } ?>