0) { if ($missingLen > 1) { if ($missingLen > 2) { $last = array_pop($missing); $missing = implode(', ', $missing); $missing .= ", and $last"; } else { $missing = implode(' and ', $missing); } throw new \Exception("\"$jsonPath\" is missing the required $missing properties.".\PHP_EOL); } throw new \Exception("\"$jsonPath\" is missing the required {$missing[0]} property.".\PHP_EOL); } return true; } }