Your IP : 18.118.186.62


Current Path : /home/bitrix/ext_www/dev.klimatlend.ua/bitrix/modules/main/lib/mail/
Upload File :
Current File : /home/bitrix/ext_www/dev.klimatlend.ua/bitrix/modules/main/lib/mail/context.php

<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2017 Bitrix
 */
namespace Bitrix\Main\Mail;

class Context
{
	const CAT_EXTERNAL = 1;
	const PRIORITY_HIGH = 1;
	const PRIORITY_NORMAL = 2;
	const PRIORITY_LOW = 3;

	protected $category;
	protected $smtp;
	protected $priority;

	public function __construct(array $params = null)
	{
		if (!empty($params) && is_array($params))
		{
			foreach ($params as $name => $value)
			{
				$setter = sprintf('set%s', $name);
				if (is_callable(array($this, $setter)))
					$this->$setter($value);
			}
		}
	}

	/**
	 * @param int $category See Context CAT_* constants.
	 * @return $this
	 */
	public function setCategory($category)
	{
		$this->category = $category;
		return $this;
	}

	/**
	 * @return int|null
	 */
	public function getCategory()
	{
		return $this->category;
	}

	/**
	 * @param Smtp\Config $config Smtp config.
	 * @return $this
	 */
	public function setSmtp(Smtp\Config $config)
	{
		$this->smtp = $config;
		return $this;
	}

	/**
	 * @return Smtp\Config|null
	 */
	public function getSmtp()
	{
		return $this->smtp;
	}

	/**
	 * @param int $priority See Context PRIORITY_* constants.
	 * @return $this
	 */
	public function setPriority($priority)
	{
		$this->priority = $priority;
		return $this;
	}

	/**
	 * @return int|null
	 */
	public function getPriority()
	{
		return $this->priority;
	}
}