snappymail/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Response.php

90 lines
1.3 KiB
PHP
Raw Normal View History

2013-09-25 03:04:44 +08:00
<?php
2014-10-17 18:15:19 +08:00
/*
* This file is part of MailSo.
*
* (c) 2014 Usenko Timur
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
2013-09-25 03:04:44 +08:00
namespace MailSo\Imap;
/**
* @category MailSo
* @package Imap
*/
class Response
{
/**
* @var array
*/
public $ResponseList;
/**
* @var array | null
*/
public $OptionalResponse;
/**
* @var string
*/
public $StatusOrIndex;
/**
* @var string
*/
public $HumanReadable;
/**
* @var bool
*/
public $IsStatusResponse;
/**
* @var string
*/
public $ResponseType;
/**
* @var string
*/
public $Tag;
private function __construct()
{
$this->ResponseList = array();
$this->OptionalResponse = null;
$this->StatusOrIndex = '';
$this->HumanReadable = '';
$this->IsStatusResponse = false;
$this->ResponseType = \MailSo\Imap\Enumerations\ResponseType::UNKNOWN;
$this->Tag = '';
}
2020-03-16 20:08:53 +08:00
public static function NewInstance() : self
2013-09-25 03:04:44 +08:00
{
return new self();
}
2014-08-19 20:39:27 +08:00
2020-03-16 20:08:53 +08:00
private function recToLine(array $aList) : string
2014-08-19 20:39:27 +08:00
{
$aResult = array();
if (\is_array($aList))
{
foreach ($aList as $mItem)
{
$aResult[] = \is_array($mItem) ? '('.$this->recToLine($mItem).')' : (string) $mItem;
}
}
return \implode(' ', $aResult);
}
2020-03-16 20:08:53 +08:00
public function ToLine() : string
2014-08-19 20:39:27 +08:00
{
return $this->recToLine($this->ResponseList);
}
2013-09-25 03:04:44 +08:00
}