Code Duplication    Length = 16-17 lines in 4 locations

engine/classes/ElggGroup.php 1 location

@@ 481-497 (lines=17) @@
478
	 *
479
	 * @return bool
480
	 */
481
	protected function load($guid) {
482
		$attr_loader = new \Elgg\AttributeLoader(get_class(), 'group', $this->attributes);
483
		$attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
484
		$attr_loader->secondary_loader = 'get_group_entity_as_row';
485
486
		$attrs = $attr_loader->getRequiredAttributes($guid);
487
		if (!$attrs) {
488
			return false;
489
		}
490
491
		$this->attributes = $attrs;
492
		$this->tables_loaded = 2;
493
		$this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
494
		_elgg_cache_entity($this);
495
496
		return true;
497
	}
498
499
	/**
500
	 * {@inheritdoc}

engine/classes/ElggObject.php 1 location

@@ 108-124 (lines=17) @@
105
	 * @return bool
106
	 * @throws InvalidClassException
107
	 */
108
	protected function load($guid) {
109
		$attr_loader = new \Elgg\AttributeLoader(get_class(), 'object', $this->attributes);
110
		$attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
111
		$attr_loader->secondary_loader = 'get_object_entity_as_row';
112
113
		$attrs = $attr_loader->getRequiredAttributes($guid);
114
		if (!$attrs) {
115
			return false;
116
		}
117
118
		$this->attributes = $attrs;
119
		$this->tables_loaded = 2;
120
		$this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
121
		_elgg_cache_entity($this);
122
123
		return true;
124
	}
125
126
	/**
127
	 * {@inheritdoc}

engine/classes/ElggSite.php 1 location

@@ 118-134 (lines=17) @@
115
	 * @return bool
116
	 * @throws InvalidClassException
117
	 */
118
	protected function load($guid) {
119
		$attr_loader = new \Elgg\AttributeLoader(get_class(), 'site', $this->attributes);
120
		$attr_loader->requires_access_control = !($this instanceof \ElggPlugin);
121
		$attr_loader->secondary_loader = 'get_site_entity_as_row';
122
123
		$attrs = $attr_loader->getRequiredAttributes($guid);
124
		if (!$attrs) {
125
			return false;
126
		}
127
128
		$this->attributes = $attrs;
129
		$this->tables_loaded = 2;
130
		$this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
131
		_elgg_cache_entity($this);
132
133
		return true;
134
	}
135
136
	/**
137
	 * {@inheritdoc}

engine/classes/ElggUser.php 1 location

@@ 120-135 (lines=16) @@
117
	 *
118
	 * @return bool
119
	 */
120
	protected function load($guid) {
121
		$attr_loader = new \Elgg\AttributeLoader(get_class(), 'user', $this->attributes);
122
		$attr_loader->secondary_loader = 'get_user_entity_as_row';
123
124
		$attrs = $attr_loader->getRequiredAttributes($guid);
125
		if (!$attrs) {
126
			return false;
127
		}
128
129
		$this->attributes = $attrs;
130
		$this->tables_loaded = 2;
131
		$this->loadAdditionalSelectValues($attr_loader->getAdditionalSelectValues());
132
		_elgg_cache_entity($this);
133
134
		return true;
135
	}
136
137
138
	/**