99use ScriptFUSION \Porter \Connector \Recoverable \RecoverableException ;
1010use ScriptFUSION \Porter \Connector \Recoverable \RecoverableExceptionHandler ;
1111use ScriptFUSION \Porter \Connector \Recoverable \StatelessRecoverableExceptionHandler ;
12+ use ScriptFUSION \Porter \Provider \AsyncProvider ;
13+ use ScriptFUSION \Porter \Provider \Provider ;
1214use function Amp \call ;
1315use function Amp \Promise \all ;
1416use function ScriptFUSION \Retry \retry ;
2426 */
2527final class ImportConnector implements ConnectorWrapper
2628{
29+ private $ provider ;
30+
2731 private $ connector ;
2832
2933 /**
@@ -45,6 +49,7 @@ final class ImportConnector implements ConnectorWrapper
4549 private $ throttle ;
4650
4751 /**
52+ * @param Provider|AsyncProvider $provider Provider.
4853 * @param Connector|AsyncConnector $connector Wrapped connector.
4954 * @param RecoverableExceptionHandler $recoverableExceptionHandler User's recoverable exception handler.
5055 * @param int $maxFetchAttempts Maximum fetch attempts.
@@ -53,6 +58,7 @@ final class ImportConnector implements ConnectorWrapper
5358 * for synchronous imports only.
5459 */
5560 public function __construct (
61+ $ provider ,
5662 $ connector ,
5763 RecoverableExceptionHandler $ recoverableExceptionHandler ,
5864 int $ maxFetchAttempts ,
@@ -63,6 +69,7 @@ public function __construct(
6369 throw CacheUnavailableException::createUnsupported ();
6470 }
6571
72+ $ this ->provider = $ provider ;
6673 $ this ->connector = clone (
6774 $ connector instanceof CachingConnector && !$ mustCache
6875 // Bypass cache when not required.
@@ -174,6 +181,16 @@ private static function invokeHandler(
174181 return $ handler ($ recoverableException );
175182 }
176183
184+ /**
185+ * Gets the provider owning the resource being imported.
186+ *
187+ * @return AsyncProvider|Provider
188+ */
189+ public function getProvider ()
190+ {
191+ return $ this ->provider ;
192+ }
193+
177194 /**
178195 * Gets the wrapped connector.
179196 *
0 commit comments