Mistři v programování na #hovnokod

Jen si to zkus!

public function getStops(Request $request, ?string $legId)
    {
        if (!$legId) {
            throw new InvalidInput('Missing required argument: LegId');
        }
        ...
    }

Anonymous,

if(array_key_exists("USERS",$data)) {
    foreach($data["USERS"] as $idUser => $users) {
        foreach($users as $userId => $groups) {
            foreach($groups as $groupId => $contactType) {
                foreach($contactType as $typeIdContact => $contactOther) {
                    foreach($contactOther as $idContact => $names) {
                        foreach($names as $idName => $phones) {
                            foreach($phones as $numberId => $otherContacts) {
                                $nameValue = false;
                                $numberValue = false;
                                $value = false;
                                if(array_key_exists("ID_CONTACT",$otherContacts)) {
                                    if($otherContacts["ID_CONTACT"] == "_delete") {
                                        $nameValue = "_delete";
                                    } elseif($otherContacts["ID_CONTACT"] && $otherContacts["ID_CONTACT"] != "null" && array_key_exists("NUMBER_ID",$otherContacts) && $otherContacts["NUMBER_ID"] && $otherContacts["NUMBER_ID"] != "null") { 
                                        $nameValue = $otherContacts["ID_CONTACT"];
                                        $numberValue = $otherContacts["NUMBER_ID"];
                                    }
                                    if(array_key_exists("ID_NUMBER",$otherContacts)) {
                                        $value = $otherContacts["ID_NUMBER"];
                                    }
                                }
                                if($nameValue) {
                                    $nameKey = sprintf("CONTACT[%d][%d][%d][%d][%d][%d][%d][%s]",$idUser,$userId,$groupId,$typeIdContact,$idContact,$idName,$numberId,"ID_CONTACT");
                                    $newData[$nameKey] = $nameValue;
                                    $newNewData[$nameKey] = $nameValue;
                                }
                                if($numberValue) {
                                    $nameKey = sprintf("CONTACT[%d][%d][%d][%d][%d][%d][%d][%s]",$idUser,$userId,$groupId,$typeIdContact,$idContact,$idName,$numberId,"NUMBER_ID");
                                    $newData[$nameKey] = $numberValue;
                                    $newNewData[$nameKey] = $numberValue;
                                }
                                if($value !== false) {
                                    $nameKey = sprintf("CONTACT[%d][%d][%d][%d][%d][%d][%d][%s]",$idUser,$userId,$groupId,$typeIdContact,$idContact,$idName,$numberId,"ID_NUMBER");
                                    $newData[$nameKey] = $value;
                                    $newNewData[$nameKey] = $value;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Anonymous,

součást nejmenovaného CMS

private function checkFileExtension(&$file) {
	if (!empty($file['name']) && !preg_match('/^(.*)(\..{1,4})$/', $file['name'])){
		preg_match('/^(.*)(\..{1,4})$/', $file['file'], $matches);
		$file['name'] .= $matches[2];
	}
}

vitexikora,

Produkční kód za 200k...

/*
* tohle ti nebude fungovat, radsi me vygeneruj link, ktery se bude propisovat v dialovem okne obrazu
*/

Anonymous,

Kdy se provede else? To nikdo neví...

if (_loginlevel >= Secure::get('viplevel')) {
                include $_tpl[$type];
            } elseif (1+1===2) {
                include $_tpl[$type];
            } else {
                echo "<h1>{$data['title']}</h1>";
                ...
}

Anonymous,