diff options
author | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-11-11 09:01:37 +0100 |
---|---|---|
committer | Ivan Enderlin <ivan.enderlin@hoa-project.net> | 2013-11-11 09:01:37 +0100 |
commit | af293fba3ffab0d8a8d0e353f288ad4ebcfc8dff (patch) | |
tree | 00e9e25ddc5ece62fff95f5039519a9a60e38be6 /Model | |
parent | 09b88c57d1b5b02973a3c23f3096924679b5c7a6 (diff) | |
download | Praspel-af293fba3ffab0d8a8d0e353f288ad4ebcfc8dff.zip Praspel-af293fba3ffab0d8a8d0e353f288ad4ebcfc8dff.tar.gz Praspel-af293fba3ffab0d8a8d0e353f288ad4ebcfc8dff.tar.bz2 |
Add the getRoot() method.
Diffstat (limited to 'Model')
-rw-r--r-- | Model/Clause.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Model/Clause.php b/Model/Clause.php index 071db59..83cbd9e 100644 --- a/Model/Clause.php +++ b/Model/Clause.php @@ -116,6 +116,22 @@ abstract class Clause implements \Hoa\Visitor\Element { } /** + * Get the root clause. + * + * @access public + * @return \Hoa\Praspel\Model\Clause + */ + public function getRoot ( ) { + + $parent = $this; + + while(null !== $nextParent = $parent->getParent()) + $parent = $nextParent; + + return $parent; + } + + /** * Get clause name. * * @access public |