getTopicTitle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 3
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * NewBB 5.0x,  the forum module for XOOPS project
4
 *
5
 * @copyright      XOOPS Project (https://xoops.org)
6
 * @license        GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
7
 * @author         Taiwen Jiang (phppp or D.J.) <[email protected]>
8
 * @since          4.00
9
 * @package        module::newbb
10
 */
11
12
13
14
defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php';
15
define('NEWBB_FUNCTIONS_TOPIC_LOADED', true);
16
17
if (!defined('NEWBB_FUNCTIONS_TOPIC')) {
18
    define('NEWBB_FUNCTIONS_TOPIC', 1);
19
20
    /**
21
     * Create full title of a topic
22
     *
23
     * the title is composed of [type_name] if type_id is greater than 0 plus topic Title
24
     * @param         $topicTitle
25
     * @param null    $prefixName
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prefixName is correct as it would always require null to be passed?
Loading history...
26
     * @param null    $prefixColor
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prefixColor is correct as it would always require null to be passed?
Loading history...
27
     * @return string
28
     */
29
    function newbbGetTopicTitle($topicTitle, $prefixName = null, $prefixColor = null)
0 ignored issues
show
Unused Code introduced by
The parameter $prefixColor is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    function newbbGetTopicTitle($topicTitle, $prefixName = null, /** @scrutinizer ignore-unused */ $prefixColor = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $prefixName is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

29
    function newbbGetTopicTitle($topicTitle, /** @scrutinizer ignore-unused */ $prefixName = null, $prefixColor = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        return getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null);
32
    }
33
34
    /**
35
     * @param         $topicTitle
36
     * @param null    $prefixName
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prefixName is correct as it would always require null to be passed?
Loading history...
37
     * @param null    $prefixColor
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $prefixColor is correct as it would always require null to be passed?
Loading history...
38
     * @return string
39
     */
40
    function getTopicTitle($topicTitle, $prefixName = null, $prefixColor = null)
41
    {
42
        if (empty($prefixName)) {
43
            return $topicTitle;
44
        }
45
        $topicPrefix = $prefixColor ? '<em style="font-style: normal; color: ' . $prefixColor . ';">[' . $prefixName . ']</em> ' : '[' . $prefixName . '] ';
0 ignored issues
show
introduced by
$prefixColor is of type null, thus it always evaluated to false.
Loading history...
46
47
        return $topicPrefix . $topicTitle;
48
    }
49
}
50