Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
93.33% covered (success)
93.33%
14 / 15
100.00% covered (success)
100.00%
1 / 1
CRAP
n/a
0 / 0
BrianHenryIE\WC_Postcode_Address_Autofill\instantiate_bh_wc_postcode_address_autofill
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link              http://bhwp.ie
11 * @since             1.0.0
12 * @package brianhenryie/bh-wc-postcode-address-autofill
13 *
14 * @wordpress-plugin
15 * Plugin Name:       Postcode Address Autofill
16 * Plugin URI:        http://github.com/BrianHenryIE/bh-wc-postcode-address-autofill/
17 * Description:       Autofill city and state based on postcode input.
18 * Version:           1.5.0
19 * Requires PHP:      7.4
20 * Author:            BrianHenryIE
21 * Author URI:        http://bhwp.ie
22 * License:           GPL-2.0+
23 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
24 * Text Domain:       bh-wc-postcode-address-autofill
25 * Domain Path:       /languages
26 *
27 * WC requires at least: 7.6
28 * WC tested up to:      8.1
29 */
30
31namespace BrianHenryIE\WC_Postcode_Address_Autofill;
32
33use BrianHenryIE\WC_Postcode_Address_Autofill\Alley_Interactive\Autoloader\Autoloader;
34use BrianHenryIE\WC_Postcode_Address_Autofill\API\API;
35use BrianHenryIE\WC_Postcode_Address_Autofill\API\Data_Loader;
36use BrianHenryIE\WC_Postcode_Address_Autofill\API\Settings;
37use BrianHenryIE\WC_Postcode_Address_Autofill\WP_Includes\Activator;
38
39if ( ! defined( 'WPINC' ) ) {
40    throw new \Exception( 'WordPress required but not loaded.' );
41}
42
43require_once __DIR__ . '/vendor-prefixed/autoload.php';
44
45Autoloader::generate( __NAMESPACE__, __DIR__ . '/src', )->register();
46
47define( 'BH_WC_POSTCODE_ADDRESS_AUTOFILL_VERSION', '1.5.0' );
48define( 'BH_WC_POSTCODE_ADDRESS_AUTOFILL_BASENAME', plugin_basename( __FILE__ ) );
49define( 'BH_WC_POSTCODE_ADDRESS_AUTOFILL_PATH', plugin_dir_path( __FILE__ ) );
50define( 'BH_WC_POSTCODE_ADDRESS_AUTOFILL_URL', trailingslashit( plugins_url( plugin_basename( __DIR__ ) ) ) );
51
52register_activation_hook( __FILE__, array( Activator::class, 'activate' ) );
53
54/**
55 * Begins execution of the plugin.
56 *
57 * Since everything within the plugin is registered via hooks,
58 * then kicking off the plugin from this point in the file does
59 * not affect the page life cycle.
60 *
61 * @since    1.0.0
62 */
63function instantiate_bh_wc_postcode_address_autofill(): API_Interface {
64
65    $settings    = new Settings();
66    $data_loader = new Data_Loader( $settings );
67    $api         = new API( $data_loader, $settings );
68
69    new BH_WC_Postcode_Address_Autofill( $api, $settings );
70
71    return $api;
72}
73
74$GLOBALS['bh_wc_postcode_address_autofill'] = instantiate_bh_wc_postcode_address_autofill();