CLogController   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 6
c 3
b 0
f 0
lcom 1
cbo 2
dl 0
loc 59
ccs 0
cts 21
cp 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A Timestamp() 0 3 1
A printLog() 0 11 2
A getTimestampsAsArray() 0 3 1
A saySomething() 0 5 1
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
}