Failed Conditions
Push — newinternal ( 216d62...410e59 )
by Simon
05:28 queued 13s
created

smarty_modifier_nlimplode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 2
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) {
19
        return implode(', ', $list) . ', ' . $conjunction . ' ' . $last;
20
    }
21
    return $last;
22
}