« Return to Thread: $this->getRequest()->isPost() vs. ($_SERVER['REQUEST_METHOD'] == 'POST')

$this->getRequest()->isPost() vs. ($_SERVER['REQUEST_METHOD'] == 'POST')

by HMunroe :: Rate this Message:

Reply to Author | View in Thread

I just read this blog post from Matthew, and saw the link to the QuickStart:

* http://framework.zend.com/wiki/display/ZFDEV/Official+ZF+QuickStart

I found something that I find disturbing. In the form handler, I saw this:

if ($this->getRequest()->isPost()) {...

(this is in the Build a Form section)

Isn't this a little too overcomplicated ? I also like the well-arranged and tidy OOP syntax, but this seems too much for me. I don't mean to criticize, but I want to figure out what's the logic behind a line of code like that. What would justify the extra cycles for stacking the function calls, and passing the request object, against plain old "equals" check , like:

if ($_SERVER['REQUEST_METHOD'] == 'POST') { ...

I understand that there are a lot of ways to do a job, but in this case this doesn't seem like a "best practice" to me.

What do you think ?

 « Return to Thread: $this->getRequest()->isPost() vs. ($_SERVER['REQUEST_METHOD'] == 'POST')