Skip to content

Commit 6c28280

Browse files
author
Ethan Ransdell
committed
Add make function for verbs
1 parent 7c55947 commit 6c28280

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ try {
8383

8484
```php
8585

86-
$speakSentence = new BandwidthLib\Voice\Bxml\SpeakSentence("Hello!");
87-
$speakSentence->voice("susan");
88-
$speakSentence->locale("en_US");
89-
$speakSentence->gender("female");
90-
$response = new BandwidthLib\Voice\Bxml\Response();
91-
$response->addVerb($speakSentence);
86+
$speakSentence = BandwidthLib\Voice\Bxml\SpeakSentence::make("Hello!")
87+
->voice("susan")
88+
->locale("en_US")
89+
->gender("female");
90+
$response = BandwidthLib\Voice\Bxml\Response::make()
91+
->addVerb($speakSentence);
9292
echo $response->toBxml();
9393
```
9494

src/Voice/Bxml/Verb.php

+3
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ abstract class Verb {
2222
*/
2323
abstract protected function toBxml(DOMDocument $doc): DOMElement;
2424

25+
public static function make(): static {
26+
return new static(...func_get_args());
27+
}
2528
}

0 commit comments

Comments
 (0)