at the end of the day, it was inevitable

This commit is contained in:
Mo Elzubeir
2022-12-09 08:36:26 -06:00
commit 1218570914
1768 changed files with 887087 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace Tests\Helper;
/**
* Class AccessorTrait
* @package Tests\Helper
*/
trait AccessorTrait
{
/**
* Call specified method of given object.
*
* @param object $object Some object.
* @param string $method Called method name.
* @param array $arguments Method parameters.
*
* @return mixed
*/
public function call($object, $method, array $arguments = [])
{
$caller = function () use ($method, $arguments) {
return call_user_func_array([ $this, $method ], $arguments);
};
$caller = $caller->bindTo($object, $object);
return $caller();
}
}