Search…
Fluent Syntax
In the documentation, you will see that methods are called “fluently”.
1
<?php
2
3
use WebPush\Payload\AES128GCM;
4
use WebPush\Payload\AESGCM;
5
use WebPush\Payload\PayloadExtension;
6
7
$payloadExtension = PayloadExtension::create()
8
->addContentEncoding(AESGCM::create()->maxPadding())
9
->addContentEncoding(AES128GCM::create()->maxPadding())
10
;
Copied!
If you don’t adhere to this coding style, you are free to use the “standard” way of coding. The following example has the same behavior ase above.
1
<?php
2
3
use WebPush\Payload\AES128GCM;
4
use WebPush\Payload\AESGCM;
5
use WebPush\Payload\PayloadExtension;
6
7
$aesgcm = new AESGCM();
8
$aesgcm->maxPadding();
9
10
$aes128gcm = new AES128GCM();
11
$aes128gcm->maxPadding();
12
13
$payloadExtension = new PayloadExtension();
14
$payloadExtension->addContentEncoding($aesgcm);
15
$payloadExtension->addContentEncoding($aes128gcm);
Copied!
Export as PDF
Copy link