php-lightning /
lnaddress
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace PhpLightning\Invoice; |
||
| 6 | |||
| 7 | use Gacela\Framework\AbstractConfig; |
||
| 8 | use PhpLightning\Shared\Value\SendableRange; |
||
|
0 ignored issues
–
show
|
|||
| 9 | use RuntimeException; |
||
| 10 | |||
| 11 | use function sprintf; |
||
| 12 | |||
| 13 | 1 | final class InvoiceConfig extends AbstractConfig |
|
| 14 | { |
||
| 15 | 1 | public function getCallback(): string |
|
| 16 | { |
||
| 17 | return (string)$this->get('callback-url', 'undefined:callback-url'); |
||
| 18 | 2 | } |
|
| 19 | |||
| 20 | 2 | public function getDefaultLnAddress(): string |
|
| 21 | { |
||
| 22 | return sprintf('%s@%s', $this->getReceiver(), $this->getDomain()); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | 2 | * @return array<string,array> |
|
| 27 | */ |
||
| 28 | public function getBackends(): array |
||
| 29 | 2 | { |
|
| 30 | /** @psalm-suppress MixedReturnTypeCoercion */ |
||
| 31 | return (array)$this->get('backends'); // @phpstan-ignore-line |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return array{ |
||
|
0 ignored issues
–
show
|
|||
| 36 | * api_endpoint: string, |
||
| 37 | * api_key: string, |
||
| 38 | 2 | * } |
|
| 39 | */ |
||
| 40 | public function getBackendOptionsFor(string $username): array |
||
| 41 | 2 | { |
|
| 42 | /** @var array{api_endpoint?: string, api_key?: string} $result */ |
||
| 43 | 2 | $result = $this->getBackends()[$username] ?? []; |
|
| 44 | |||
| 45 | if (!isset($result['api_endpoint'], $result['api_key'])) { |
||
| 46 | throw new RuntimeException('Missing backend options for ' . $username); |
||
| 47 | 2 | } |
|
| 48 | |||
| 49 | return $result; |
||
| 50 | 2 | } |
|
| 51 | |||
| 52 | 2 | public function getSendableRange(): SendableRange |
|
| 53 | { |
||
| 54 | return $this->get('sendable-range', SendableRange::default()); |
||
| 55 | 2 | } |
|
| 56 | |||
| 57 | 2 | public function getDescriptionTemplate(): string |
|
| 58 | { |
||
| 59 | return (string)$this->get('description-template', 'Pay to %s'); |
||
| 60 | 2 | } |
|
| 61 | |||
| 62 | 2 | public function getSuccessMessage(): string |
|
| 63 | { |
||
| 64 | return (string)$this->get('success-message', 'Payment received!'); |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getDomain(): string |
||
| 68 | { |
||
| 69 | return (string)$this->get('domain', $_SERVER['HTTP_HOST'] ?? 'localhost'); |
||
| 70 | } |
||
| 71 | |||
| 72 | private function getReceiver(): string |
||
| 73 | { |
||
| 74 | return (string)$this->get('receiver', $_SERVER['REQUEST_URI'] ?? 'unknown-receiver'); |
||
| 75 | } |
||
| 76 | } |
||
| 77 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths