/** * Retrieve the CAPTCHA code * *@param $key * * @return mixed|null */ protected function getExpectedCode($key) { $arrayZendSession = new SessionArrayStorage(); if ($this->session->has($key)) { $sessionKey = $this->session->get($key); $this->session->remove($key); $captchaSession = $arrayZendSession->offsetGet($sessionKey); $arrayZendSession->offsetUnset($sessionKey); if ($captchaSession instanceof ArrayObject) { $word = $captchaSession->offsetGet('word'); $captchaSession->offsetUnset('word'); return $word; } } return null; }