@@ -59,8 +59,6 @@ public function __construct(ContainerInterface $providers)
5959 * @param ImportSpecification $specification Import specification.
6060 *
6161 * @return PorterRecords|CountablePorterRecords
62- *
63- * @throws ImportException Provider failed to return an iterator.
6462 */
6563 public function import (ImportSpecification $ specification ): PorterRecords
6664 {
@@ -128,6 +126,13 @@ private function fetch(ImportSpecification $specification): \Iterator
128126 return $ resource ->fetch (ImportConnectorFactory::create ($ connector , $ specification ));
129127 }
130128
129+ /**
130+ * Imports data asynchronously according to the design of the specified asynchronous import specification.
131+ *
132+ * @param AsyncImportSpecification $specification Asynchronous import specification.
133+ *
134+ * @return AsyncPorterRecords|CountableAsyncPorterRecords
135+ */
131136 public function importAsync (AsyncImportSpecification $ specification ): AsyncRecordCollection
132137 {
133138 $ specification = clone $ specification ;
@@ -143,6 +148,13 @@ public function importAsync(AsyncImportSpecification $specification): AsyncRecor
143148 return $ this ->createAsyncPorterRecords ($ records , $ specification );
144149 }
145150
151+ /**
152+ * Imports one record according to the design of the specified asynchronous import specification.
153+ *
154+ * @param AsyncImportSpecification $specification Asynchronous import specification.
155+ *
156+ * @return Promise Promise that resolves to a record.
157+ */
146158 public function importOneAsync (AsyncImportSpecification $ specification ): Promise
147159 {
148160 return \Amp \call (function () use ($ specification ) {
@@ -210,17 +222,19 @@ private function transformRecords(RecordCollection $records, array $transformers
210222 return $ records ;
211223 }
212224
225+ /**
226+ * @param AsyncRecordCollection $records
227+ * @param AsyncTransformer[] $transformers
228+ * @param mixed $context
229+ *
230+ * @return AsyncRecordCollection
231+ */
213232 private function transformAsync (
214233 AsyncRecordCollection $ records ,
215234 array $ transformers ,
216235 $ context
217236 ): AsyncRecordCollection {
218237 foreach ($ transformers as $ transformer ) {
219- if (!$ transformer instanceof AsyncTransformer) {
220- // TODO: Proper exception or separate async stack.
221- throw new \RuntimeException ('Cannot use sync transformer. ' );
222- }
223-
224238 if ($ transformer instanceof PorterAware) {
225239 $ transformer ->setPorter ($ this );
226240 }
0 commit comments