Skip to content

Instantly share code, notes, and snippets.

@eriktorsner
Last active December 27, 2017 10:06
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 eriktorsner/e17492de9211937de7e569889a8159f7 to your computer and use it in GitHub Desktop.
Save eriktorsner/e17492de9211937de7e569889a8159f7 to your computer and use it in GitHub Desktop.
Snippet from RuntimeProvider.php
<?php
/**
* Class RuntimeProvider
*
* Use Pimple as dependency injection container
*
*/
class RuntimeProvider implements ServiceProviderInterface
{
/**
* @param Container $pimple
*/
public function register(Container $pimple)
{
$slug = 'hello-testable';
$lyricsFile = dirname(__DIR__) . '/assets/hello-dolly.txt';
$pimple['lyrics'] = function ($pimple) use($lyricsFile) {
return new \helloTestable\Lyrics($lyricsFile);
};
$pimple['helloTestable'] = function ($pimple) {
return new \helloTestable\helloTestable($pimple['lyrics']);
};
}
}
@merianos
Copy link

Hello @eriktorsner.

Thanks for sharing this awesome tutorial in WordPress Essentials.

The reason I drop a line here is that the line 15 seems like has no purpose in this code snippet.

Again, thank you !! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment