Skip to content

Commit

Permalink
Fix PHPCS.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed May 27, 2021
1 parent 869c4ef commit 3e8a466
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<exclude name="SlevomatCodingStandard.Files.TypeNameMatchesFileName.NoMatchBetweenTypeNameAndFileName" />

<exclude name="SlevomatCodingStandard.Functions.RequireArrowFunction.RequiredArrowFunction" />
<exclude name="SlevomatCodingStandard.Functions.RequireSingleLineCall.RequiredSingleLineCall" />
<exclude name="SlevomatCodingStandard.Functions.TrailingCommaInCall.MissingTrailingComma" />

<exclude name="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation.NonFullyQualifiedClassName" />
Expand Down
23 changes: 13 additions & 10 deletions src/WebhookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function rest_api_init() {
Integration::REST_ROUTE_NAMESPACE,
'/webhook/(?P<id>[\d]+)',
array(
'args' => array(
'args' => array(
'id' => array(
'description' => __( 'Unique identifier for the gateway configuration post.', 'pronamic_ideal' ),
'description' => \__( 'Unique identifier for the gateway configuration post.', 'pronamic_ideal' ),
'type' => 'integer',
),
),
Expand Down Expand Up @@ -101,10 +101,12 @@ public function rest_api_omnikassa_2_webhook( \WP_REST_Request $request ) {
}

// Response.
$response = new \WP_REST_Response( array(
'success' => true,
'results' => $results,
) );
$response = new \WP_REST_Response(
array(
'success' => true,
'results' => $results,
)
);

$response->add_link( 'self', \rest_url( $request->get_route() ) );

Expand Down Expand Up @@ -142,7 +144,7 @@ public function rest_api_omnikassa_2_webhook_item( \WP_REST_Request $request ) {
if ( null === $id ) {
return new \WP_Error(
'rest_omnikassa_2_gateway_no_id',
__( 'No gateway ID given in `id` parameter.', 'pronamic_ideal' )
\__( 'No gateway ID given in `id` parameter.', 'pronamic_ideal' )
);
}

Expand All @@ -162,6 +164,7 @@ public function rest_api_omnikassa_2_webhook_item( \WP_REST_Request $request ) {

try {
$gateway->handle_notification( $notification );
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
} catch ( \Pronamic\WordPress\Pay\Gateways\OmniKassa2\UnknownOrderIdsException $e ) {
/**
* We don't return an error for unknown order IDs, since OmniKassa
Expand All @@ -170,17 +173,17 @@ public function rest_api_omnikassa_2_webhook_item( \WP_REST_Request $request ) {
} catch ( \Exception $e ) {
return new \WP_Error(
'rest_omnikassa_2_exception',
$e->getMessage(),
$e->getMessage(),
array(
'status' => 400,
'notification' => $json,
'id' => $id,
)
);
}

// Response.
$response = new \WP_REST_Response( $data );
$response = new \WP_REST_Response( array( 'success' => true ) );

$response->add_link( 'self', \rest_url( $request->get_route() ) );

Expand Down

0 comments on commit 3e8a466

Please sign in to comment.