Do you have any idea how petty that comes across? I’ll give you the benefit of the doubt since its late and I’m rather sore and stressed out to begin with, but jeez - 3 lines. My God it’s the end of the world.
How would you do it?
Coincidently, the function is declared equal to the constant DEBUG which is set by the framework long before this class gets instantiated.
There is the conceptual load too, of having behaviour not related directly to the task and of adding an extra object variable.
Not related to the task? Seriously? Labeling the template you are inserting into the output HTML during debug is very much related to the task of “composing an HTML response” sir. And there is a reason why the line is where it is.
Parse template gets called at least once to parse the page template. But it may not be called for each template. For example, a template might read
<table>
<? foreach ($summary as $row):
include($this->findTemplate('row');
endforeach; ?>
</table>
Or if I need a new scope for those rows I would do this.
<table>
<? foreach ($summary as $row):
$this->parseTemplate('row', $row);
endforeach; ?>
</table>
The former case is the most frequent, hence the reason find template inserts the comment - because that function is guaranteed to be called.
Sorry, i forgot to ask how many there were already.
My style is for classes to be shorter (2 pages top), so for me about 8%.
Hm…still dont like it. I’m a bit of a code quality purist though. What are you using this for?
yours, Marcus
There’s being a purist, and then there’s being insane. A lot of frameworks suffer from pattern overkill, where the pattern is followed so religiously it bloats the code every bit as badly as if it wasn’t properly factored to begin with.
Go ahead and prove you can do it in less than 4 lines, but I’m betting you’ll put across some factory pattern like Adrian did that trades 4 lines in this class for 40 lines elsewhere that have to be dealt with whether or not DEBUG is on.