Code Duplication    Length = 14-14 lines in 2 locations

Auth/class.LDAPGroup.php 1 location

@@ 248-261 (lines=14) @@
245
        }
246
    }
247
248
    public static function from_name($name, $data = false)
249
    {
250
        if($data === false)
251
        {
252
            throw new \Exception('data must be set for LDAPGroup');
253
        }
254
        $filter = new \Data\Filter("cn eq $name");
255
        $group = $data->read($data->group_base, $filter);
256
        if($group === false || !isset($group[0]))
257
        {
258
            return false;
259
        }
260
        return new static($group[0]);
261
    }
262
}
263
/* vim: set tabstop=4 shiftwidth=4 expandtab: */
264

Auth/class.LDAPUser.php 1 location

@@ 254-267 (lines=14) @@
251
        return false;
252
    }
253
254
    public static function from_name($name, $data = false)
255
    {
256
        if($data === false)
257
        {
258
            throw new \Exception('data must be set for LDAPUser');
259
        }
260
        $filter = new \Data\Filter("uid eq $name");
261
        $user = $data->read($data->user_base, $filter);
262
        if($user === false || !isset($user[0]))
263
        {
264
            return false;
265
        }
266
        return new static($user[0]);
267
    }
268
269
    public function flushUser()
270
    {