fix php code issues according to code sniffer inspection results
fix some php code issues according to code sniffer inspection results
extract code from complex method
adding missing return values and statements