1 | <?php |
||
44 | class ehough_chaingang_impl_StandardChain implements ehough_chaingang_api_Chain |
||
45 | { |
||
46 | private $_commands = array(); |
||
47 | |||
48 | private $_frozen = false; |
||
49 | |||
50 | /** |
||
51 | * Add a command to this chain. |
||
52 | * |
||
53 | * Add a Command to the list of Commands that will be called in turn when this Chain's |
||
54 | * execute() method is called. Once execute() has been called at least once, it is no |
||
55 | * longer possible to add additional Commands; instead, an exception will be thrown. |
||
56 | * |
||
57 | * @param ehough_chaingang_api_Command $command The Command to be added. |
||
58 | * |
||
59 | * @return void |
||
60 | * |
||
61 | * @throws ehough_chaingang_api_exception_IllegalStateException If this Chain has already |
||
62 | * been executed at least once, |
||
63 | * so no further configuration is allowed. |
||
64 | */ |
||
65 | 1 | public final function addCommand(ehough_chaingang_api_Command $command) |
|
74 | |||
75 | /** |
||
76 | * Execute a unit of processing work to be performed. |
||
77 | * |
||
78 | * This Command may either complete the required processing and return true, |
||
79 | * or delegate remaining processing to the next Command in a Chain containing |
||
80 | * this Command by returning false. |
||
81 | * |
||
82 | * @param ehough_chaingang_api_Context $context The Context to be processed by this Command. |
||
83 | * |
||
84 | * @return boolean True if the processing of this Context has been completed, or false if the |
||
85 | * processing of this Context should be delegated to a subsequent Command |
||
86 | * in an enclosing Chain. |
||
87 | */ |
||
88 | 1 | public final function execute(ehough_chaingang_api_Context $context) |
|
107 | } |