stub file generation
[mdref/mdref] / mdref / Entry.php
index 9135dd788479e04d44e7510fee0cc668948ca95e..589cf412eb72b4093d485261cba99d9d33ac64e2 100644 (file)
@@ -105,7 +105,7 @@ class Entry implements \IteratorAggregate {
        }
 
        /**
-        * Read the description of the ref entry file
+        * Read the first line of the description of the ref entry file
         * @return string
         */
        public function getDescription() {
@@ -118,6 +118,20 @@ class Entry implements \IteratorAggregate {
                return $this;
        }
 
+       /**
+        * Read the full description of the ref entry file
+        * @return string
+        */
+       public function getFullDescription() {
+               if ($this->isFile()) {
+                       return trim($this->getFile()->readFullDescription());
+               }
+               if ($this->isRoot()) {
+                       return trim($this->repo->getRootEntry()->getFullDescription());
+               }
+               return $this;
+       }
+
        /**
         * Read the intriductory section of the refentry file
         * @return string
@@ -192,6 +206,22 @@ class Entry implements \IteratorAggregate {
                return ctype_upper($base{0});
        }
 
+       public function getEntryName() {
+               return end($this->list);
+       }
+
+       public function getNsName() {
+               if ($this->isRoot()) {
+                       return $this->getName();
+               } elseif ($this->isFunction()) {
+                       $parts = explode("/", trim($this->getName(), "/"));
+                       $self = array_pop($parts);
+                       return implode("\\", $parts) . "::" . $self;
+               } else {
+                       return strtr($this->getName(), "/", "\\");
+               }
+       }
+
        /**
         * Display name
         * @return string
@@ -266,4 +296,8 @@ class Entry implements \IteratorAggregate {
        function getIterator() {
                return new Tree($this->getBasename(), $this->repo);
        }
+
+       function getStructure() {
+               return new Structure($this);
+       }
 }