From d87578b094aaaa227679b83cb3d0675534406aa8 Mon Sep 17 00:00:00 2001 From: rotexdegba Date: Fri, 30 Nov 2018 21:13:10 -0700 Subject: [PATCH] Documentation in progress --- docs/CallablesCollections.md | 8 ++++---- docs/ObjectsCollections.md | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/CallablesCollections.md b/docs/CallablesCollections.md index 9a44e11..96b723f 100644 --- a/docs/CallablesCollections.md +++ b/docs/CallablesCollections.md @@ -28,12 +28,12 @@ Example Usage: $collection = new \VersatileCollections\CallablesCollection(); // lines below should produce no exception since we are injecting callables - $collection->item1 = function() { + $collection[] = function() { return 'boo'; }; - $collection->item2 = 'strtolower'; - $collection->item3 = [\DateTime::class, 'getLastErrors']; - $collection->item4 = [\DateTime::class, 'createFromFormat']; + $collection[] = 'strtolower'; + $collection[] = [\DateTime::class, 'getLastErrors']; + $collection[] = [\DateTime::class, 'createFromFormat']; ``` A couple good use-cases for this type of collection would be for implementing a diff --git a/docs/ObjectsCollections.md b/docs/ObjectsCollections.md index 926d3fe..5ad0aad 100644 --- a/docs/ObjectsCollections.md +++ b/docs/ObjectsCollections.md @@ -52,6 +52,16 @@ return value of NULL for such calls. If the called method does not exist in one or more of the objects in the collection, an exception is thrown. +>NOTE: methods registered to the collection via either **`addMethod`** or +**`addMethodForAllInstances`** having the same name as a method present in the +objects in the collection will be called instead of the one in the objects. For +example, if a method named **`save`** was registered via either **`addMethod`** or +**`addMethodForAllInstances`** on a collection object and that same collection +contains objects that each also have a **`save`** method, when the save method +is called on the collection, the method registered via **`addMethod`** or +**`addMethodForAllInstances`** will be executed instead of the save method +in each object in the collection. + Example Usage: ```php