Вход Регистрация
Файл: concrete5.7.5.6/concrete/vendor/zendframework/zend-mail/src/Header/Subject.php
Строк: 90
<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/zf2 for the canonical source repository
 * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace ZendMailHeader;

class 
Subject implements UnstructuredInterface
{
    
/**
     * @var string
     */
    
protected $subject '';

    
/**
     * Header encoding
     *
     * @var string
     */
    
protected $encoding 'ASCII';

    public static function 
fromString($headerLine)
    {
        
$decodedLine iconv_mime_decode($headerLineICONV_MIME_DECODE_CONTINUE_ON_ERROR'UTF-8');
        list(
$name$value) = GenericHeader::splitHeaderLine($decodedLine);

        
// check to ensure proper header type for this factory
        
if (strtolower($name) !== 'subject') {
            throw new 
ExceptionInvalidArgumentException('Invalid header line for Subject string');
        }

        
$header = new static();
        if (
$decodedLine != $headerLine) {
            
$header->setEncoding('UTF-8');
        }
        
$header->setSubject($value);

        return 
$header;
    }

    public function 
getFieldName()
    {
        return 
'Subject';
    }

    public function 
getFieldValue($format HeaderInterface::FORMAT_RAW)
    {
        if (
HeaderInterface::FORMAT_ENCODED === $format) {
            return 
HeaderWrap::wrap($this->subject$this);
        }

        return 
$this->subject;
    }

    public function 
setEncoding($encoding)
    {
        
$this->encoding $encoding;
        return 
$this;
    }

    public function 
getEncoding()
    {
        return 
$this->encoding;
    }

    public function 
setSubject($subject)
    {
        
$this->subject = (string) $subject;
        return 
$this;
    }

    public function 
toString()
    {
        return 
'Subject: ' $this->getFieldValue(HeaderInterface::FORMAT_ENCODED);
    }
}
Онлайн: 0
Реклама