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

Toolbox::getEventHash()   B

Complexity

Conditions 6
Paths 6

Size

Total Lines 19
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 19
rs 8.8571
cc 6
eloc 12
nc 6
nop 1
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