Code Duplication    Length = 12-13 lines in 2 locations

engine/classes/ElggPlugin.php 1 location

@@ 918-930 (lines=13) @@
915
	 * @param mixed  $value Value to be set
916
	 * @return void
917
	 */
918
	public function __set($name, $value) {
919
		if (array_key_exists($name, $this->attributes)) {
920
			// Check that we're not trying to change the guid!
921
			if ((array_key_exists('guid', $this->attributes)) && ($name == 'guid')) {
922
				return;
923
			}
924
925
			$this->attributes[$name] = $value;
926
		} else {
927
			// to make sure we trigger the correct hooks
928
			$this->setSetting($name, $value);
929
		}
930
	}
931
932
	/**
933
	 * Save a value as private setting or attribute.

engine/classes/ElggWidget.php 1 location

@@ 71-82 (lines=12) @@
68
	 * @param mixed  $value The value to set
69
	 * @return void
70
	 */
71
	public function __set($name, $value) {
72
		if (array_key_exists($name, $this->attributes)) {
73
			// Check that we're not trying to change the guid!
74
			if ((array_key_exists('guid', $this->attributes)) && ($name == 'guid')) {
75
				return;
76
			}
77
78
			$this->attributes[$name] = $value;
79
		} else {
80
			$this->setPrivateSetting($name, $value);
81
		}
82
	}
83
84
	/**
85
	 * Override entity get and sets in order to save data to private data store.