Passed
Branch master (1abeda)
by John
05:13 queued 02:38
created

AuthnetWebhooksRequest::getByUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
0 ignored issues
show
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "AuthnetWebhooksRequest.php" doesn't match the expected filename "authnetwebhooksrequest.php"
Loading history...
2
3
declare(strict_types=1);
4
5
/**
0 ignored issues
show
Coding Style introduced by
Block comments must be started with /*
Loading history...
6
 * This file is part of the AuthnetJSON package.
7
 *
8
 * (c) John Conde <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace JohnConde\Authnet;
15
16
use Curl\Curl;
17
18
/**
19
 * Creates a request to the Authorize.Net Webhooks endpoints
20
 *
21
 * @package     AuthnetJSON
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 3 spaces but found 5
Loading history...
22
 * @author      John Conde <[email protected]>
0 ignored issues
show
Coding Style introduced by
Tag value for @author tag indented incorrectly; expected 4 spaces but found 6
Loading history...
23
 * @copyright   John Conde <[email protected]>
0 ignored issues
show
Coding Style introduced by
Tag value for @copyright tag indented incorrectly; expected 1 spaces but found 3
Loading history...
24
 * @license     http://www.apache.org/licenses/LICENSE-2.0.html Apache License, Version 2.0
0 ignored issues
show
Coding Style introduced by
Tag value for @license tag indented incorrectly; expected 3 spaces but found 5
Loading history...
25
 * @link        https://github.com/stymiee/authnetjson
0 ignored issues
show
Coding Style introduced by
Tag value for @link tag indented incorrectly; expected 6 spaces but found 8
Loading history...
26
 * @see         https://developer.authorize.net/api/reference/features/webhooks.html
0 ignored issues
show
Coding Style introduced by
Tag value for @see tag indented incorrectly; expected 7 spaces but found 9
Loading history...
27
 */
28
class AuthnetWebhooksRequest
29
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class AuthnetWebhooksRequest
Loading history...
30
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
31
     * @var     string  Base URL for processing a webhook
0 ignored issues
show
Coding Style introduced by
Tag value for @var tag indented incorrectly; expected 1 spaces but found 5
Loading history...
32
     */
33
    private $url;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
Coding Style introduced by
Private member variable "url" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "url" must be prefixed with an underscore
Loading history...
34
35
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
36
     * @var     string  Endpoint for processing a webhook
0 ignored issues
show
Coding Style introduced by
Tag value for @var tag indented incorrectly; expected 1 spaces but found 5
Loading history...
37
     */
38
    private $endpoint;
0 ignored issues
show
Coding Style introduced by
Private member variable "endpoint" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "endpoint" must be prefixed with an underscore
Loading history...
39
40
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
41
     * @var     string  JSON formatted API request
0 ignored issues
show
Coding Style introduced by
Tag value for @var tag indented incorrectly; expected 1 spaces but found 5
Loading history...
42
     */
43
    private $requestJson;
0 ignored issues
show
Coding Style introduced by
Private member variable "requestJson" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "requestJson" must be prefixed with an underscore
Loading history...
44
45
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
46
     * @var     object  Wrapper object representing an endpoint
0 ignored issues
show
Coding Style introduced by
Tag value for @var tag indented incorrectly; expected 1 spaces but found 5
Loading history...
47
     */
48
    private $processor;
0 ignored issues
show
Coding Style introduced by
Private member variable "processor" must contain a leading underscore
Loading history...
Coding Style introduced by
Private member variable "processor" must be prefixed with an underscore
Loading history...
49
50
    /**
51
     * Creates the request object by setting the Authorize.Net credentials and URL of the endpoint to be used
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 109 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
52
     * for the API call
53
     *
54
     * @param   string  $api_url            URL endpoint for processing a transaction
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 1 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 12 found
Loading history...
55
     */
56 1
    public function __construct($api_url)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Type hint "string" missing for $api_url
Loading history...
Coding Style introduced by
Variable "api_url" is not in valid camel caps format
Loading history...
Coding Style introduced by
$api_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
57
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
58 1
        $this->url = $api_url;
0 ignored issues
show
Coding Style introduced by
Variable "api_url" is not in valid camel caps format
Loading history...
Coding Style introduced by
$api_url does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
59 1
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end __construct()
Loading history...
60
61
    /**
62
     * Outputs the account credentials, endpoint URL, and request JSON in a human readable format
63
     *
64
     * @return  string  HTML table containing debugging information
0 ignored issues
show
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
65
     */
66 2
    public function __toString()
67
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
68 2
        $output  = '<table id="authnet-request">'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
69 2
        $output .= '<caption>Authorize.Net Request</caption>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
70 2
        $output .= '<tr><th colspan="2"><b>Class Parameters</b></th></tr>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
71 2
        $output .= '<tr><td><b>Authnet Server URL</b></td><td>'.$this->url.'</td></tr>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
72 2
        $output .= '<tr><th colspan="2"><b>Request JSON</b></th></tr>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
73 2
        if (!empty($this->requestJson)) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space(s) after NOT operator; 0 found
Loading history...
74 1
            $output .= '<tr><td colspan="2"><pre>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
75 1
            $output .= $this->requestJson."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
76 1
            $output .= '</pre></td></tr>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
77
        } else {
78 1
            $output .= '<tr><td colspan="2" style="text-align: center;"><pre>N/A</pre></td></tr>'."\n";
0 ignored issues
show
Coding Style introduced by
Expected at least 1 space before "."; 0 found
Loading history...
Coding Style introduced by
Expected at least 1 space after "."; 0 found
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 103 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
79
        }
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
80 2
        $output .= '</table>';
81
82 2
        return $output;
83
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end __toString()
Loading history...
84
85
    /**
86
     * Creates a new webhook
87
     *
88
     * @param   array   $webhooks   Array of webhooks to be created or modified
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 3 found
Loading history...
89
     * @param   string  $webhookUrl URL of where webhook notifications will be sent
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
90
     * @param   string  $status     Status of webhooks to be created or modified [active/inactive]
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
91
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
92
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
93
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
94
     */
95 1 View Code Duplication
    public function createWebhooks(array $webhooks, string $webhookUrl, string $status = 'active') : object
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$status" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$status"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 107 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
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...
96
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
97 1
        $this->endpoint = 'webhooks';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
98 1
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
99
        $request = [
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
100 1
            'url'        => $webhookUrl,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
101 1
            'eventTypes' => $webhooks,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
102 1
            'status'     => $status
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
Coding Style introduced by
Each line in an array declaration must end in a comma
Loading history...
103
        ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 19 space(s), but found 8.
Loading history...
104 1
        $this->requestJson = json_encode($request);
105 1
        $response = $this->post($this->url, $this->requestJson);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
106 1
        return new AuthnetWebhooksResponse($response);
107
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end createWebhooks()
Loading history...
108
109
    /**
110
     * Sends a test ping to a URL for (a) designated webhook(s)
111
     *
112
     * @param   string   $webhookId   Webhook ID to be tested
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 3 found
Loading history...
113
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
114
     */
0 ignored issues
show
introduced by
Missing @return tag in function comment
Loading history...
115 1
    public function testWebhook(string $webhookId) : void
116
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
117 1
        $this->endpoint = 'webhooks';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
118 1
        $this->url = sprintf('%s%s/%s/pings', $this->url, $this->endpoint, $webhookId);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
119 1
        $this->requestJson = json_encode([]);
120 1
        $this->post($this->url, $this->requestJson);
121 1
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end testWebhook()
Loading history...
122
123
    /**
124
     * Gets all of the available event types
125
     *
126
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
127
     * @throws  AuthnetCurlException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
128
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
129
     */
130 1
    public function getEventTypes() : object
131
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
132 1
        $this->endpoint = 'eventtypes';
133 1
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
134 1
        return $this->getByUrl($this->url);
135
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getEventTypes()
Loading history...
136
137
    /**
138
     * List all of your webhooks
139
     *
140
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
141
     * @throws  AuthnetCurlException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
142
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
143
     */
144 1
    public function getWebhooks() : object
145
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
146 1
        $this->endpoint = 'webhooks';
147 1
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
148 1
        return $this->getByUrl($this->url);
149
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getWebhooks()
Loading history...
150
151
    /**
152
     * Get a webhook
153
     *
154
     * @param   string   $webhookId   Webhook ID to be retrieved
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 3 found
Loading history...
155
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
156
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
157
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
158
     */
159 1
    public function getWebhook(string $webhookId) : object
160
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
161 1
        $this->endpoint = 'webhooks';
162 1
        $this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
163 1
        return $this->getByUrl($this->url);
164
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getWebhook()
Loading history...
165
166
    /**
167
     * GET API request
168
     *
169
     * @param   string $url API endpoint to hit
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
170
     * @return  object
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
171
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
172
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
173
     */
174 3
    private function getByUrl(string $url) : object
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::getByUrl" must be prefixed with an underscore
Loading history...
175
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
176 3
        $response = $this->get($url);
177 3
        return new AuthnetWebhooksResponse($response);
178
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getByUrl()
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
179
180
    /**
181
     * Updates webhook event types
182
     *
183
     * @param   string  $webhookId      Webhook ID to be modified
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 6 found
Loading history...
184
     * @param   string  $webhookUrl     URL of where webhook notifications will be sent
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 5 found
Loading history...
185
     * @param   array   $eventTypes     Array of event types to be added/removed
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 5 found
Loading history...
186
     * @param   string  $status         Status of webhooks to be modified [active/inactive]
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 5 spaces after parameter name; 9 found
Loading history...
187
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
188
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
189
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
190
     */
191 1 View Code Duplication
    public function updateWebhook(string $webhookId, string $webhookUrl, array $eventTypes, string $status = 'active') : object
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$status" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$status"; expected 0 but found 1
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
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...
192
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
193 1
        $this->endpoint = 'webhooks';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
194 1
        $this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 9 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
195
        $request = [
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
196 1
            'url'        => $webhookUrl,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
197 1
            'eventTypes' => $eventTypes,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
198 1
            'status'     => $status
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 20 spaces, but found 12.
Loading history...
Coding Style introduced by
Each line in an array declaration must end in a comma
Loading history...
199
        ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 19 space(s), but found 8.
Loading history...
200 1
        $this->requestJson = json_encode($request);
201 1
        $response = $this->put($this->url, $this->requestJson);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
202 1
        return new AuthnetWebhooksResponse($response);
203
    }
0 ignored issues
show
Coding Style introduced by
Expected //end updateWebhook()
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
204
205
    /**
206
     * Delete a webhook
207
     *
208
     * @param   string   $webhookId   Webhook ID to be deleted
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 3 found
Loading history...
209
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
210
     */
0 ignored issues
show
introduced by
Missing @return tag in function comment
Loading history...
211 1
    public function deleteWebhook(string $webhookId) : void
212
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
213 1
        $this->endpoint = 'webhooks';
214 1
        $this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
215 1
        $this->delete($this->url);
216 1
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end deleteWebhook()
Loading history...
217
218
    /**
219
     * Retrieve Notification History
220
     *
221
     * @param   int   $limit    Default: 1000
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter name; 4 found
Loading history...
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected "integer" but found "int" for parameter type
Loading history...
222
     * @param   int   $offset   Default: 0
0 ignored issues
show
Coding Style introduced by
Expected "integer" but found "int" for parameter type
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 3 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 3 found
Loading history...
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
223
     * @return  AuthnetWebhooksResponse
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
Documentation introduced by
Should the return type not be object?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
224
     * @throws  AuthnetInvalidJsonException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
225
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
226
     */
227 1
    public function getNotificationHistory(int $limit = 1000, int $offset = 0) : object
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$limit" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$limit"; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$offset" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$offset"; expected 0 but found 1
Loading history...
228
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
229 1
        $this->endpoint = 'notifications';
230 1
        $this->url = sprintf('%s%s', $this->url, $this->endpoint);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
231 1
        $response = $this->get($this->url, [
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
232 1
            'offset' => $offset,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 44 spaces, but found 12.
Loading history...
233 1
            'limit'  => $limit
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 44 spaces, but found 12.
Loading history...
Coding Style introduced by
Each line in an array declaration must end in a comma
Loading history...
234
        ]);
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 43 space(s), but found 8.
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
235 1
        return new AuthnetWebhooksResponse($response);
236
    }
0 ignored issues
show
Coding Style introduced by
Expected //end getNotificationHistory()
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
237
238
    /**
239
     * Tells the handler to make the API call to Authorize.Net
240
     *
241
     * @return  string
0 ignored issues
show
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
242
     * @throws  AuthnetCurlException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
243
     */
244 4
    private function handleResponse() : string
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::handleResponse" must be prefixed with an underscore
Loading history...
245
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
246 4
        if (!$this->processor->error) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space(s) after NOT operator; 0 found
Loading history...
247 1
            return $this->processor->response;
248
        }
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
249 3
        $response = json_decode($this->processor->response, false);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of false please use FALSE.
Loading history...
250 3
        $error_message = sprintf('(%u) %s: %s', $response->status, $response->reason, $response->message);
0 ignored issues
show
Coding Style introduced by
Variable "error_message" is not in valid camel caps format
Loading history...
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 106 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
Coding Style introduced by
$error_message does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
251
252 3
        throw new AuthnetCurlException(sprintf('Connection error: %s', $error_message));
0 ignored issues
show
Coding Style introduced by
Variable "error_message" is not in valid camel caps format
Loading history...
Coding Style introduced by
$error_message does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
253
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end handleResponse()
Loading history...
254
255
    /**
256
     * Make GET request via Curl
257
     *
258
     * @param   string  $url
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
259
     * @param   array   $params
0 ignored issues
show
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 3 found
Loading history...
260
     * @return  string
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
261
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
262
     *
263
     * @codeCoverageIgnore
264
     */
265
    private function get(string $url, array $params = []) : string
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::get" must be prefixed with an underscore
Loading history...
Coding Style introduced by
Incorrect spacing between argument "$params" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$params"; expected 0 but found 1
Loading history...
266
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
267
        $this->processor->get($url, $params);
268
        return $this->handleResponse();
269
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end get()
Loading history...
270
271
    /**
272
     * Make POST request via Curl
273
     *
274
     * @param   string  $url        API endpoint
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 5 spaces after parameter name; 8 found
Loading history...
275
     * @param   string  $request    JSON request payload
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
276
     * @return  string
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
277
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
278
     *
279
     * @codeCoverageIgnore
280
     */
281
    private function post(string $url, string $request) : string
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::post" must be prefixed with an underscore
Loading history...
282
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
283
        $this->processor->post($url, $request);
284
        return $this->handleResponse();
285
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end post()
Loading history...
286
287
    /**
288
     * Make PUT request via Curl
289
     *
290
     * @param   string  $url        API endpoint
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 5 spaces after parameter name; 8 found
Loading history...
291
     * @param   string  $request    JSON request payload
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
292
     * @return  string
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
293
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
294
     *
295
     * @codeCoverageIgnore
296
     */
297
    private function put(string $url, string $request) : string
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::put" must be prefixed with an underscore
Loading history...
298
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
299
        $this->processor->put($url, $request, true);
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
300
        return $this->handleResponse();
301
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end put()
Loading history...
302
303
    /**
304
     * Make DELETE request via Curl
305
     *
306
     * @param   string  $url        API endpoint
0 ignored issues
show
introduced by
Parameter comment must end with a full stop
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 3
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 8 found
Loading history...
307
     * @return  string
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
308
     * @throws  AuthnetCurlException
0 ignored issues
show
Coding Style introduced by
Tag @throws cannot be grouped with parameter tags in a doc comment
Loading history...
introduced by
Comment missing for @throws tag in function comment
Loading history...
Coding Style introduced by
Tag value for @throws tag indented incorrectly; expected 1 spaces but found 2
Loading history...
309
     *
310
     * @codeCoverageIgnore
311
     */
312
    private function delete(string $url) : string
0 ignored issues
show
Coding Style introduced by
Private method name "AuthnetWebhooksRequest::delete" must be prefixed with an underscore
Loading history...
313
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
314
        $this->processor->delete($url, [], true);
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
315
        return $this->handleResponse();
316
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end delete()
Loading history...
317
318
    /**
319
     * Sets the handler to be used to handle our API call. Mainly used for unit testing as Curl is used by default.
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 115 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
320
     *
321
     * @param   Curl  $processor
0 ignored issues
show
Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 1 spaces but found 3
Loading history...
322
     */
0 ignored issues
show
introduced by
Missing @return tag in function comment
Loading history...
323 1
    public function setProcessHandler(Curl $processor) : void
324
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
325 1
        $this->processor = $processor;
326 1
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end setProcessHandler()
Loading history...
327
328
    /**
329
     * Gets the request sent to Authorize.Net in JSON format for logging purposes
330
     *
331
     * @return  string transaction request sent to Authorize.Net in JSON format
0 ignored issues
show
Coding Style introduced by
Tag value for @return tag indented incorrectly; expected 1 spaces but found 2
Loading history...
332
     */
333 1
    public function getRawRequest() : string
334
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
335 1
        return $this->requestJson;
336
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getRawRequest()
Loading history...
337
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
338