for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace mQueue\Controller\ActionHelper;
use Zend_Controller_Action_Helper_Abstract;
class Headers extends Zend_Controller_Action_Helper_Abstract
{
/**
* Set appropriate headers according to content type
*
* @param mixed $contentType
*/
public function headers($contentType): void
$response = $this->getActionController()->getResponse();
$response->setHeader('Content-Type', $contentType);
$response->setHeader('Cache-Control', 'max-age=604800');
// This check is required when running via unit tests
if (headers_sent()) {
return;
}
header_remove('Pragma');
header_remove('Expires');
* Strategy pattern: call helper as broker method
* @param mixed $data
public function direct($data)
return $this->headers($data);
$this->headers($data)
mQueue\Controller\ActionHelper\Headers::headers()
This check looks for function or method calls that always return null and whose return value is used.
class A { function getObject() { return null; } } $a = new A(); if ($a->getObject()) {
The method getObject() can return nothing but null, so it makes no sense to use the return value.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.