wp-pay-gateways /
adyen
| 1 | <?php |
||||||
| 2 | /** |
||||||
| 3 | * Notification request |
||||||
| 4 | * |
||||||
| 5 | * @author Pronamic <[email protected]> |
||||||
| 6 | * @copyright 2005-2019 Pronamic |
||||||
| 7 | * @license GPL-3.0-or-later |
||||||
| 8 | * @package Pronamic\WordPress\Pay\Gateways\Adyen |
||||||
| 9 | */ |
||||||
| 10 | |||||||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\Adyen; |
||||||
| 12 | |||||||
| 13 | /** |
||||||
| 14 | * Notification request |
||||||
| 15 | * |
||||||
| 16 | * @link https://docs.adyen.com/developers/api-reference/notifications-api#notificationrequest |
||||||
| 17 | * @author Remco Tolsma |
||||||
| 18 | * @version 1.0.0 |
||||||
| 19 | * @since 1.0.0 |
||||||
| 20 | */ |
||||||
| 21 | class NotificationRequest { |
||||||
| 22 | /** |
||||||
| 23 | * Informs about the origin of the notification: |
||||||
| 24 | * |
||||||
| 25 | * - `true`: the notification originated from the live environment. |
||||||
| 26 | * - `false`: the notification originated from the test environment. |
||||||
| 27 | * |
||||||
| 28 | * @var boolean |
||||||
| 29 | */ |
||||||
| 30 | private $live; |
||||||
| 31 | |||||||
| 32 | /** |
||||||
| 33 | * A container object for the details included in the notification. |
||||||
| 34 | * |
||||||
| 35 | * @var array |
||||||
| 36 | */ |
||||||
| 37 | private $items; |
||||||
| 38 | |||||||
| 39 | /** |
||||||
| 40 | * Construct notification request. |
||||||
| 41 | * |
||||||
| 42 | * @param boolean $live Informs about the origin of the notification. |
||||||
| 43 | * @param array $items A container object for the details included in the notification. |
||||||
| 44 | */ |
||||||
| 45 | public function __construct( $live, $items ) { |
||||||
| 46 | $this->live = $live; |
||||||
| 47 | $this->items = $items; |
||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | /** |
||||||
| 51 | * Create notification request from object. |
||||||
| 52 | * |
||||||
| 53 | * @param object $object Object. |
||||||
| 54 | * @return OrderAnnounceResponse |
||||||
|
0 ignored issues
–
show
|
|||||||
| 55 | * @throws InvalidArgumentException Throws invalid argument exception when object does not contains the required properties. |
||||||
| 56 | */ |
||||||
| 57 | public static function from_object( $object ) { |
||||||
| 58 | if ( ! isset( $object->live ) ) { |
||||||
| 59 | throw new InvalidArgumentException( 'Object must contain `live` property.' ); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 60 | } |
||||||
| 61 | |||||||
| 62 | if ( ! isset( $object->notificationItems ) ) { |
||||||
| 63 | throw new InvalidArgumentException( 'Object must contain `notificationItems` property.' ); |
||||||
| 64 | } |
||||||
| 65 | |||||||
| 66 | if ( ! is_array( $object->notificationItems ) ) { |
||||||
| 67 | throw new InvalidArgumentException( 'Object property `notificationItems` must be an array.' ); |
||||||
| 68 | } |
||||||
| 69 | |||||||
| 70 | $items = array(); |
||||||
| 71 | |||||||
| 72 | foreach ( $object->notificationItems as $o ) { |
||||||
| 73 | $items[] = NotificationRequestItem::from_object( $o ); |
||||||
|
0 ignored issues
–
show
The method
from_object() does not exist on Pronamic\WordPress\Pay\G...NotificationRequestItem.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||||
| 74 | } |
||||||
| 75 | |||||||
| 76 | return new self( |
||||||
|
0 ignored issues
–
show
|
|||||||
| 77 | filter_var( $object->redirectUrl, FILTER_VALIDATE_BOOLEAN ), |
||||||
| 78 | $items |
||||||
| 79 | ); |
||||||
| 80 | } |
||||||
| 81 | } |
||||||
| 82 |
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