1
|
|
|
<?php
|
2
|
|
|
/**
|
3
|
|
|
* This file is part of the O2System Framework package.
|
4
|
|
|
*
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE
|
6
|
|
|
* file that was distributed with this source code.
|
7
|
|
|
*
|
8
|
|
|
* @author Steeve Andrian Salim
|
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim
|
10
|
|
|
*/
|
11
|
|
|
|
12
|
|
|
// ------------------------------------------------------------------------
|
13
|
|
|
|
14
|
|
|
namespace O2System\Email\Protocols\Abstracts;
|
15
|
|
|
|
16
|
|
|
// ------------------------------------------------------------------------
|
17
|
|
|
|
18
|
|
|
use O2System\Email\Message;
|
19
|
|
|
use O2System\Email\Spool;
|
20
|
|
|
use O2System\Spl\Traits\Collectors\ErrorCollectorTrait;
|
21
|
|
|
|
22
|
|
|
/**
|
23
|
|
|
* Class AbstractProtocol
|
24
|
|
|
*
|
25
|
|
|
* @package O2System\Email\Abstracts
|
26
|
|
|
*/
|
27
|
|
|
abstract class AbstractProtocol
|
28
|
|
|
{
|
29
|
|
|
use ErrorCollectorTrait;
|
30
|
|
|
|
31
|
|
|
/**
|
32
|
|
|
* AbstractProtocol::$spool
|
33
|
|
|
*
|
34
|
|
|
* @var Spool
|
35
|
|
|
*/
|
36
|
|
|
protected $spool;
|
37
|
|
|
|
38
|
|
|
/**
|
39
|
|
|
* AbstractProtocol::$message
|
40
|
|
|
*
|
41
|
|
|
* @var Message
|
42
|
|
|
*/
|
43
|
|
|
protected $message;
|
44
|
|
|
|
45
|
|
|
// ------------------------------------------------------------------------
|
46
|
|
|
|
47
|
|
|
/**
|
48
|
|
|
* AbstractProtocol constructor.
|
49
|
|
|
*
|
50
|
|
|
* @param \O2System\Email\Spool $spool
|
51
|
|
|
*/
|
52
|
|
|
public function __construct(Spool $spool)
|
53
|
|
|
{
|
54
|
|
|
$this->spool = $spool;
|
55
|
|
|
}
|
56
|
|
|
|
57
|
|
|
/**
|
58
|
|
|
* AbstractProtocol::send
|
59
|
|
|
*
|
60
|
|
|
* Send the message.
|
61
|
|
|
*
|
62
|
|
|
* @param Message $message
|
63
|
|
|
*
|
64
|
|
|
* @return bool
|
65
|
|
|
*/
|
66
|
|
|
public function send(Message $message)
|
67
|
|
|
{
|
68
|
|
|
return $this->sending($message);
|
69
|
|
|
}
|
70
|
|
|
|
71
|
|
|
// ------------------------------------------------------------------------
|
72
|
|
|
|
73
|
|
|
/**
|
74
|
|
|
* AbstractProtocol::sending
|
75
|
|
|
*
|
76
|
|
|
* Protocol message sending process.
|
77
|
|
|
*
|
78
|
|
|
* @param Message $message
|
79
|
|
|
*
|
80
|
|
|
* @return bool
|
81
|
|
|
*/
|
82
|
|
|
abstract protected function sending(Message $message);
|
83
|
|
|
} |