아래에 작은 코드 조각이 있는데 모범 사례/코드 유지 관리와 관련하여 어떤 유형의 변경을해야하는지 궁금합니다.모범 사례/유지 관리를 위해 제 코드에서 변경하려는 사항은 무엇입니까?
function _setAccountStatus($Username, $AccountStatus)
{
if ($Username == '' || ($AccountStatus != 'Active' || $AccountStatus != 'Banned' || $AccountStatus != 'Suspended')) {
// TODO: throw error here.
}
$c1 = new Criteria();
$c1->add(UsersPeer::USERNAME,$Username);
$rs = UsersPeer::doSelect($c1);
if (count($rs) > 0) {
$UserRow = array_pop($rs);
$UserRow->setAccountStatus($AccountStatus);
try {
$UserRow->save();
} catch (PropelException $e) {
return false;
}
return true;
}
return false;
}