/** * Constructor. * * @param string $headerValue Accept-Language value. If null, will be * deduced from the current HTTP request. * @return void */ public function __construct($headerValue = null) { $value = $headerValue ?: HHttp\Runtime::getHeader('accept-language'); // Remove CFWS. $this->_value = preg_replace('#\\([^\\)]+\\)|\\s#', '', $value); return; }
/** * Get last ID. * * @return string */ public function getLastId() { return Http\Runtime::getHeader('Last-Event-ID') ?: ''; }
/** * Whether the form has been sent or not. * * @return bool */ public function hasBeenSent() { $novalidate = $this->abstract->readAttributeAsList('novalidate'); if (false === $this->abstract->attributeExists('novalidate') || false === in_array('security', $novalidate) && false === in_array('all', $novalidate) && false === in_array('true', $novalidate)) { $method = strtolower($this->readAttribute('method')) ?: 'post'; if ($method !== Http\Runtime::getMethod()) { return false; } $enctype = $this->readAttribute('enctype') ?: 'application/x-www-form-urlencoded'; if ($enctype !== Http\Runtime::getHeader('Content-Type')) { return false; } // add verifications if: // <input type="submit" formaction="…" form*="…" /> } return \Hoa\Http\Runtime::hasData(); }