Completed
Push — master ( 4bb011...4b99be )
by Guillaume
13:23
created

OctosendTxtRender::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Starkerxp\CampaignBundle\Render;
4
5
class OctosendTxtRender extends OctosendHtmlRender
6
{
7
    /**
8
     * @var AbstractRender
9
     */
10
    private $htmlToTxtService;
11
12
    /**
13
     * OctosendTxtRender constructor.
14
     *
15
     * @param AbstractRender $htmlToTxtService
16
     */
17
    public function __construct(AbstractRender $htmlToTxtService)
18
    {
19
        $this->htmlToTxtService = $htmlToTxtService;
20
    }
21
22
    public function render()
23
    {
24
25
        $contenu = parent::render();
26
27
        // On finit la conversion en convertissant le reste des élements html en txt
28
        $this->htmlToTxtService->setContenu($contenu);
29
        $contenu = $this->htmlToTxtService->render();
30
31
        return $contenu;
32
    }
33
34
    public function getSupport($api, $version)
35
    {
36
        return strtolower($api) == 'octosend' && $version == 'txt';
37
    }
38
39
    protected function retournerLaChaine($type, $lien, $texte, $style = null)
40
    {
41
        if ($type == "unsub") {
42
            return "[Désinscription]  {{unsubscribe:".$lien."}}";
43
        }
44
45
        return (!empty($texte) && $texte != 'Lien' ? '['.$texte.']' : '').' {{click:'.$lien.'}}';
46
    }
47
48
49
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
50