Code Duplication    Length = 14-19 lines in 2 locations

lib/UserModel.php 2 locations

@@ 60-78 (lines=19) @@
57
		return $rc;
58
	}
59
60
	protected function save_roles($key, $rc, $roles)
61
	{
62
		$has_many_roles = $this->models['users/has_many_roles'];
63
64
		if ($key)
65
		{
66
			$has_many_roles->filter_by_uid($key)->delete();
67
		}
68
69
		foreach ($roles as $rid)
70
		{
71
			if ($rid == 2)
72
			{
73
				continue;
74
			}
75
76
			$has_many_roles->execute('INSERT {self} SET uid = ?, rid = ?', [ $rc, $rid ]);
77
		}
78
	}
79
80
	protected function save_restricted_sites($key, $rc, $restricted_sites)
81
	{
@@ 80-93 (lines=14) @@
77
		}
78
	}
79
80
	protected function save_restricted_sites($key, $rc, $restricted_sites)
81
	{
82
		$has_many_sites = $this->models['users/has_many_sites'];
83
84
		if ($key)
85
		{
86
			$has_many_sites->filter_by_uid($key)->delete();
87
		}
88
89
		foreach ($restricted_sites as $site_id)
90
		{
91
			$has_many_sites->execute('INSERT {self} SET uid = ?, site_id = ?', [ $rc, $site_id ]);
92
		}
93
	}
94
}
95