Skip to content
This repository has been archived by the owner on Feb 1, 2020. It is now read-only.

Commit

Permalink
Updating documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
kherge committed Dec 6, 2013
1 parent 7246f5e commit 075cbde
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
31 changes: 31 additions & 0 deletions src/lib/Phine/Observer/ObserverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@
/**
* Defines how an observer class must be implemented.
*
* Summary
* -------
*
* A class implementing `ObserverInterface` will be able to receive updates
* from any subject that implements `SubjectInterface`.
*
* Starting
* --------
*
* To create a new observer, you will need to create an implementation of
* `ObserverInterface`.
*
* use Phine\Observer\ObserverInterface;
* use Phine\Observer\SubjectInterface;
*
* class MyObserver implements ObserverInterface
* {
* public function receiveUpdate(SubjectInterface $subject)
* {
* // do stuff
* }
* }
*
* ### Interrupting the Update
*
* If the observer receives an update, it can interrupt the subject and prevent
* it from updating the remaining observers. This can be accomplished by using
* the `$subject->interruptUpdate()` method.
*
* @see SubjectInterface::interruptUpdate()
*
* @author Kevin Herrera <kevin@herrera.io>
*/
interface ObserverInterface
Expand Down
19 changes: 18 additions & 1 deletion src/lib/Phine/Observer/Subject.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@
use Phine\Observer\Exception\SubjectException;

/**
* The default implementation of the {@link SubjectInterface} interface.
* The default implementation of `SubjectInterface`.
*
* Summary
* -------
*
* The `Subject` class is an implementation of `SubjectInterface`. You may use
* the implementation an authoritative example of how the interface should be
* implemented. You may optionally extend the class to add (not modify) new
* functionality that you may needed.
*
* Starting
* --------
*
* To start, you will need to simply create an instance of `Subject`:
*
* use Phine\Observer\Subject;
*
* $subject = new Subject();
*
* @author Kevin Herrera <kevin@herrera.io>
*
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Phine/Observer/SubjectInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Starting
* --------
*
* To create a new observer, you will need to create an implementation of
* To create a new subject, you will need to create an implementation of
* `SubjectInterface`. In this example, I will be using the bundled `Subject`
* implementation.
*
Expand Down

0 comments on commit 075cbde

Please sign in to comment.