66# php-lock/lock
77
88[ ![ Latest Stable Version] ( https://poser.pugx.org/malkusch/lock/version )] ( https://packagist.org/packages/malkusch/lock )
9- [ ![ Total Downloads] ( https://poser.pugx.org/malkusch/lock/downloads )] ( https://packagist.org/packages/malkusch/lock )
9+ [ ![ Total Downloads] ( https://poser.pugx.org/malkusch/lock/downloads )] ( https://packagist.org/packages/malkusch/lock/stats )
1010[ ![ Build Status] ( https://github.com/php-lock/lock/actions/workflows/test-unit.yml/badge.svg?branch=master )] ( https://github.com/php-lock/lock/actions?query=branch:master )
1111[ ![ License] ( https://poser.pugx.org/malkusch/lock/license )] ( https://packagist.org/packages/malkusch/lock )
1212
@@ -72,7 +72,7 @@ $newBalance = $mutex->synchronized(function () use (
7272 $balance = $bankAccount->getBalance();
7373 $balance -= $amount;
7474 if ($balance < 0) {
75- throw new \DomainException('You have no credit. ');
75+ throw new \DomainException('You have no credit');
7676 }
7777 $bankAccount->setBalance($balance);
7878
@@ -120,7 +120,7 @@ $newBalance = $mutex->check(function () use ($bankAccount, $amount): bool {
120120
121121if ($newBalance === false) {
122122 if ($balance < 0) {
123- throw new \DomainException('You have no credit. ');
123+ throw new \DomainException('You have no credit');
124124 }
125125}
126126```
@@ -210,7 +210,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
210210 $balance = $bankAccount->getBalance();
211211 $balance -= $amount;
212212 if ($balance < 0) {
213- throw new \DomainException('You have no credit. ');
213+ throw new \DomainException('You have no credit');
214214 }
215215 $bankAccount->setBalance($balance);
216216});
@@ -234,7 +234,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
234234 $balance = $bankAccount->getBalance();
235235 $balance -= $amount;
236236 if ($balance < 0) {
237- throw new \DomainException('You have no credit. ');
237+ throw new \DomainException('You have no credit');
238238 }
239239 $bankAccount->setBalance($balance);
240240});
@@ -261,7 +261,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
261261 $balance = $bankAccount->getBalance();
262262 $balance -= $amount;
263263 if ($balance < 0) {
264- throw new \DomainException('You have no credit. ');
264+ throw new \DomainException('You have no credit');
265265 }
266266 $bankAccount->setBalance($balance);
267267});
@@ -282,7 +282,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
282282 $balance = $bankAccount->getBalance();
283283 $balance -= $amount;
284284 if ($balance < 0) {
285- throw new \DomainException('You have no credit. ');
285+ throw new \DomainException('You have no credit');
286286 }
287287 $bankAccount->setBalance($balance);
288288});
@@ -301,7 +301,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
301301 $balance = $bankAccount->getBalance();
302302 $balance -= $amount;
303303 if ($balance < 0) {
304- throw new \DomainException('You have no credit. ');
304+ throw new \DomainException('You have no credit');
305305 }
306306 $bankAccount->setBalance($balance);
307307});
@@ -330,7 +330,7 @@ $mutex->synchronized(function () use ($pdo, $accountId, $amount) {
330330
331331 $balance -= $amount;
332332 if ($balance < 0) {
333- throw new \DomainException('You have no credit. ');
333+ throw new \DomainException('You have no credit');
334334 }
335335 $pdo->prepare('UPDATE account SET balance = ? WHERE id = ?')
336336 ->execute([$balance, $accountId]);
@@ -361,7 +361,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
361361 $balance = $bankAccount->getBalance();
362362 $balance -= $amount;
363363 if ($balance < 0) {
364- throw new \DomainException('You have no credit. ');
364+ throw new \DomainException('You have no credit');
365365 }
366366 $bankAccount->setBalance($balance);
367367});
@@ -387,7 +387,7 @@ $mutex->synchronized(function () use ($bankAccount, $amount) {
387387 $balance = $bankAccount->getBalance();
388388 $balance -= $amount;
389389 if ($balance < 0) {
390- throw new \DomainException('You have no credit. ');
390+ throw new \DomainException('You have no credit');
391391 }
392392 $bankAccount->setBalance($balance);
393393});
0 commit comments