Skip to content
Snippets Groups Projects

Devel

Merged Piotr Potrebka requested to merge devel into main
4 files
+ 51
45
Compare changes
  • Side-by-side
  • Inline

Files

@@ -4,25 +4,52 @@ namespace WPDesk\Library\WPEmail\Abstracts;
use WPDesk\View\Renderer\Renderer;
abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionInterface {
abstract class EmailAbstract implements EmailGettersInterface {
/**
* @var Renderer
* @var array
*/
private $renderer;
private $recipients = [];
/**
* @var array
*/
private $placeholders = [];
/**
* @var string
*/
private $subject = '';
/**
* @var string
*/
private $heading = '';
/**
* @var array
*/
private $attachments = [];
/**
* @var string
*/
private $subject;
private $content = '';
/**
* @var string
*/
private $heading;
private $type = 'text/html';
/**
* @var array
*/
private $headers;
public function __construct( Renderer $renderer, array $recipients ) {
/**
* @var Renderer
*/
private $renderer;
public function __construct( Renderer $renderer ) {
$this->renderer = $renderer;
$this->recipients = $recipients;
}
/**
@@ -38,27 +65,21 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
* @return string[]
*/
public function get_placeholders(): array {
return [];
return $this->placeholders;
}
/**
* Get email subject.
*
* @return string
* @throws \Exception
*/
public function get_subject(): string {
if ( ! $this->subject ) {
throw new \Exception( 'Empty email subject' );
}
return '';
}
public function set_subject( string $subject ): self {
$this->subject = $subject;
return $this;
return $this->subject;
}
/**
@@ -67,14 +88,7 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
* @return string
*/
public function get_heading(): string {
return '';
}
public function set_heading( string $heading ): self {
$this->heading = $heading;
return $this;
return $this->heading;
}
/**
@@ -92,7 +106,7 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
* @return string[]
*/
public function get_headers(): array {
return [];
return $this->headers;
}
/**
@@ -101,7 +115,7 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
* @return array
*/
public function get_attachments(): array {
return [];
return $this->attachments;
}
/**
@@ -110,7 +124,7 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
* @return string
*/
public function get_type(): string {
return 'text/html';
return $this->type;
}
/**
@@ -142,8 +156,4 @@ abstract class EmailGettersAbstract implements EmailGettersInterface, ConditionI
return $this->renderer->render( dirname( __DIR__ ) . '/html/default.php', [ 'content' => $this->get_content(), 'heading' => $this->get_heading(), 'object' => $this->get_object() ] );
}
public function is_valid(): bool {
return true;
}
}
Loading