Completed
Push — develop ( b91125...52c290 )
by Seth
03:00
created

Toolbox   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A smarty_addMessage() 0 11 3
1
<?php
2
3
namespace smtech\CanvasICSSync;
4
5
use Battis\BootstrapSmarty\NotificationMessage;
6
use Log;
7
8
class Toolbox extends \smtech\StMarksReflexiveCanvasLTI\Toolbox
9
{
10
    /**
11
     * Write messages to the log file if a script is being run
12
     * non-interactively from the command line
13
     *
14
     * @param string $subject
15
     * @param string $body
16
     * @param string $flag (Optional, default `NotificationMessage::INFO`)
17
     * @param Log $log (Optional, defaults to app log)
18
     */
19
    public function smarty_addMessage($subject, $body, $flag = NotificationMessage::INFO, Log $log = null)
20
    {
21
        if (empty($log)) {
22
            $log = $this->getLog();
23
        }
24
        if (php_sapi_name() == 'cli') {
25
            $log->log("[$flag] $subject: $body");
26
        } else {
27
            parent::smarty_addMessage($subject, $body, $flag);
28
        }
29
    }
30
}
31