Re: [PATCH] Fixes + Add HTTP Status Handlers to HTTP_Header

From: Date: Mon, 01 Dec 2003 21:06:48 +0000
Subject: Re: [PATCH] Fixes + Add HTTP Status Handlers to HTTP_Header
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24026@lists.php.net to get a copy of this message
Davey wrote:
The use of constant() is far better than using eval() :)
definetly
Also, I removed the numbers in the constants values, this is for my statusText() method, however, I did make changes to the places they were needed to make sure the number is included in the header() call.
changing content of constants is a BC break, isnt it?
You can find the patch here [1] and a test here [2]
just a (tiny) thought i think the is*() methods should be put in one, like this: function getHeaderType($httpCode) {
     ....
     return HTTP_HEADER_STATUS_INFORMATIONAL|HTTP_HEADER_STATUS_...
} if you want to make a dynamic call to the is*() methods (as u proposed them), one would need to build the method name dynamically. For the way i proposed you would only need to build the check of the return code dynamically, and it is less code. I think since it makes it shorter it might be the better way. but i also think it is a bit pedantic. a third opinion would be interesting in my eyes. Pierre? -- Wolfram http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth

« previous php.pear.dev (#24026) next »