Code Duplication    Length = 22-24 lines in 2 locations

lib/classes/Swift/Signers/DKIMSigner.php 1 location

@@ 530-551 (lines=22) @@
527
     *
528
     * @return Swift_Signers_DKIMSigner
529
     */
530
    public function setHeaders(Swift_Mime_HeaderSet $headers)
531
    {
532
        $this->_headerCanonData = '';
533
        // Loop through Headers
534
        $listHeaders = $headers->listAll();
535
        foreach ($listHeaders as $hName) {
536
            // Check if we need to ignore Header
537
            if (!isset($this->_ignoredHeaders[Swift::strtolowerWithStaticCache($hName)])) {
538
                if ($headers->has($hName)) {
539
                    $tmp = $headers->getAll($hName);
540
                    foreach ($tmp as $header) {
541
                        if ($header->getFieldBody() != '') {
542
                            $this->_addHeader($header->toString());
543
                            $this->_signedHeaders[] = $header->getFieldName();
544
                        }
545
                    }
546
                }
547
            }
548
        }
549
550
        return $this;
551
    }
552
553
    /**
554
     * Add the signature to the given Headers.

lib/classes/Swift/Signers/DomainKeySigner.php 1 location

@@ 389-412 (lines=24) @@
386
     *
387
     * @return $this
388
     */
389
    public function setHeaders(Swift_Mime_HeaderSet $headers)
390
    {
391
        $this->_startHash();
392
        $this->_canonData = '';
393
        // Loop through Headers
394
        $listHeaders = $headers->listAll();
395
        foreach ($listHeaders as $hName) {
396
            // Check if we need to ignore Header
397
            if (!isset($this->_ignoredHeaders[Swift::strtolowerWithStaticCache($hName)])) {
398
                if ($headers->has($hName)) {
399
                    $tmp = $headers->getAll($hName);
400
                    foreach ($tmp as $header) {
401
                        if ($header->getFieldBody() != '') {
402
                            $this->_addHeader($header->toString());
403
                            $this->_signedHeaders[] = $header->getFieldName();
404
                        }
405
                    }
406
                }
407
            }
408
        }
409
        $this->_endOfHeaders();
410
411
        return $this;
412
    }
413
414
    /**
415
     * Add the signature to the given Headers.