Code Duplication    Length = 19-20 lines in 2 locations

engine/classes/ElggPlugin.php 1 location

@@ 1194-1213 (lines=20) @@
1191
	 * @param mixed  $value Value to be set
1192
	 * @return void
1193
	 */
1194
	public function __set($name, $value) {
1195
		if (array_key_exists($name, $this->attributes)) {
1196
			// Check that we're not trying to change the guid!
1197
			if ((array_key_exists('guid', $this->attributes)) && ($name == 'guid')) {
1198
				return;
1199
			}
1200
1201
			$this->attributes[$name] = $value;
1202
			return;
1203
		}
1204
			
1205
		// object title and description are stored as metadata
1206
		if (in_array($name, ['title', 'description'])) {
1207
			parent::__set($name, $value);
1208
			return;
1209
		}
1210
		
1211
		// to make sure we trigger the correct hooks
1212
		$this->setSetting($name, $value);
1213
	}
1214
1215
	/**
1216
	 * Sets the plugin to active or inactive.

engine/classes/ElggWidget.php 1 location

@@ 57-75 (lines=19) @@
54
	 * @param mixed  $value The value to set
55
	 * @return void
56
	 */
57
	public function __set($name, $value) {
58
		if (array_key_exists($name, $this->attributes)) {
59
			// Check that we're not trying to change the guid!
60
			if ((array_key_exists('guid', $this->attributes)) && ($name == 'guid')) {
61
				return;
62
			}
63
64
			$this->attributes[$name] = $value;
65
			return;
66
		}
67
		
68
		// object title and description are stored as metadata
69
		if (in_array($name, ['title', 'description'])) {
70
			parent::__set($name, $value);
71
			return;
72
		}
73
		
74
		$this->setPrivateSetting($name, $value);
75
	}
76
77
	/**
78
	 * Unset a property from private settings or attribute.