Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82dc312

Browse files
committed
bug #53211 [Notifier] Rework the Smsbox bridge (alexandre-daubois)
This PR was merged into the 7.1 branch. Discussion ---------- [Notifier] Rework the Smsbox bridge | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Rework the whole component to match the rest of the codebase. Commits ------- df88f47 [Notifier] Refactor Smsbox bridge
2 parents e6acb8c + df88f47 commit 82dc312

File tree

13 files changed

+490
-359
lines changed

13 files changed

+490
-359
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Charset: string
15+
{
16+
case Iso1 = 'iso-8859-1';
17+
case Iso15 = 'iso-8859-15';
18+
case Utf8 = 'utf-8';
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Day: int
15+
{
16+
case Monday = 1;
17+
case Tuesday = 2;
18+
case Wednesday = 3;
19+
case Thursday = 4;
20+
case Friday = 5;
21+
case Saturday = 6;
22+
case Sunday = 7;
23+
24+
public function isBeforeOrEqualTo(Day $day): bool
25+
{
26+
return $this->value < $day->value;
27+
}
28+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Encoding: string
15+
{
16+
case Default = 'default';
17+
case Unicode = 'unicode';
18+
case Auto = 'auto';
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Mode: string
15+
{
16+
case Standard = 'Standard';
17+
case Expert = 'Expert';
18+
case Response = 'Reponse';
19+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Strategy: int
15+
{
16+
case Private = 1;
17+
case Notification = 2;
18+
case NotMarketingGroup = 3;
19+
case Marketing = 4;
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Notifier\Bridge\Smsbox\Enum;
13+
14+
enum Udh: int
15+
{
16+
case DisabledConcat = 0;
17+
case SixBytes = 1;
18+
case SevenBytes = 2;
19+
}

src/Symfony/Component/Notifier/Bridge/Smsbox/README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,35 @@ where:
2222
With a SMSBOX Message, you can use the SmsboxOptions class and use the setters to add [message options](https://www.smsbox.net/en/tools-development#developer-space)
2323

2424
```php
25-
use Symfony\Component\Notifier\Message\SmsMessage;
25+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Charset;
26+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Day;
27+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Encoding;
28+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Mode;
29+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Strategy;
30+
use Symfony\Component\Notifier\Bridge\Smsbox\Enum\Udh;
2631
use Symfony\Component\Notifier\Bridge\Smsbox\SmsboxOptions;
32+
use Symfony\Component\Notifier\Message\SmsMessage;
2733

2834
$sms = new SmsMessage('+33123456789', 'Your %1% message %2%');
2935
$options = (new SmsboxOptions())
30-
->mode(SmsboxOptions::MESSAGE_MODE_EXPERT)
31-
->strategy(SmsboxOptions::MESSAGE_STRATEGY_NOT_MARKETING_GROUP)
36+
->mode(Mode::Expert)
37+
->strategy(Strategy::NotMarketingGroup)
3238
->sender('Your sender')
3339
->date('DD/MM/YYYY')
3440
->hour('HH:MM')
35-
->coding(SmsboxOptions::MESSAGE_CODING_UNICODE)
36-
->charset(SmsboxOptions::MESSAGE_CHARSET_UTF8)
37-
->udh(SmsboxOptions::MESSAGE_UDH_DISABLED_CONCAT)
41+
->coding(Encoding::Unicode)
42+
->charset(Charset::Iso1)
43+
->udh(Udh::DisabledConcat)
3844
->callback(true)
3945
->allowVocal(true)
4046
->maxParts(2)
4147
->validity(100)
42-
->daysMinMax(min: SmsboxOptions::MESSAGE_DAYS_TUESDAY, max: SmsboxOptions::MESSAGE_DAYS_FRIDAY)
43-
->hoursMinMax(min: 8, max: 10)
48+
->daysMinMax(min: Day::Tuesday, max: Day::Friday)
49+
->hoursMinMax(min: 8, max: 10)
4450
->variable(['variable1', 'variable2'])
4551
->dateTime(new \DateTime())
4652
->destIso('FR');
4753

4854
$sms->options($options);
4955
$texter->send($sms);
50-
```
56+
```

0 commit comments

Comments
 (0)