]> granicus.if.org Git - php/commitdiff
- Add inheritance information to package inspection on 'pear package'.
authorDerick Rethans <derick@php.net>
Fri, 9 May 2003 12:03:09 +0000 (12:03 +0000)
committerDerick Rethans <derick@php.net>
Fri, 9 May 2003 12:03:09 +0000 (12:03 +0000)
pear/PEAR/Common.php
pear/package.dtd

index 94898fae6db019358fb546675cbcde7dfff2036b..94ad6d6b592fe57b25f9e6b6d7f7b7555f40c730 100644 (file)
@@ -935,7 +935,11 @@ class PEAR_Common extends PEAR
         if (isset($pkginfo['provides'])) {
             foreach ($pkginfo['provides'] as $key => $what) {
                 $ret .= "$indent    <provides type=\"$what[type]\" ";
-                $ret .= "name=\"$what[name]\" />\n";
+                $ret .= "name=\"$what[name]\" ";
+                if (isset($what['extends'])) {
+                    $ret .= "extends=\"$what[extends]\" ";
+                }
+                $ret .= "/>\n";
             }
         }
         if (isset($pkginfo['filelist'])) {
@@ -1175,6 +1179,10 @@ class PEAR_Common extends PEAR
             }
             $this->pkginfo['provides'][$key] =
                 array('type' => 'class', 'name' => $class);
+            if (isset($srcinfo['inheritance'][$class])) {
+                $this->pkginfo['provides'][$key]['extends'] =
+                    $srcinfo['inheritance'][$class];
+            }
         }
         foreach ($srcinfo['declared_methods'] as $class => $methods) {
             foreach ($methods as $method) {
@@ -1243,6 +1251,7 @@ class PEAR_Common extends PEAR
         $declared_methods = array();
         $used_classes = array();
         $used_functions = array();
+        $extends = array();
         $nodeps = array();
         for ($i = 0; $i < sizeof($tokens); $i++) {
             if (is_array($tokens[$i])) {
@@ -1273,6 +1282,7 @@ class PEAR_Common extends PEAR
                 case T_CLASS:
                 case T_FUNCTION:
                 case T_NEW:
+                case T_EXTENDS:
                     $look_for = $token;
                     continue 2;
                 case T_STRING:
@@ -1280,6 +1290,8 @@ class PEAR_Common extends PEAR
                         $current_class = $data;
                         $current_class_level = $brace_level;
                         $declared_classes[] = $current_class;
+                    } elseif ($look_for == T_EXTENDS) {
+                        $extends[$current_class] = $data;
                     } elseif ($look_for == T_FUNCTION) {
                         if ($current_class) {
                             $current_function = "$current_class::$data";
@@ -1319,6 +1331,7 @@ class PEAR_Common extends PEAR
             "declared_methods" => $declared_methods,
             "declared_functions" => $declared_functions,
             "used_classes" => array_diff(array_keys($used_classes), $nodeps),
+            "inheritance" => $extends,
             );
     }
 
@@ -1344,6 +1357,7 @@ class PEAR_Common extends PEAR
             $decl_c = @array_merge($decl_c, $tmp['declared_classes']);
             $decl_f = @array_merge($decl_f, $tmp['declared_functions']);
             $decl_m = @array_merge($decl_m, $tmp['declared_methods']);
+            $inheri = @array_merge($inheri, $tmp['inheritance']);
         }
         $used_c = array_unique($used_c);
         $decl_c = array_unique($decl_c);
@@ -1353,6 +1367,7 @@ class PEAR_Common extends PEAR
                      'declared_methods' => $decl_m,
                      'declared_functions' => $decl_f,
                      'undeclared_classes' => $undecl_c,
+                     'inheritance' => $inheri,
                      );
     }
 
index 4afc4aa5cbdf37b9cb163bb87d3b7d89f1b71ac6..e1eff7098f829c2800942f73afa783f57dddbdd2 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-     $Id: package.dtd,v 1.30 2003-03-18 12:06:06 ssb Exp $
+     $Id: package.dtd,v 1.31 2003-05-09 12:03:09 derick Exp $
 
      This is the PEAR package description, version 1.0.
      It should be used with the informal public identifier:
@@ -90,7 +90,8 @@
 <!ELEMENT provides (#PCDATA)>
 <!ATTLIST provides
        type    (ext|prog|class|function|feature|api)  #REQUIRED
-        name    CDATA                                  #REQUIRED>
+       name    CDATA                                  #REQUIRED
+       extends CDATA                                  #IMPLIED>
 
 <!ELEMENT script (#PCDATA)>
 <!ATTLIST script