Code Duplication    Length = 14-14 lines in 2 locations

Auth/class.LDAPUser.php 1 location

@@ 245-258 (lines=14) @@
242
        return false;
243
    }
244
245
    public static function from_name($name, $data = false)
246
    {
247
        if($data === false)
248
        {
249
            throw new \Exception('data must be set for LDAPUser');
250
        }
251
        $filter = new \Data\Filter("uid eq $name");
252
        $user = $data->read($data->user_base, $filter);
253
        if($user === false || !isset($user[0]))
254
        {
255
            return false;
256
        }
257
        return new static($user[0]);
258
    }
259
260
    public function flushUser()
261
    {

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