[TYPO3-core] RFC #16586: Refactor conditions in t3lib_extFileFunc
Andreas Wolf
typo3ml at andreaswolf.info
Sun Nov 28 01:29:20 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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.
Regards
Andreas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkzxomAACgkQHWtXp155bP8V7wCdE87XcNEVFWxZCEimPGiuRSAJ
6tQAnAtO6/W8Dgf2YC54UXaRLFfSRNHx
=1pTF
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0016586_v1.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101128/7615d2d9/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0016586_v1.diff.sig
Type: application/octet-stream
Size: 72 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20101128/7615d2d9/attachment-0001.obj>
More information about the TYPO3-team-core
mailing list