File tree Expand file tree Collapse file tree 7 files changed +21
-11
lines changed
Expand file tree Collapse file tree 7 files changed +21
-11
lines changed Original file line number Diff line number Diff line change 22
33[ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Grade/cdc12dbceac04dc8bbece4012222cd3d )] ( https://app.codacy.com/gh/clegginabox/airlock-php/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade )
44[ ![ Codacy Badge] ( https://app.codacy.com/project/badge/Coverage/cdc12dbceac04dc8bbece4012222cd3d )] ( https://app.codacy.com/gh/clegginabox/airlock-php/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage )
5- ![ PHPCS] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock/tests.yaml?label=phpcs )
6- ![ PHPUnit] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock/tests.yaml?label=tests )
7- ![ E2E] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock/tests.yaml?label=e2e )
5+ ![ PHPCS] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock-php /tests.yaml?label=phpcs )
6+ ![ PHPUnit] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock-php /tests.yaml?label=tests )
7+ ![ E2E] ( https://img.shields.io/github/actions/workflow/status/clegginabox/airlock-php /tests.yaml?label=e2e )
88
99<img width =" 830 " height =" 453 " alt =" airlock-php-red " src =" https://github.com/user-attachments/assets/361fb9d2-00a4-4a11-b8cf-cde4fc951b9f " />
1010
Original file line number Diff line number Diff line change 11<?php
22
3+ /**
4+ * Example 01: Double-click prevention / single-flight.
5+ *
6+ * The lock is acquired in start.php (HTTP layer) for instant feedback.
7+ * This handler receives the serialized key, does the work, and releases the lock.
8+ */
9+
310declare (strict_types=1 );
411
512use Clegginabox \Airlock \Bridge \Symfony \Seal \SymfonyLockSeal ;
815use Symfony \Component \Lock \LockFactory ;
916use Symfony \Component \Lock \Store \RedisStore ;
1017
11- /**
12- * Example 01: Double-click prevention / single-flight.
13- *
14- * The lock is acquired in start.php (HTTP layer) for instant feedback.
15- * This handler receives the serialized key, does the work, and releases the lock.
16- */
1718return static function (Redis $ redis , array $ job , callable $ setStatus ): void {
1819 $ example = '01-lock ' ;
1920 $ clientId = (string )($ job ['clientId ' ] ?? 'anonymous ' );
Original file line number Diff line number Diff line change 11<?php
22
3+ // phpcs:ignoreFile SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable
4+
35declare (strict_types=1 );
46
57require_once __DIR__ . '/../../vendor/autoload.php ' ;
6567$ redis ->lPush ('airlock:examples:jobs ' , json_encode ($ job , JSON_THROW_ON_ERROR ));
6668
6769http_response_code (202 );
68- echo json_encode (['ok ' => true , 'clientId ' => $ clientId ], JSON_THROW_ON_ERROR );
70+ echo json_encode (['ok ' => true , 'clientId ' => $ clientId ], JSON_THROW_ON_ERROR );
Original file line number Diff line number Diff line change 11<?php
22
3+ // phpcs:ignoreFile SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable
4+
35declare (strict_types=1 );
46
57/**
Original file line number Diff line number Diff line change 11<?php
22
3+ // phpcs:ignoreFile SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable
4+
35declare (strict_types=1 );
46
57header ('Content-Type: application/json ' );
2426 exit ;
2527}
2628
27- echo $ data ;
29+ echo $ data ;
Original file line number Diff line number Diff line change 11<?php
22
3+ // phpcs:ignoreFile Generic.Files.SideEffects
4+
35declare (strict_types=1 );
46
57require_once __DIR__ . '/../vendor/autoload.php ' ;
Original file line number Diff line number Diff line change 1010
1111 <!-- Limit PHPCS to these directories -->
1212 <file >src</file >
13+ <file >examples</file >
1314 <file >tests</file >
1415
1516 <!-- Enforce exactly one blank line between methods -->
You can’t perform that action at this time.
0 commit comments