Skip to content
Snippets Groups Projects

Devel

Merged Piotr Potrebka requested to merge devel into main
Compare and Show latest version
7 files
+ 414
41
Compare changes
  • Side-by-side
  • Inline

Files

+ 43
15
@@ -6,6 +6,11 @@ use Exception;
abstract class EmailAbstract implements EmailInterface {
/**
* @var bool
*/
private $is_enable;
/**
* @var array
*/
@@ -39,12 +44,12 @@ abstract class EmailAbstract implements EmailInterface {
/**
* @var string
*/
protected $type = 'text/html';
protected $type = 'html';
/**
* @var array
*/
protected $headers;
protected $headers = [];
/**
* Define unique email ID.
@@ -53,6 +58,24 @@ abstract class EmailAbstract implements EmailInterface {
*/
abstract public function get_id(): string;
/**
* @return bool
*/
public function get_is_enable(): bool {
return $this->is_enable;
}
/**
* @param $enable
*
* @return EmailAbstract
*/
public function set_is_enable( $enable ): self {
$this->is_enable = $enable;
return $this;
}
/**
* Set placeholders.
*
@@ -197,7 +220,7 @@ abstract class EmailAbstract implements EmailInterface {
*
* @return self
*/
public function set_type( string $type = 'text/html' ): self {
public function set_type( string $type = 'html' ): self {
$this->type = $type;
return $this;
@@ -212,6 +235,22 @@ abstract class EmailAbstract implements EmailInterface {
return $this->type;
}
/**
* Get content type.
*
* @return string
*/
public function get_content_type(): string {
switch ( $this->get_type() ) {
case 'html':
return 'text/html';
case 'multipart':
return 'multipart/alternative';
default:
return 'text/plain';
}
}
/**
* Get email content.
*
@@ -232,18 +271,7 @@ abstract class EmailAbstract implements EmailInterface {
* @throws Exception
*/
public function get_content(): string {
if ( ! $this->content ) {
throw new Exception( 'Empty email content' );
}
return '';
}
/**
* @return mixed
*/
public function get_object() {
return '';
return $this->content;
}
Loading