Completed
Push — master ( 153a0b...cff926 )
by Freek
01:29
created

replaceSubscriberAttributes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Spatie\EmailCampaigns\Actions;
4
5
use Spatie\EmailCampaigns\Models\Campaign;
6
use Spatie\EmailCampaigns\Models\CampaignSend;
7
use Spatie\EmailCampaigns\Http\Controllers\UnsubscribeController;
8
use Spatie\EmailCampaigns\Models\Subscriber;
9
10
class PersonalizeHtmlAction
11
{
12
    public function execute($html, CampaignSend $pendingSend)
13
    {
14
        $subscription = $pendingSend->subscription;
15
16
        $html = str_replace('::campaignSendUuid::', $pendingSend->uuid, $html);
17
        $html = str_replace('::subscriptionUuid::', $subscription->uuid, $html);
18
        $html = str_replace('::subscriber.uuid::', $subscription->subscriber->uuid, $html);
19
        $html = str_replace('::unsubscribeUrl::', action(UnsubscribeController::class, $subscription->uuid), $html);
20
21
        $html = $this->replaceSubscriberAttributes($html, $subscription->subscriber);
22
23
        return $html;
24
    }
25
26
    protected function replaceSubscriberAttributes(string $html, Subscriber $subscriber): string
0 ignored issues
show
Unused Code introduced by
The parameter $subscriber is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
    {
28
        /*
29
        $html = str_replace('::subscriber.uuid::', $subscriber->uuid, $html);
30
        $html = str_replace('::subscriber.extra_attributes.first_name::', 'John', $html);
31
        */
32
33
        return $html;
34
    }
35
}
36