[TYPO3-core] RFC #16586: Refactor conditions in t3lib_extFileFunc

Andreas Wolf typo3ml at andreaswolf.info
Sun Dec 5 19:47:39 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reminder #1

Am 28.11.10 01:29, schrieb Andreas Wolf:
> This is an SVN patch request.
> 
> Type: Code cleanup
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=16586
> 
> Branches:
> trunk
> maybe TYPO3_4-4
> 
> Problem:
> t3lib_extFileFunc has a lot of deeply nested conditions. These
> conditions make understanding the code really hard.
> 
> 
> Solution:
> 
> Most of the else-branches only contain a log call, so it helps a lot to
> invert the conditions and move the log call inside the if-branch. The
> else branch can then be removed, the code can be streamlined.
> 
> Example:
> 
> before:
> if (condition) {
>   foo();
>   bar();
> } else {
>   $this->writeLog(...);
> }
> 
> after:
> if (!condition) {
>   $this->writeLog(...);
> }
> foo();
> bar();
> 
> 
> Notes:
> 
> I simply inverted all of the conditions following the boolean logic. For
> some conditions there may be other possible (more logical) ways, but I
> wanted to keep reviewing simple.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkz73ksACgkQHWtXp155bP9tigCfUyFYOeXfMmUtDAhAtzicMo3o
9KoAniu/SEeMh/dn3/2gBX2dLy8FhWtJ
=LHDg
-----END PGP SIGNATURE-----


More information about the TYPO3-team-core mailing list