Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove PhoneNumber. #27

Merged
merged 4 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
build:
environment:
php:
version: '7.3'
nodes:
analysis:
project_setup:
override:
- 'true'
tests:
override:
- php-scrutinizer-run
-
command: phpcs-run
use_website_config: true
tests:
tests:
override:
-
command: 'vendor/bin/pest --coverage-clover=coverage.clover'
coverage:
file: 'coverage.clover'
format: 'clover'
filter:
excluded_paths:
- 'tests/*'
checks:
php: true

coding_style:
php:
indentation:
general:
use_tabs: false
size: 4
switch:
indent_case: true
spaces:
general:
linefeed_character: newline
before_parentheses:
function_declaration: false
closure_definition: true
function_call: false
if: true
for: true
while: true
switch: true
catch: true
array_initializer: false
around_operators:
assignment: true
logical: true
equality: true
relational: true
bitwise: true
additive: true
multiplicative: true
shift: true
unary_additive: false
concatenation: true
negation: false
before_left_brace:
class: true
function: true
if: true
else: true
for: true
while: true
do: true
switch: true
try: true
catch: true
finally: true
before_keywords:
else: true
while: true
catch: true
finally: true
within:
brackets: false
array_initializer: false
grouping: false
function_call: false
function_declaration: false
if: false
for: false
while: false
switch: false
catch: false
type_cast: false
ternary_operator:
before_condition: true
after_condition: true
before_alternative: true
after_alternative: true
in_short_version: false
other:
before_comma: false
after_comma: true
before_semicolon: false
after_semicolon: true
after_type_cast: true
braces:
classes_functions:
class: undefined
function: undefined
closure: undefined
if:
opening: undefined
always: true
else_on_new_line: false
for:
opening: undefined
always: true
while:
opening: undefined
always: true
do_while:
opening: undefined
always: true
while_on_new_line: false
switch:
opening: undefined
try:
opening: undefined
catch_on_new_line: false
finally_on_new_line: false
upper_lower_casing:
keywords:
general: lower
constants:
true_false_null: lower
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ Notification::send($user, new Verification('1111'));

```php
use Illuminate\Support\Facades\Notification;
use Zing\LaravelSms\PhoneNumber;
use Zing\LaravelSms\SmsNumber;
use Zing\LaravelSms\Channels\SmsChannel;

// use channel class name
Notification::route(SmsChannel::class, new PhoneNumber(18188888888, 86))->notify(new Verification('1111'));
Notification::route(SmsChannel::class, new SmsNumber(18188888888, 86))->notify(new Verification('1111'));
// use channel alias
Notification::route('sms', new PhoneNumber(18188888888, 86))->notify(new Verification('1111'));
Notification::route('sms', new SmsNumber(18188888888, 86))->notify(new Verification('1111'));
```

### Facade
Expand Down Expand Up @@ -148,9 +148,9 @@ public function toSms($notifiable)
**NOTE:** Only support for `Zing\LaravelSms\PhoneNumber`

```php
use Zing\LaravelSms\PhoneNumber;
use Zing\LaravelSms\SmsNumber;

(new PhoneNumber(18188888888))->notify(new Verification('1111'));
(new SmsNumber(18188888888))->notify(new Verification('1111'));
```


Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"require": {
"php": "^7.2.5",
"php": "^7.3",
"ext-json": "*",
"graham-campbell/manager": "^4.5",
"illuminate/notifications": "^6.0|^7.0|^8.0",
Expand Down
3 changes: 2 additions & 1 deletion src/PhoneNumber.php → src/SmsNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
namespace Zing\LaravelSms;

use Illuminate\Notifications\Notifiable;
use Overtrue\EasySms\PhoneNumber;

class PhoneNumber extends \Overtrue\EasySms\PhoneNumber
class SmsNumber extends PhoneNumber
{
use Notifiable;

Expand Down
4 changes: 2 additions & 2 deletions tests/Datasets/NumberWithMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

use Zing\LaravelSms\PhoneNumber;
use Zing\LaravelSms\SmsMessage;
use Zing\LaravelSms\SmsNumber;

dataset(
'numbers',
[
['18888888888', 'This is a test message.'],
[new PhoneNumber('18888888888', '+86'), SmsMessage::text('This is a test message.')],
[new SmsNumber('18888888888', '+86'), SmsMessage::text('This is a test message.')],
]
);
4 changes: 2 additions & 2 deletions tests/PhoneNumberTest.php → tests/SmsNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Zing\LaravelSms\Tests;

use Zing\LaravelSms\PhoneNumber;
use Zing\LaravelSms\SmsNumber;

it(
'can notify',
function (): void {
$phone = new PhoneNumber('18188888888');
$phone = new SmsNumber('18188888888');
$notification = new VerifyCode();
prepareLoggerExpectation()->with(sendString($phone->routeNotificationForSms($notification), $notification->toSms($phone)));
$phone->notify($notification);
Expand Down