From 42dd8a7e896e2c5dcbc17f0f2599b5abeadea750 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Tue, 14 Jun 2022 12:43:49 +0200 Subject: [PATCH] chore(readme): more documentation --- README.md | 55 ++++++++++++++++++++++++++++++--------------------- composer.json | 1 + 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 1818a66..bb4c270 100644 --- a/README.md +++ b/README.md @@ -2,48 +2,59 @@ [](https://gitlab.com/wpdesk/wp-wpdesk-rating-petition/commits/master) [](https://packagist.org/packages/wpdesk/wp-wpdesk-rating-petition) [](https://packagist.org/packages/wpdesk/wp-wpdesk-rating-petition) -[](https://packagist.org/packages/wpdesk/wp-wpdesk-rating-petition) [](https://packagist.org/packages/wpdesk/wp-wpdesk-rating-petition) WordPress Library to ask for good rate in repository. =================================================== -### Usage +## Requirements -When using in shipping zones: +PHP 7.0 or later. + +## Installation via Composer + +In order to install the bindings via Composer run the following command: + +```bash +composer require wpdesk/wp-wpdesk-rating-petition +``` + +## Example usage + +### When using in shipping zones: ```php -private function init_repository_rating() { - $time_tracker = new ShippingMethodWatcher( +function init_repository_rating() { + $time_tracker = new \WPDesk\RepositoryRating\TimeWatcher\ShippingMethodInstanceWatcher( FedexShippingService::UNIQUE_ID, 'plugin_activation_flexible-shipping-fedex/flexible-shipping-fedex.php', '28-11-2019', FedexShippingMethod::class ); - $this->add_hookable( $time_tracker ); - $this->add_hookable( - new RatingPetitionNotice( - $time_tracker, - FedexShippingService::UNIQUE_ID, - $this->plugin_info->get_plugin_name(), - 'https://wpde.sk/fs-fedex-rate' - ) - ); + $time_tracker->hooks(); + ( new \WPDesk\RepositoryRating\RatingPetitionNotice( + $time_tracker, + 'flexible_shipping_fedex', + $this->plugin_info->get_plugin_name(), + 'https://wpde.sk/fs-fedex-rate' + ) )->hooks(); } ``` -When using in shipping method: +### When using in shipping method: ```php -private function init_repository_rating() { - $time_tracker = new ShippingMethodGlobalSettingsWatcher( FedexShippingService::UNIQUE_ID ); - $this->add_hookable( $time_tracker ); - $this->add_hookable( - new RatingPetitionNotice( +<?php +function init_repository_rating() { + $time_tracker = new \WPDesk\RepositoryRating\TimeWatcher\ShippingMethodGlobalSettingsWatcher( + 'flexible_shipping_fedex' + ); + $time_tracker->hooks(); + ( new \WPDesk\RepositoryRating\RatingPetitionNotice( $time_tracker, - FedexShippingService::UNIQUE_ID, + 'flexible_shipping_fedex', $this->plugin_info->get_plugin_name(), 'https://wpde.sk/fs-fedex-rate' ) - ); + )->hooks(); } ``` diff --git a/composer.json b/composer.json index a9b56d8..560e21a 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "name": "wpdesk/wp-wpdesk-rating-petition", + "license": "MIT", "authors": [ { "name": "Krzysiek", -- GitLab