1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace PhpLightning\Invoice; |
||
6 | |||
7 | use Gacela\Framework\AbstractFactory; |
||
8 | use PhpLightning\Invoice\Application\CallbackUrl; |
||
0 ignored issues
–
show
|
|||
9 | use PhpLightning\Invoice\Application\InvoiceGenerator; |
||
0 ignored issues
–
show
The type
PhpLightning\Invoice\Application\InvoiceGenerator was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
10 | use PhpLightning\Invoice\Domain\BackendInvoice\BackendInvoiceInterface; |
||
11 | use PhpLightning\Invoice\Domain\BackendInvoice\LnbitsBackendInvoice; |
||
12 | use PhpLightning\Invoice\Domain\CallbackUrl\CallbackUrlInterface; |
||
13 | use PhpLightning\Invoice\Domain\CallbackUrl\LnAddressGenerator; |
||
14 | use PhpLightning\Invoice\Domain\CallbackUrl\LnAddressGeneratorInterface; |
||
15 | use PhpLightning\Invoice\Domain\Http\HttpApiInterface; |
||
16 | |||
17 | /** |
||
18 | * @method InvoiceConfig getConfig() |
||
19 | */ |
||
20 | final class InvoiceFactory extends AbstractFactory |
||
21 | { |
||
22 | 1 | public function createCallbackUrl(string $username): CallbackUrlInterface |
|
23 | { |
||
24 | 1 | if ($username !== '') { |
|
25 | 1 | $this->validateUserExists($username); |
|
26 | } |
||
27 | |||
28 | 1 | return new CallbackUrl( |
|
29 | 1 | $this->getConfig()->getSendableRange(), |
|
30 | 1 | $this->createLnAddressGenerator(), |
|
31 | 1 | $this->getConfig()->getCallback(), |
|
32 | 1 | $this->getConfig()->getDescriptionTemplate(), |
|
33 | ); |
||
34 | } |
||
35 | 1 | ||
36 | public function createInvoiceGenerator(string $username): InvoiceGenerator |
||
37 | 1 | { |
|
38 | 1 | return new InvoiceGenerator( |
|
39 | 1 | $this->getBackendForUser($username), |
|
40 | 1 | $this->getConfig()->getSendableRange(), |
|
41 | 1 | $this->getConfig()->getDefaultLnAddress(), |
|
42 | $this->getConfig()->getDescriptionTemplate(), |
||
43 | $this->getConfig()->getSuccessMessage(), |
||
44 | 1 | ); |
|
45 | } |
||
46 | 1 | ||
47 | 1 | private function createLnAddressGenerator(): LnAddressGeneratorInterface |
|
48 | 1 | { |
|
49 | 1 | return new LnAddressGenerator( |
|
50 | $this->getConfig()->getDefaultLnAddress(), |
||
51 | $this->getConfig()->getDomain(), |
||
52 | 1 | ); |
|
53 | } |
||
54 | 1 | ||
55 | 1 | private function getBackendForUser(string $username): BackendInvoiceInterface |
|
56 | 1 | { |
|
57 | 1 | return new LnbitsBackendInvoice( |
|
58 | $this->getHttpApi(), |
||
59 | $this->getConfig()->getBackendOptionsFor($username), |
||
60 | 1 | ); |
|
61 | } |
||
62 | 1 | ||
63 | private function getHttpApi(): HttpApiInterface |
||
64 | { |
||
65 | 1 | return $this->getProvidedDependency(InvoiceDependencyProvider::HTTP_API); |
|
66 | } |
||
67 | 1 | ||
68 | private function validateUserExists(string $username): void |
||
69 | { |
||
70 | $this->getConfig()->getBackendOptionsFor($username); |
||
71 | } |
||
72 | } |
||
73 |
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