Skip to content

Commit 473c9c9

Browse files
committed
Added v5 data flow diagram and updated readme.
Added async API to relevant readme section.
1 parent ab0fd26 commit 473c9c9

3 files changed

Lines changed: 16 additions & 9 deletions

File tree

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ Benefits
5858
Quick start
5959
-----------
6060

61-
To get started quickly, try our [quick start guide][Quickstart].
61+
To get started quickly, try our [quick start guide][Quickstart]. For a more thorough introduction, continue reading this document.
6262

6363
Understanding this manual
6464
-------------------------
6565

66-
The first half of this manual covers Porter's main features and how to use them. The second half covers architecture, interface and implementation details for Porter developers. There's an intermission inbetween so you'll know where the cut-off is!
66+
The first half of this manual covers Porter's main features and how to use them. The second half covers architecture, interface and implementation details for Porter developers. There's an intermission inbetween so you'll know where the division is!
6767

6868
Text marked as `inline code` denotes literal code, as it would appear in a PHP file. For example, `Porter` refers specifically to the class of the same name within this library, whereas *Porter* refers to this entire project as a whole.
6969

@@ -105,23 +105,28 @@ Porter's API
105105

106106
`Porter`'s simple API comprises data import methods that must always be used to begin imports, instead of calling methods directly on providers or resources, in order to take advantage of Porter's features correctly.
107107

108-
`Porter` provides just two public methods. These are the methods to be most familiar with, where the life of a data import operation begins.
108+
`Porter` provides just two public methods for synchronous data import. These are the methods to be most familiar with, where the life of a data import operation begins.
109109

110-
* `import(ImportSpecification) : PorterRecords|CountablePorterRecords` – Imports data according to the design of the specified import specification.
111-
* `importOne(ImportSpecification) : ?array` – Imports one record according to the design of the specified import specification. If more than one record is imported, `ImportException` is thrown. Use this when you're sure a provider just returns a single record.
110+
* `import(ImportSpecification): PorterRecords|CountablePorterRecords` – Imports one or more records from the resource contained in the specified import specification. If the total size of the collection is known, the record collection may implement `Countable`.
111+
* `importOne(ImportSpecification): ?array` – Imports one record from the resource contained in the specified import specification. If more than one record is imported, `ImportException` is thrown. Use this when a provider just returns a single record.
112+
113+
Porter's asynchronous API mirrors the synchronous one with similar method names but different signatures.
114+
115+
* `importAsync(AsyncImportSpecification): AsyncPorterRecords|CountableAsyncPorterRecords` – Imports one or more records asynchronously from the resource contained in the specified asynchronous import specification.
116+
* `importOneAsync(importOneAsync): Promise` – Imports one record from the resource contained in the specified asynchronous import specification.
112117

113118
Overview
114119
--------
115120

116-
The following data flow diagram gives a high level overview of Porter's main interfaces and the data flows between them when importing data. Note that we use the term *resource* for brevity, but the actual interface is called `ProviderResource`, because *resource* is a reserved word in PHP. Also note, I don't know how to draw data flow diagrams, so just go with it.
121+
The following data flow diagram gives a high level overview of Porter's main interfaces and the data flows between them when importing data. Note that we use the term *resource* for brevity, but the actual interface is called `ProviderResource`, because *resource* is a reserved word in PHP.
117122

118123
<div align="center">
119124

120125
![Data flow diagram][Data flow diagram]
121126

122127
</div>
123128

124-
Our application calls `Porter::import()` with an `ImportSpecification` and receives `PorterRecords` in return. Everything else happens internally and we don't need to worry about it unless writing custom providers and resources.
129+
Our application calls `Porter::import()` with an `ImportSpecification` and receives `PorterRecords` in return. Everything else happens internally so we don't need to worry about it unless writing custom providers, resources or connectors.
125130

126131
Import specifications
127132
---------------------
@@ -555,7 +560,7 @@ Porter is published under the open source GNU Lesser General Public License v3.0
555560
[Porter transformers icon]: https://avatars2.githubusercontent.com/u/24607042?v=3&s=35 "Porter transformers"
556561
[Porter connectors icon]: https://avatars3.githubusercontent.com/u/25672142?v=3&s=35 "Porter connectors"
557562
[Class diagram]: https://github.com/ScriptFUSION/Porter/blob/master/docs/images/diagrams/Porter%20UML%20class%20diagram%204.0.png?raw=true
558-
[Data flow diagram]: https://github.com/ScriptFUSION/Porter/blob/master/docs/images/diagrams/Porter%20data%20flow%20diagram%204.0.png?raw=true
563+
[Data flow diagram]: https://github.com/ScriptFUSION/Porter/blob/master/docs/images/diagrams/Porter%20data%20flow%20diagram%205.0.png?raw=true
559564
[ECB]: https://github.com/Provider/European-Central-Bank
560565
[CurrencyRecords]: https://github.com/Provider/European-Central-Bank/blob/master/src/Records/CurrencyRecords.php
561566
[ECB test]: https://github.com/Provider/European-Central-Bank/blob/master/test/DailyForexRatesTest.php
33.9 KB
Loading

src/Porter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(ContainerInterface $providers)
5353
}
5454

5555
/**
56-
* Imports a one or more records from the resource contained in the specified import specification.
56+
* Imports one or more records from the resource contained in the specified import specification.
5757
*
5858
* @param ImportSpecification $specification Import specification.
5959
*
@@ -156,6 +156,8 @@ public function importAsync(AsyncImportSpecification $specification): AsyncRecor
156156
* @param AsyncImportSpecification $specification Asynchronous import specification.
157157
*
158158
* @return Promise<array|null> Record.
159+
*
160+
* @throws ImportException More than one record was imported.
159161
*/
160162
public function importOneAsync(AsyncImportSpecification $specification): Promise
161163
{

0 commit comments

Comments
 (0)