Go\Instrument\Transformer\ConstructorExecutionTransformer::construct PHP Method

construct() protected static method

Default implementation for accessing joinpoint or creating a new one on-fly
protected static construct ( string $fullClassName, array $arguments = [] ) : object
$fullClassName string Name of the class to create
$arguments array Arguments for constructor
return object
    protected static function construct($fullClassName, array $arguments = [])
    {
        $fullClassName = ltrim($fullClassName, '\\');
        if (!isset(self::$constructorInvocationsCache[$fullClassName])) {
            $invocation = null;
            $dynamicInit = AspectContainer::INIT_PREFIX . ':root';
            try {
                $joinPointsRef = new \ReflectionProperty($fullClassName, '__joinPoints');
                $joinPointsRef->setAccessible(true);
                $joinPoints = $joinPointsRef->getValue();
                if (isset($joinPoints[$dynamicInit])) {
                    $invocation = $joinPoints[$dynamicInit];
                }
            } catch (\ReflectionException $e) {
                $invocation = null;
            }
            if (!$invocation) {
                $invocation = new ReflectionConstructorInvocation($fullClassName, 'root', []);
            }
            self::$constructorInvocationsCache[$fullClassName] = $invocation;
        }
        return self::$constructorInvocationsCache[$fullClassName]->__invoke($arguments);
    }