# ezcache/1.3.11/includes/Rest/LicenseController.php

ezCache, version 1.3.11. 44 lines.

- Page: https://pluginprobe.com/plugins/ezcache/1.3.11/code/includes/Rest/LicenseController.php
- Raw: https://pluginprobe.com/plugins/ezcache/1.3.11/raw/includes/Rest/LicenseController.php
- Modified: 2020-01-29T08:46:56+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/ezcache/1.3.11/code/includes/Rest/LicenseController.php#L10-L20`.

```php
<?php
namespace Upress\EzCache\Rest;

use Upress\EzCache\LicenseApi;
use WP_REST_Request;

class LicenseController {
	function show() {
		$manager = new LicenseApi();
		$key = $manager->get_masked_license_key();
		$license_data = $manager->get_license_data( false );

		return wp_send_json_success( array_merge( (array) $license_data, [ 'key' => $key ] ) );
	}

	/**
	 * @param WP_REST_Request $request
	 */
	function update( $request ) {
		$input = $request->get_json_params();
		$key = isset( $input['licenseKey'] ) ? trim( strtoupper( $input['licenseKey'] ) ) : '';

		$manager = new LicenseApi();
		$license_data = $manager->update_license( $key );
		if ( is_wp_error( $license_data ) ) {
			return wp_send_json_error( $license_data );
		}
		$key = $manager->get_masked_license_key();

		return wp_send_json_success( array_merge( (array) $license_data, [ 'key' => $key ] ) );
	}

	function destroy() {
		$manager = new LicenseApi();
		$response = $manager->clear_license();

		if ( is_wp_error( $response ) ) {
			return wp_send_json_error( $response );
		}

		return wp_send_json_success( $response );
	}
}

```
