/**
* @param FixtureInterface $scope
* @param string $method
*
* @return array The first element is a ServiceReferenceInterface ($caller) and the second a string ($method)
*/
private function getCallerReference(FixtureInterface $scope, string $method) : array
{
if (false === strpos($method, '::')) {
return [new StaticReference($scope->getClassName()), $method];
}
$explodedMethod = explode('::', $method);
if (2 < count($explodedMethod)) {
throw InvalidArgumentExceptionFactory::createForInvalidConstructorMethod($method);
}
list($caller, $method) = $explodedMethod;
if (0 === strpos($caller, '@')) {
return [new InstantiatedReference(substr($caller, 1)), $method];
}
return [new StaticReference($caller), $method];
}