has() public method

If multiple headers match, the actual one may be specified by $index.
public has ( string $name, integer $index ) : boolean
$name string
$index integer
return boolean
示例#1
0
 public function setHeaders(Swift_Mime_HeaderSet $headers)
 {
     $bodyLen = $this->_bodyLen;
     if (is_bool($bodyLen)) {
         $bodyLen = -1;
     }
     $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
     $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
     $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
     $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);
     // Hardcode signature Margin for now
     $this->_dkimHandler->setMargin(78);
     if (!is_numeric($this->_signatureTimestamp)) {
         OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time());
     } else {
         if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->_signatureTimestamp)) {
             throw new Swift_SwiftException('Unable to force signature timestamp [' . openssl_error_string() . ']');
         }
     }
     if (isset($this->_signerIdentity)) {
         $this->_dkimHandler->setSigner($this->_signerIdentity);
     }
     $listHeaders = $headers->listAll();
     foreach ($listHeaders as $hName) {
         // Check if we need to ignore Header
         if (!isset($this->_ignoredHeaders[strtolower($hName)])) {
             $tmp = $headers->getAll($hName);
             if ($headers->has($hName)) {
                 foreach ($tmp as $header) {
                     if ($header->getFieldBody() != '') {
                         $htosign = $header->toString();
                         $this->_dkimHandler->header($htosign);
                         $this->_signedHeaders[] = $header->getFieldName();
                     }
                 }
             }
         }
     }
     return $this;
 }
示例#2
0
 /**
  * Set the headers to sign
  *
  * @param Swift_Mime_HeaderSet $headers
  * @return Swift_Signers_DKIMSigner
  */
 public function setHeaders(Swift_Mime_HeaderSet $headers)
 {
     $this->_headerCanonData = '';
     // Loop through Headers
     $listHeaders = $headers->listAll();
     foreach ($listHeaders as $hName) {
         // Check if we need to ignore Header
         if (!isset($this->_ignoredHeaders[strtolower($hName)])) {
             if ($headers->has($hName)) {
                 $tmp = $headers->getAll($hName);
                 foreach ($tmp as $header) {
                     if ($header->getFieldBody() != '') {
                         $this->_addHeader($header->toString());
                         $this->_signedHeaders[] = $header->getFieldName();
                     }
                 }
             }
         }
     }
     return $this;
 }