GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Certificates::details()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Cloudflare;
4
5
/**
6
 * CloudFlare API wrapper
7
 *
8
 * CloudFlare CA
9
 * API to create CloudFlare-issued SSL certificates that can be installed on your origin server.
10
 * Use your Certificates API Key as your User Service Key when calling these endpoints
11
 * (see the section on request headers for details)
12
 *
13
 * @author James Bell <[email protected]>
14
 *
15
 * @version 1
16
 */
17
class Certificates extends Api
18
{
19
    /**
20
     * List Certificates
21
     * List all existing CloudFlare-issued Certificates for a given zone. Use your Certificates API Key as your
22
     * User Service Key when calling this endpoint
23
     */
24
    public function certificates($page = null, $per_page = null, $direction = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style Best Practice introduced by
Please use __construct() instead of a PHP4-style constructor that is named after the class.
Loading history...
25
    {
26
        $data = [
27
            'page'      => $page,
28
            'per_page'  => $per_page,
29
            'direction' => $direction,
30
        ];
31
32
        return $this->get('certificates', $data);
33
    }
34
35
    /**
36
     * Create Certificate
37
     * Create a CloudFlare-signed certificate. Use your Certificates API Key as your User Service Key when
38
     * calling this endpoint
39
     *
40
     * @param array    $hostnames          Array of hostnames or wildcard names (e.g., *.example.com) bound to the certificate
41
     * @param string   $request_type       Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers)
42
     * @param string   $csr                The Certificate Signing Request (CSR). Must be newline-encoded.
43
     * @param int|null $requested_validity The number of days for which the certificate should be valid
44
     */
45
    public function create($hostnames, $request_type, $csr, $requested_validity = null)
46
    {
47
        $data = [
48
            'hostnames'          => $hostnames,
49
            'request_type'       => $request_type,
50
            'csr'                => $csr,
51
            'requested_validity' => $requested_validity,
52
        ];
53
54
        return $this->post('certificates', $data);
55
    }
56
57
    /**
58
     * Certificate Details
59
     * Get an existing certificate by its serial number. Use your Certificates API Key as your User Service Key
60
     * when calling this endpoint
61
     *
62
     * @param string $identifier API item identifier tag
63
     */
64
    public function details($identifier)
65
    {
66
        return $this->get('certificates/'.$identifier);
67
    }
68
69
    /**
70
     * Revoke certificate
71
     * Revoke a created certificate for a zone. Use your Certificates API Key as your User Service Key when
72
     * calling this endpoint
73
     *
74
     * @param string $identifier API item identifier tag
75
     */
76
    public function revoke($identifier)
77
    {
78
        return $this->delete('certificates/'.$identifier);
79
    }
80
}
81