ElggComment   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0
wmc 5
lcom 2
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initializeAttributes() 0 5 1
A canComment() 0 3 1
A save() 0 7 3
1
<?php
2
/**
3
 * \ElggComment
4
 * 
5
 * @package    Elgg.Core
6
 * @subpackage Comments
7
 * @since      1.9.0
8
 */
9
class ElggComment extends \ElggObject {
10
11
	/**
12
	 * Set subtype to comment
13
	 * 
14
	 * @return void
15
	 */
16
	protected function initializeAttributes() {
17
		parent::initializeAttributes();
18
19
		$this->attributes['subtype'] = "comment";
20
	}
21
22
	/**
23
	 * Can a user comment on this object? Always returns false (threaded comments
24
	 * not yet supported)
25
	 *
26
	 * @see \ElggEntity::canComment()
27
	 *
28
	 * @param int $user_guid User guid (default is logged in user)
29
	 * @return bool False
30
	 * @since 1.9.0
31
	 */
32
	public function canComment($user_guid = 0) {
33
		return false;
34
	}
35
36
	/**
37
	 * Update container entity last action on successful save.
38
	 *
39
	 * @param bool $update_last_action Update the container entity's last_action field
40
	 * @return bool|int
41
	 */
42
	public function save($update_last_action = true) {
43
		$result = parent::save();
0 ignored issues
show
Bug Compatibility introduced by
The expression parent::save(); of type boolean|integer adds the type integer to the return on line 47 which is incompatible with the return type declared by the abstract method ElggData::save of type boolean.
Loading history...
44
		if ($result && $update_last_action) {
45
			update_entity_last_action($this->container_guid, $this->time_updated);
46
		}
47
		return $result;
48
	}
49
}
50