Code Duplication    Length = 14-14 lines in 3 locations

src/Error.php 1 location

@@ 52-65 (lines=14) @@
49
	 * @return self
50
	 * @throws \JsonSchema\Exception\ValidationException Throws exception when JSON is not valid.
51
	 */
52
	public static function from_json( $object ) {
53
		$validator = new \JsonSchema\Validator();
54
55
		$validator->validate(
56
			$object,
57
			(object) array(
58
				'$ref' => 'file://' . \realpath( __DIR__ . '/../json-schemas/error.json' ),
59
			),
60
			\JsonSchema\Constraints\Constraint::CHECK_MODE_EXCEPTIONS
61
		);
62
63
        /* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */
64
		return new self( $object->code, $object->message, $object->detailedMessage );
65
	}
66
67
	/**
68
	 * Get code.

src/ResponseHeader.php 1 location

@@ 45-58 (lines=14) @@
42
	 * @return self
43
	 * @throws \JsonSchema\Exception\ValidationException Throws exception when JSON is not valid.
44
	 */
45
	public static function from_json( $object ) {
46
		$validator = new \JsonSchema\Validator();
47
48
		$validator->validate(
49
			$object,
50
			(object) array(
51
				'$ref' => 'file://' . \realpath( __DIR__ . '/../json-schemas/response-header.json' ),
52
			),
53
			\JsonSchema\Constraints\Constraint::CHECK_MODE_EXCEPTIONS
54
		);
55
56
        /* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */
57
		return new self( $object->requestTimestamp );
58
	}
59
60
	/**
61
	 * Get request timestamp.

src/TransactionResponse.php 1 location

@@ 83-96 (lines=14) @@
80
	 * @return self
81
	 * @throws \JsonSchema\Exception\ValidationException Throws exception when JSON is not valid.
82
	 */
83
	public static function from_json( $object ) {
84
		$validator = new \JsonSchema\Validator();
85
86
		$validator->validate(
87
			$object,
88
			(object) array(
89
				'$ref' => 'file://' . \realpath( __DIR__ . '/../json-schemas/transaction-response.json' ),
90
			),
91
			\JsonSchema\Constraints\Constraint::CHECK_MODE_EXCEPTIONS
92
		);
93
94
		/* phpcs:disable WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase */
95
		return new self( $object->action, $object->id, $object->trackingCode, $object->amount, $object->currencyCode );
96
	}
97
98
	/**
99
	 * Get action.