Ejemplo n.º 1
0
 /**
  * @access protected
  */
 function validatePackageName()
 {
     if ($this->_state == PEAR_VALIDATE_PACKAGING || $this->_state == PEAR_VALIDATE_NORMAL) {
         if ($this->_packagexml->getPackagexmlVersion() == '2.0' && $this->_packagexml->getExtends()) {
             $version = $this->_packagexml->getVersion() . '';
             $name = $this->_packagexml->getPackage();
             $test = array_shift(explode('.', $version));
             if ($test == '0') {
                 return true;
             }
             $vlen = strlen($test);
             $majver = substr($name, strlen($name) - $vlen);
             while ($majver && !is_numeric($majver[0])) {
                 $majver = substr($majver, 1);
             }
             if ($majver != $test) {
                 $this->_addWarning('package', "package {$name} extends package " . $this->_packagexml->getExtends() . ' and so the name should ' . 'have a postfix equal to the major version like "' . $this->_packagexml->getExtends() . $test . '"');
                 return true;
             } elseif (substr($name, 0, strlen($name) - $vlen) != $this->_packagexml->getExtends()) {
                 $this->_addWarning('package', "package {$name} extends package " . $this->_packagexml->getExtends() . ' and so the name must ' . 'be an extension like "' . $this->_packagexml->getExtends() . $test . '"');
                 return true;
             }
         }
     }
     if (!$this->validPackageName($this->_packagexml->getPackage())) {
         $this->_addFailure('name', 'package name ' . $this->_packagexml->getPackage() . ' is invalid');
         return false;
     }
 }
Ejemplo n.º 2
0
 function getDeps()
 {
     if (isset($this->_packagefile)) {
         $ver = $this->_packagefile->getPackagexmlVersion();
         if (version_compare($ver, '2.0', '>=')) {
             return $this->_packagefile->getDeps(true);
         }
         return $this->_packagefile->getDeps();
     } elseif (isset($this->_downloadURL['info'])) {
         $ver = $this->_downloadURL['info']->getPackagexmlVersion();
         if (version_compare($ver, '2.0', '>=')) {
             return $this->_downloadURL['info']->getDeps(true);
         }
         return $this->_downloadURL['info']->getDeps();
     }
     return array();
 }
Ejemplo n.º 3
0
 function getDeps()
 {
     if (isset($this->_packagefile)) {
         if ($this->_packagefile->getPackagexmlVersion() == '2.0') {
             return $this->_packagefile->getDeps(true);
         } else {
             return $this->_packagefile->getDeps();
         }
     } elseif (isset($this->_downloadURL['info'])) {
         if ($this->_downloadURL['info']->getPackagexmlVersion() == '2.0') {
             return $this->_downloadURL['info']->getDeps(true);
         } else {
             return $this->_downloadURL['info']->getDeps();
         }
     } else {
         return array();
     }
 }