Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created May 29, 2017 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/d588e0c45cf96bcd5f10614ccf432339 to your computer and use it in GitHub Desktop.
Save tommcfarlin/d588e0c45cf96bcd5f10614ccf432339 to your computer and use it in GitHub Desktop.
[WordPress] On Immutable Values in WordPress Plugins
<?php
class Main_Plugin {
const ACME_API_KEY = '123456789';
public function init() {
$helper = new Helper_Class();
$helper->render_acme_data( self::ACME_API_KEY );
}
}
<?php
class Helper_Class {
public function render_acme_data( string $api_key ) {
$canvas_url = 'https://url-for-canvas.com?api_key=' . $api_key;
$canvas = new Canvas( $canvas_url );
$canvas->draw();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment