Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WP Mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
Library
WP Mail
Merge requests
!2
Devel
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Devel
devel
into
main
Overview
44
Commits
35
Pipelines
34
Changes
5
Merged
Piotr Potrebka
requested to merge
devel
into
main
2 years ago
Overview
44
Commits
35
Pipelines
34
Changes
5
0
0
Merge request reports
Viewing commit
de65272a
Prev
Next
Show latest version
5 files
+
104
−
103
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
de65272a
feat: email abstract
· de65272a
Piotr Potrebka
authored
2 years ago
src/Abstracts/EmailAbstract.php deleted
100644 → 0
+
0
−
122
View file @ 53209129
<?php
namespace
WPDesk\Library\WPEmail\Abstracts
;
use
WPDesk\View\Renderer\Renderer
;
abstract
class
EmailAbstract
implements
EmailInterface
{
/**
* @var Renderer
*/
private
$renderer
;
public
function
__construct
(
Renderer
$renderer
,
array
$recipients
)
{
$this
->
renderer
=
$renderer
;
$this
->
recipients
=
$recipients
;
}
/**
* Define unique email ID.
*
* @return string
*/
abstract
public
function
get_id
():
string
;
/**
* Get defined placeholders.
*
* @return string[]
*/
public
function
get_placeholders
():
array
{
return
[];
}
/**
* Get email subject.
*
* @return string
*/
public
function
get_subject
():
string
{
if
(
!
$this
->
subject
)
{
throw
new
\Exception
(
'Empty email subject'
);
}
return
''
;
}
/**
* Get email heading.
*
* @return string
*/
public
function
get_heading
():
string
{
return
''
;
}
/**
* Get valid recipients.
*
* @return string[]
*/
public
function
get_recipients
():
array
{
return
$this
->
recipients
;
}
/**
* Get email headers.
*
* @return string[]
*/
public
function
get_headers
():
array
{
return
[];
}
/**
* Get email attachments.
*
* @return array
*/
public
function
get_attachments
():
array
{
return
[];
}
/**
* Get email type.
*
* @return string
*/
public
function
get_type
():
string
{
return
'text/html'
;
}
/**
* Get email content.
*
* @return string
*/
public
function
get_content
():
string
{
if
(
!
$this
->
content
)
{
throw
new
\Exception
(
'Empty email subject'
);
}
return
''
;
}
/**
* @return mixed
*/
public
function
get_object
()
{
return
''
;
}
/**
* Get email content.
*
* @return string
*/
public
function
render
():
string
{
return
$this
->
renderer
->
render
(
dirname
(
__DIR__
)
.
'/html/default.php'
,
[
'content'
=>
$this
->
get_content
(),
'heading'
=>
$this
->
get_heading
(),
'object'
=>
$this
->
get_object
()
]
);
}
}
Loading