What can replace this design?
There are a lot of similar checks in the code, but I don’t really want to put it into a separate function and this array is taken after processing the xml file.
if(isset($dict_notification->{'purchaseDocumentation'}->{'grantStartDate'})) { $date = $dict_notification->{'purchaseDocumentation'}->{'grantStartDate'}; } else { return; // old - $date = null; }
$date = $dict_notification->{'purchaseDocumentation'}->{'grantStartDate'} ?: null;True, if you havefalse,0,'0', etc. in the variable, then in$datereturnsNULL:( - Vismanfalse,0and'0'are quite correct and, possibly, one of the expected options. It is better to check at the very beginning, after parsing, in one crowd (arrays of expected keys, possible markers, etc.). - user207618$id=$dict_notification->{'id'} ?: return;- users