converted several switches to ifs and made more opcache friendly