CLogController::getTimestampsAsArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace Mcknubb\Log;
3
/**
4
 * 
5
 * Controller class for CLog.
6
 *
7
 */
8
class CLogController
9
{
10
  /**
11
   * Properties
12
   *
13
   */
14
  private $log;
15
  private $table;
16
17
  /**
18
   * Constructor
19
   *
20
   */
21
  public function __construct() {
22
    $this->log = new CLog();
23
    $this->table = new TLog();
24
  }
25
26
  /**
27
   * Timestamp, log a event with a time.
28
   *
29
   */
30
  public function Timestamp($domain, $where, $comment=null) {
31
    $this->log->Timestamp($domain, $where, $comment);
32
  }
33
34
  /**
35
   * Render log
36
   * @return string with a html-table to display all timestamps
37
   *
38
   */
39
  public function printLog() {
40
    $timestamps = $this->log->getTimestamp();
41
  
42
    if(empty($timestamps)) {
43
      return $this->table->nothingLogged();
44
    }
45
46
    $memorypeak = $this->log->getMemoryPeak();
47
    $pageLoadTime = $this->log->getPageLoadTime();
48
    return $this->table->renderTimestampAsTable($timestamps, $memorypeak, $pageLoadTime);
49
  }
50
51
  /**
52
   * Get Timestamps as Array
53
   */
54
  public function getTimestampsAsArray() {
55
    return $this->log->getTimestamp();
56
  }
57
58
  /*
59
   * Test if class is loaded
60
   */
61
  public function saySomething($word) {
62
    $this->log->saySomething('log:' . $word . "<br>");
63
    $this->table->saySomething('table:' . $word . "<br>");
64
    echo ('controller:' . $word);
65
  }
66
}