for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Terranet\Administrator\Traits;
use ReflectionClass;
use ReflectionMethod;
trait MethodsCollector
{
/**
* @param $instance
* @param int $filter
*
* @return \ReflectionMethod[]
*/
protected function collectMethods($instance, $filter = ReflectionMethod::IS_PUBLIC)
static $methodsCache = null;
if (null === $methodsCache) {
$methodsCache = $instance
? (new ReflectionClass($instance))->getMethods($filter)
: [];
}
return $methodsCache;