# woo-postnl/5.9.12/src/Rest_API/Legacy/Postcode_Check_Service.php

PostNL for WooCommerce, version 5.9.12. 44 lines.

- Page: https://pluginprobe.com/plugins/woo-postnl/5.9.12/code/src/Rest_API/Legacy/Postcode_Check_Service.php
- Raw: https://pluginprobe.com/plugins/woo-postnl/5.9.12/raw/src/Rest_API/Legacy/Postcode_Check_Service.php
- Modified: 2026-07-20T20:49:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/woo-postnl/5.9.12/code/src/Rest_API/Legacy/Postcode_Check_Service.php#L10-L20`.

```php
<?php
/**
 * Class Rest_API\Legacy\Postcode_Check_Service file.
 *
 * @package PostNLWooCommerce\Rest_API\Legacy
 */

namespace PostNLWooCommerce\Rest_API\Legacy;

use PostNLWooCommerce\Rest_API\Contracts\Postcode_Check_Service_Interface;
use PostNLWooCommerce\Rest_API\Legacy\Postcode_Check\Client;
use PostNLWooCommerce\Rest_API\Legacy\Postcode_Check\Item_Info;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class Postcode_Check_Service
 *
 * Stateless service wrapper around Legacy\Postcode_Check\Client.
 * Zero-arg constructable so Service_Factory can return it before request data exists.
 *
 * @package PostNLWooCommerce\Rest_API\Legacy
 */
class Postcode_Check_Service implements Postcode_Check_Service_Interface {

	/**
	 * Check the given postcode data.
	 *
	 * @param array $post_data Post data for postcode check.
	 *
	 * @return array
	 */
	public function check( array $post_data ): array {
		$item_info = new Item_Info( $post_data );
		$client    = new Client( $item_info );

		// send_request() can return null on an empty/non-JSON 200; normalize to honor the array return type.
		$response = $client->send_request();
		return is_array( $response ) ? $response : array();
	}
}

```
