aboutsummaryrefslogtreecommitdiffstats
path: root/Model
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2012-12-18 09:40:52 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2012-12-18 09:40:52 +0100
commit9c6f176e225620010168bd3b0e00eba834074949 (patch)
treeb54680d99d637d43980cfec98eed9fbb9cd19805 /Model
parent22fa6e5f8f73e283e98c95b64f1d97f5c1ad0172 (diff)
downloadPraspel-9c6f176e225620010168bd3b0e00eba834074949.zip
Praspel-9c6f176e225620010168bd3b0e00eba834074949.tar.gz
Praspel-9c6f176e225620010168bd3b0e00eba834074949.tar.bz2
Add getId() and _getId() methods.
Diffstat (limited to 'Model')
-rw-r--r--Model/Behavior.php11
-rw-r--r--Model/Clause.php29
-rw-r--r--Model/Specification.php11
3 files changed, 51 insertions, 0 deletions
diff --git a/Model/Behavior.php b/Model/Behavior.php
index 1d59695..a901b9e 100644
--- a/Model/Behavior.php
+++ b/Model/Behavior.php
@@ -195,6 +195,17 @@ class Behavior extends Clause {
return $this->_identifier;
}
+
+ /**
+ * Get identifier (fallback).
+ *
+ * @access protected
+ * @return string
+ */
+ protected function _getId ( ) {
+
+ return $this->getName() . '_' . $this->getIdentifier();
+ }
}
}
diff --git a/Model/Clause.php b/Model/Clause.php
index 0455cab..ece3e77 100644
--- a/Model/Clause.php
+++ b/Model/Clause.php
@@ -127,6 +127,35 @@ abstract class Clause implements \Hoa\Visitor\Element {
}
/**
+ * Get identifier.
+ *
+ * @access public
+ * @return string
+ */
+ public function getId ( ) {
+
+ $out = null;
+ $parent = $this->getParent();
+
+ if( null !== $parent
+ && !($parent instanceof Specification))
+ $out .= $this->getParent()->getId() . '_';
+
+ return $out . $this->_getId();
+ }
+
+ /**
+ * Get identifier (fallback).
+ *
+ * @access protected
+ * @return string
+ */
+ protected function _getId ( ) {
+
+ return $this->getName();
+ }
+
+ /**
* Accept a visitor.
*
* @access public
diff --git a/Model/Specification.php b/Model/Specification.php
index c84abd9..ed29d7d 100644
--- a/Model/Specification.php
+++ b/Model/Specification.php
@@ -142,6 +142,17 @@ class Specification extends Behavior {
return $this->_clauses[$clause] = $handle;
}
+
+ /**
+ * Get identifier (fallback).
+ *
+ * @access protected
+ * @return string
+ */
+ protected function _getId ( ) {
+
+ return 'praspel';
+ }
}
}