Skip to content

Instantly share code, notes, and snippets.

@ClemensSahs
Created March 9, 2011 06:39
Show Gist options
  • Save ClemensSahs/861785 to your computer and use it in GitHub Desktop.
Save ClemensSahs/861785 to your computer and use it in GitHub Desktop.
so we change this
public function setRequest($request)
{
if (is_string($request)) {
if (!class_exists($request)) {
throw new Exception('Class is not exists');
}
$request = new $request();
}
if (!$request instanceof Request\AbstractRequest) {
throw new Exception('Invalid request class');
}
$this->_request = $request;
return $this;
}
use \Zend\Loader\Exception\InvalidArgumentException;
/*
some code
*/
public function setRequest($request)
{
if (is_string($request)) {
if (!class_exists($request)) {
throw new InvalidArgumentException('Class is not exists');
}
$request = new $request();
}
if (!$request instanceof Request\AbstractRequest) {
throw new InvalidArgumentException('Invalid request class');
}
$this->_request = $request;
return $this;
}
public function setRequest($request)
{
if (is_string($request)) {
if (!class_exists($request)) {
\Zend\Loader::loadClass($request);
}
$request = new $request();
}
if (!$request instanceof Request\AbstractRequest) {
throw new Exception('Invalid request class');
}
$this->_request = $request;
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment