| Total Complexity | 21 |
| Total Lines | 124 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class LogMessage { |
||
| 6 | |||
| 7 | private $message; |
||
| 8 | private $context; |
||
| 9 | private $part; |
||
| 10 | private $level; |
||
| 11 | private $extra; |
||
| 12 | private $datetime; |
||
| 13 | private $count=1; |
||
| 14 | |||
| 15 | public function __construct($message="",$context="",$part="",$level=0,$datetime=null,$extra=null){ |
||
| 16 | $this->message=$message; |
||
| 17 | $this->context=$context; |
||
| 18 | $this->part=$part; |
||
| 19 | $this->level=$level; |
||
| 20 | $this->datetime=$datetime; |
||
| 21 | $this->extra=$extra; |
||
| 22 | } |
||
| 23 | /** |
||
| 24 | * @return mixed |
||
| 25 | */ |
||
| 26 | public function getMessage() { |
||
| 27 | return $this->message; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return mixed |
||
| 32 | */ |
||
| 33 | public function getContext() { |
||
| 34 | return $this->context; |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | public function getPart() { |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @return mixed |
||
| 46 | */ |
||
| 47 | public function getLevel() { |
||
| 48 | return $this->level; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | public function getExtra() { |
||
| 55 | return $this->extra; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return mixed |
||
| 60 | */ |
||
| 61 | public function getDatetime() { |
||
| 63 | } |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param mixed $message |
||
| 67 | */ |
||
| 68 | public function setMessage($message) { |
||
| 69 | $this->message = $message; |
||
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @param mixed $context |
||
| 74 | */ |
||
| 75 | public function setContext($context) { |
||
| 77 | } |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @param mixed $part |
||
| 81 | */ |
||
| 82 | public function setPart($part) { |
||
| 83 | $this->part = $part; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @param mixed $level |
||
| 88 | */ |
||
| 89 | public function setLevel($level) { |
||
| 90 | $this->level = $level; |
||
| 91 | } |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @param mixed $extra |
||
| 95 | */ |
||
| 96 | public function setExtra($extra) { |
||
| 97 | $this->extra = $extra; |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * @param mixed $datetime |
||
| 102 | */ |
||
| 103 | public function setDatetime($datetime) { |
||
| 104 | $this->datetime = $datetime; |
||
| 105 | } |
||
| 106 | |||
| 107 | public function incCount(){ |
||
| 108 | $this->count++; |
||
| 109 | } |
||
| 110 | /** |
||
| 111 | * @return mixed |
||
| 112 | */ |
||
| 113 | public function getCount() { |
||
| 114 | return $this->count; |
||
| 115 | } |
||
| 116 | |||
| 117 | public function equals(LogMessage $message){ |
||
| 119 | } |
||
| 120 | |||
| 121 | public static function addMessage(&$messages,LogMessage $newMessage){ |
||
| 122 | if(sizeof($messages)>0){ |
||
| 123 | $lastM=end($messages); |
||
| 124 | if($newMessage->equals($lastM)){ |
||
| 125 | return $lastM->incCount(); |
||
| 126 | } |
||
| 127 | } |
||
| 129 | } |
||
| 130 | |||
| 131 | } |
||
| 132 | |||
| 133 |