Currently this library is converting the whole schema to an array and processing it. So the source-codes of code generator seems pretty ugly. As a solution use a third party library to convert the json schema to typed objects. It will improve the code readability of code generator. I am suggesting to use swaggest/php-swagger2-schema