PHP code example of horat1us / php-method-injection
1. Go to this page and download the library: Download horat1us/php-method-injection library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
horat1us / php-method-injection example snippets
interface ServiceInterface
{
public function run($args);
}
use Horat1us\MethodInjection\InjectMethodsInterface;
use Horat1us\MethodInjection\InjectMethods;
/**
* @method Test($args)
*/
class FakeService implements InjectMethodsInterface, ServiceInterface
{
use InjectMethods;
public function run($args) {
$this->Test($args);
}
}
$service = new FakeService(['Test' => function() {
// Your tests here
}]);
ServiceRunner::run($service);
bash
composer