<?php
/**
 * Class ShippingMethod
 *
 * @package DhlPolska
 */

namespace DhlPolska;

use DhlPolska\ShippingMethod\DhlShippingMethod;
use DhlPolskaVendor\WPDesk\PluginBuilder\Plugin\Hookable;

/**
 * Register DHL shipping method in WooCommerce.
 */
class ShippingMethod implements Hookable {

	/**
	 * Hooks.
	 *
	 * @return void
	 */
	public function hooks() {
		add_filter( 'woocommerce_shipping_methods', [ $this, 'woocommerce_shipping_methods_filter' ] );
	}

	/**
	 * Adds shipping method to WooCommerce.
	 *
	 * @param string[] $methods Methods.
	 *
	 * @return string[]
	 */
	public function woocommerce_shipping_methods_filter( $methods ) {
		$methods[ DhlShippingMethod::SHIPPING_METHOD_ID ] = DhlShippingMethod::class;

		return $methods;
	}
}
