Skip to content

Commit 5559fcd

Browse files
committed
Updated readme.
1 parent 7c16a70 commit 5559fcd

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,17 @@ Porter's API
8989

9090
`Porter` provides the following methods.
9191

92+
### Importing data
93+
94+
These are the methods to be most familiar with, where the life of a data import operation begins.
95+
9296
* `import(ImportSpecification)` – Imports data according to the design of the specified import specification.
93-
* `importOne(ImportSpecification)` – Imports one record according to the design of the specified import specification. If more than one record is imported, `ImportException` will be thrown.
97+
* `importOne(ImportSpecification)` – Imports one record according to the design of the specified import specification. If more than one record is imported, `ImportException` is thrown.
98+
99+
### Provider registry
100+
101+
Porter acts as a provider registry; before data can be imported from a provider it must be registered with Porter. The tagging system is provided to distinguishing between provider instances of the same type, for scenarios where more than one instance of a specific provider is needed.
102+
94103
* `registerProvider(Provider, string|null $tag)` – Registers the specified provider optionally identified by the specified tag. A tag is any user-defined identifier used to distinguish between different instances of the same provider type.
95104
* `getProvider(string $name, string|null $tag)` – Gets the provider matching the specified class name and optionally a tag.
96105
* `hasProvider(string $name, string|null $tag)` – Gets a value indicating whether the specified provider is registered.
@@ -112,7 +121,9 @@ Options may be configured by some of the methods listed below.
112121
Record collections
113122
------------------
114123

115-
Record collections are a type of `Iterator` whose values are arrays. The result of a successful `Porter::import` call is an instance of `PorterRecords` or one of its specialisations, which implement `Iterator`, guaranteeing the collection is enumerable using `foreach`.
124+
Record collections are a type of `Iterator`, whose values are arrays of imported data, and are sometimes `Countable`. The result of a successful `Porter::import` call is an instance of `PorterRecords` or one of its specialisations, guaranteeing the collection is enumerable using `foreach`. That's all you need to know! The following details are just for nerds.
125+
126+
### Details
116127

117128
Record collections are composed by Porter using the decorator pattern. If provider data is not modified, `PorterRecords` will decorate the `ProviderRecords` returned from a `ProviderResource`. That is, `PorterRecords` has a pointer back to the previous collection, which could be written as: `PorterRecords``ProviderRecords`. If a [filter](#filtering) was applied, the collection stack would be `PorterRecords``FilteredRecords``ProviderRecords`. In general this is an unimportant detail for most users but it can be useful for debugging. The stack of record collection types informs us of the transformations a collection has undergone and each type holds a pointer to relevant objects that participated in the transformation, for example, `PorterRecords` holds a reference to the `ImportSpecification` that was used to create it and can be accessed using `PorterRecords::getSpecification`.
118129

0 commit comments

Comments
 (0)