Failed Conditions
Pull Request — oauthcreation (#531)
by Simon
06:20
created

modifier.nlimplode.php ➔ smarty_modifier_nlimplode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 *                                                                            *
5
 * All code in this file is released into the public domain by the ACC        *
6
 * Development Team. Please see team.json for a list of contributors.         *
7
 *****************************************************************************
8
 *
9
 * @param array  $list
10
 * @param string $conjunction
11
 *
12
 * @return string
13
 */
14
15
function smarty_modifier_nlimplode($list, $conjunction = 'or')
16
{
17
    $last = array_pop($list);
18
    if ($list) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $list of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
19
        return implode(', ', $list) . ', ' . $conjunction . ' ' . $last;
20
    }
21
    return $last;
22
}