Issues (18)

examples/exampleDNSInit.php (3 issues)

Labels
Severity
1
<?php
2
namespace Elphin\LEClient;
3
4
require_once(__DIR__.'/../vendor/autoload.php');
5
6
//Sets the maximum execution time to two minutes, to be sure.
7
ini_set('max_execution_time', 120);
8
9
// Listing the contact information in case a new account has to be created.
10
$email = array('[email protected]');
11
// Defining the base name for this order
12
//$basename = 'example.org';
13
// Listing the domains to be included on the certificate
14
//$domains = array('example.org', 'test.example.org');
15
16
$email = ['[email protected]'];
17
$basename = 'le.dixo.net';
18
$domains=['le.dixo.net'];
19
20
$logger = new DiagnosticLogger;
0 ignored issues
show
The type Elphin\LEClient\DiagnosticLogger 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
22
try {
23
// Initiating the client instance. In this case using the staging server (argument 2) and outputting all status
24
// and debug information (argument 3).
25
    $client = new LEClient($email, true, $logger);
0 ignored issues
show
The type Elphin\LEClient\LEClient 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
// Initiating the order instance. The keys and certificate will be stored in /example.org/ (argument 1) and the
27
// domains in the array (argument 2) will be on the certificate.
28
    $order = $client->getOrCreateOrder($basename, $domains);
29
// Check whether there are any authorizations pending. If that is the case, try to verify the pending authorizations.
30
    if (!$order->allAuthorizationsValid()) {
31
        // Get the DNS challenges from the pending authorizations.
32
        $pending = $order->getPendingAuthorizations(LEOrder::CHALLENGE_TYPE_DNS);
0 ignored issues
show
The type Elphin\LEClient\LEOrder 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
33
        // Walk the list of pending authorization DNS challenges.
34
        if (!empty($pending)) {
35
            foreach ($pending as $challenge) {
36
                // For the purpose of this example, a fictitious functions creates or updates the ACME challenge DNS
37
                // record for this domain.
38
                //setDNSRecord($challenge['identifier'], $challenge['DNSDigest']);
39
                printf(
40
                    "DNS Challengage identifier = %s digest = %s\n",
41
                    $challenge['identifier'],
42
                    $challenge['DNSDigest']
43
                );
44
            }
45
        }
46
    }
47
}
48
catch (\Exception $e) {
49
    echo $e->getMessage()."\n";
50
    echo $e->getTraceAsString()."\n";
51
52
    echo "\nDiagnostic logs\n";
53
    $logger->dumpConsole();
54
    exit;
55
}
56
57
echo "\nDiagnostic logs\n";
58
$logger->dumpConsole();
59
60