diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-04-16 16:15:55 +0200 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-04-16 16:15:55 +0200 |
commit | a47252b81b7f6cb207b27fb4ae3f290d0496c3ea (patch) | |
tree | f5a1675595d9a04224376c2d67ca00dad0b58420 /Model/Specification.php | |
parent | c2c368e07a224f7817c033e9a9761ff0241d76ae (diff) | |
download | Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.zip Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.gz Praspel-a47252b81b7f6cb207b27fb4ae3f290d0496c3ea.tar.bz2 |
Introduce collection of clauses.
Clauses can have variables, so that they extend Declaration. But a
specification or a behavior can have a collection of other clauses, such
as a collection of behavior, represented by an identifier.
To build a collection of clauses, we need to instance the Collection
class with a preset clause and post-clone function. For each new offset
in the collection, the associated value is a clone from the preset
clause with the post-clone function applied on this clone. This
mechanism allows us to build modular collection of clauses.
Diffstat (limited to 'Model/Specification.php')
-rw-r--r-- | Model/Specification.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Model/Specification.php b/Model/Specification.php index 351d3e1..b5ac837 100644 --- a/Model/Specification.php +++ b/Model/Specification.php @@ -132,7 +132,15 @@ class Specification extends Behavior { break; case 'behavior': - $handle = new Behavior($this); + $handle = new Collection( + new Behavior($this), + function ( Behavior $clause, $identifier ) { + + $clause->setIdentifier($identifier); + + return; + } + ); break; case 'description': |