Completed
Push — master ( 88111b...b3fce7 )
by Michael
05:58
created

Tip::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 4
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php namespace XoopsModules\Smartobject;
2
3
/**
4
 *
5
 * Module: SmartObject
6
 * Author: The SmartFactory <www.smartfactory.ca>
7
 * Licence: GNU
8
 */
9
10
use XoopsModules\Smartobject;
11
12
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
13
14
/**
15
 * Class SmartTip
16
 * @package XoopsModules\Smartobject
17
 */
18
class Tip
19
{
20
    public $id;
21
    public $caption;
22
    public $message;
23
    public $visible;
24
    public $_tpl;
25
26
    /**
27
     * SmartTip constructor.
28
     * @param      $id
29
     * @param      $caption
30
     * @param      $message
31
     * @param bool $visible
32
     */
33
    public function __construct($id, $caption, $message, $visible = false)
34
    {
35
        $this->id      = $id;
36
        $this->caption = $caption;
37
        $this->message = $message;
38
        $this->visible = $visible;
39
        $this->_tpl    = new \XoopsTpl();
40
    }
41
42
    /**
43
     * @param  bool $outputNow
44
     * @return mixed|string|void
45
     */
46
    public function render($outputNow = true)
47
    {
48
        $aTip = [
49
            'id'      => $this->id,
50
            'caption' => $this->caption,
51
            'message' => $this->message,
52
            'visible' => $this->visible ? 'block' : 'none'
53
        ];
54
        $this->_tpl->assign('tip', $aTip);
55
        if ($outputNow) {
56
            $this->_tpl->display('db:smartobject_tip.tpl');
57
        } else {
58
            return $this->_tpl->fetch('db:smartobject_tip.tpl');
59
        }
60
    }
61
}
62