[CLEANUP] ImportExport code needs some love

* Fix undefined variables
* Add missing return values
* Reduce indentation level by using guards
* Optimize readability
* CGL compliance

No functional changes.

Resolves: #61152
Releases: 6.3
Change-Id: Ifa2ed030d5fd721ef3ea2c4ef3a819b2d1f8762b
Reviewed-on: http://review.typo3.org/32324
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>