Last active
December 27, 2017 10:06
-
-
Save eriktorsner/e17492de9211937de7e569889a8159f7 to your computer and use it in GitHub Desktop.
Snippet from RuntimeProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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']); | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 !! 😃