18require_once
'PEAR/ErrorStack.php';
23define(
'PEAR_PACKAGEFILE_ERROR_NO_XML_EXT', 3);
28define(
'PEAR_PACKAGEFILE_ERROR_CANT_MAKE_PARSER', 4);
33define(
'PEAR_PACKAGEFILE_ERROR_PARSER_ERROR', 5);
38define(
'PEAR_PACKAGEFILE_ERROR_NO_NAME', 6);
43define(
'PEAR_PACKAGEFILE_ERROR_INVALID_NAME', 7);
48define(
'PEAR_PACKAGEFILE_ERROR_NO_SUMMARY', 8);
53define(
'PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY', 9);
58define(
'PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION', 10);
63define(
'PEAR_PACKAGEFILE_ERROR_NO_LICENSE', 11);
68define(
'PEAR_PACKAGEFILE_ERROR_NO_VERSION', 12);
73define(
'PEAR_PACKAGEFILE_ERROR_INVALID_VERSION', 13);
78define(
'PEAR_PACKAGEFILE_ERROR_NO_STATE', 14);
83define(
'PEAR_PACKAGEFILE_ERROR_INVALID_STATE', 15);
88define(
'PEAR_PACKAGEFILE_ERROR_NO_DATE', 16);
93define(
'PEAR_PACKAGEFILE_ERROR_INVALID_DATE', 17);
98define(
'PEAR_PACKAGEFILE_ERROR_NO_NOTES', 18);
103define(
'PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS', 19);
108define(
'PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE', 20);
113define(
'PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE', 21);
118define(
'PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME', 22);
123define(
'PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL', 23);
128define(
'PEAR_PACKAGEFILE_ERROR_INVALID_MAINTROLE', 24);
133define(
'PEAR_PACKAGEFILE_ERROR_NO_DEPNAME', 25);
138define(
'PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE', 26);
143define(
'PEAR_PACKAGEFILE_ERROR_NO_DEPREL', 27);
148define(
'PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION', 28);
153define(
'PEAR_PACKAGEFILE_ERROR_INVALID_DEPREL', 29);
158define(
'PEAR_PACKAGEFILE_ERROR_INVALID_DEPTYPE', 30);
163define(
'PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL', 31);
168define(
'PEAR_PACKAGEFILE_ERROR_INVALID_DEPNAME', 32);
173define(
'PEAR_PACKAGEFILE_ERROR_UNKNOWN_DEPCHANNEL', 33);
178define(
'PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED', 34);
183define(
'PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED', 35);
188define(
'PEAR_PACKAGEFILE_ERROR_NO_CONFNAME', 36);
193define(
'PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT', 37);
198define(
'PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE', 38);
203define(
'PEAR_PACKAGEFILE_ERROR_NO_FILEROLE', 39);
208define(
'PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE', 40);
214define(
'PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX', 41);
219define(
'PEAR_PACKAGEFILE_ERROR_UNKNOWN_CHANNEL', 42);
224define(
'PEAR_PACKAGEFILE_ERROR_NO_FILES', 43);
229define(
'PEAR_PACKAGEFILE_ERROR_INVALID_FILE', 44);
234define(
'PEAR_PACKAGEFILE_ERROR_CHANNELVAL', 45);
239define(
'PEAR_PACKAGEFILE_ERROR_PHP5', 46);
244define(
'PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND', 47);
249define(
'PEAR_PACKAGEFILE_PHP_NO_NOT', 48);
254define(
'PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS', 49);
259define(
'PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION', 50);
264define(
'PEAR_PACKAGEFILE_ERROR_NO_LEAD', 51);
269define(
'PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME', 52);
368 $this->_registry = &
$config->getRegistry();
384 $this->_packageInfo[
'_lastversion'] = $version;
392 if (isset($this->_packageInfo[
'_lastversion'])) {
393 return $this->_packageInfo[
'_lastversion'];
415 if ($logger && (!is_object($logger) || !method_exists($logger,
'log'))) {
416 return PEAR::raiseError(
'Logger must be compatible with PEAR_Common::log');
418 $this->_logger = &$logger;
423 $this->_packageFile = $file;
424 $this->_archiveFile = $archive ? $archive : $file;
429 return isset($this->_packageFile) ? $this->_packageFile :
false;
444 if (!is_string($field) || empty($field) ||
445 !isset($this->_packageInfo[$field])) {
448 return $this->_packageInfo[$field];
453 if (!isset($this->_packageInfo[
'dirtree'])) {
454 $this->_packageInfo[
'dirtree'] = array();
456 $this->_packageInfo[
'dirtree'][$path] =
true;
461 if (isset($this->_packageInfo[
'dirtree']) && count($this->_packageInfo[
'dirtree'])) {
462 return $this->_packageInfo[
'dirtree'];
469 unset($this->_packageInfo[
'dirtree']);
474 $this->_incomplete =
false;
475 $this->_packageInfo = $pinfo;
485 return 'pear.php.net';
500 if (isset($this->_packageInfo[
'extends'])) {
501 return $this->_packageInfo[
'extends'];
529 if (isset($this->_packageInfo[
'package'])) {
530 return $this->_packageInfo[
'package'];
540 $this->_packageInfo[
'package'] = $package;
545 $this->_packageInfo[
'package'] = $package;
546 $this->_isValid =
false;
551 if (isset($this->_packageInfo[
'version'])) {
552 return $this->_packageInfo[
'version'];
559 $this->_packageInfo[
'version'] = $version;
560 $this->_isValid =
false;
565 unset($this->_packageInfo[
'maintainers']);
570 if (isset($this->_packageInfo[
'maintainers'])) {
571 return $this->_packageInfo[
'maintainers'];
582 $this->_packageInfo[
'maintainers'][] =
583 array(
'handle' => $handle,
'role' => $role,
'email' => $email,
'name' => $name);
584 $this->_isValid =
false;
590 if (!isset($this->_packageInfo[
'maintainers']) ||
591 !is_array($this->_packageInfo[
'maintainers'])) {
594 foreach ($this->_packageInfo[
'maintainers'] as $i => $maintainer) {
595 if ($maintainer[
'handle'] == $handle) {
600 if ($found !==
false) {
601 unset($this->_packageInfo[
'maintainers'][$found]);
602 $this->_packageInfo[
'maintainers'] =
603 array_values($this->_packageInfo[
'maintainers']);
611 foreach ($this->_packageInfo[
'maintainers'] as $i => $maintainer) {
612 if ($maintainer[
'handle'] == $handle) {
617 if ($found !==
false) {
618 unset($this->_packageInfo[
'maintainers'][$found]);
619 $this->_packageInfo[
'maintainers'] =
620 array_values($this->_packageInfo[
'maintainers']);
628 if (isset($this->_packageInfo[
'release_state'])) {
629 return $this->_packageInfo[
'release_state'];
636 $this->_packageInfo[
'release_state'] = $state;
641 $this->_packageInfo[
'release_state'] = $state;
642 $this->_isValid =
false;
647 if (isset($this->_packageInfo[
'release_date'])) {
648 return $this->_packageInfo[
'release_date'];
655 $this->_packageInfo[
'release_date'] = $date;
656 $this->_isValid =
false;
661 if (isset($this->_packageInfo[
'release_license'])) {
662 return $this->_packageInfo[
'release_license'];
669 $this->_packageInfo[
'release_license'] = $date;
670 $this->_isValid =
false;
675 if (isset($this->_packageInfo[
'summary'])) {
676 return $this->_packageInfo[
'summary'];
683 $this->_packageInfo[
'summary'] = $summary;
684 $this->_isValid =
false;
689 if (isset($this->_packageInfo[
'description'])) {
690 return $this->_packageInfo[
'description'];
697 $this->_packageInfo[
'description'] = $desc;
698 $this->_isValid =
false;
703 if (isset($this->_packageInfo[
'release_notes'])) {
704 return $this->_packageInfo[
'release_notes'];
711 $this->_packageInfo[
'release_notes'] = $notes;
712 $this->_isValid =
false;
717 if (isset($this->_packageInfo[
'release_deps'])) {
718 return $this->_packageInfo[
'release_deps'];
728 unset($this->_packageInfo[
'release_deps']);
733 $this->_isValid =
false;
734 $this->_packageInfo[
'release_deps'][] =
735 array(
'type' =>
'php',
737 'version' => $version);
742 $this->_isValid =
false;
744 array(
'type' =>
'pkg',
747 'optional' => $optional);
748 if ($rel !=
'has' && $rel !=
'not') {
749 $dep[
'version'] = $version;
751 $this->_packageInfo[
'release_deps'][] = $dep;
756 $this->_isValid =
false;
757 $this->_packageInfo[
'release_deps'][] =
758 array(
'type' =>
'ext',
761 'version' => $version,
762 'optional' => $optional);
770 $this->_packageInfo[
'release_deps'] = $deps;
775 return isset($this->_packageInfo[
'release_deps']) &&
776 count($this->_packageInfo[
'release_deps']);
791 return $p->isSubpackage($this);
801 if (strtolower($channel) !=
'pear.php.net') {
804 if (!($deps = $this->
getDeps())) {
807 foreach ($deps as $dep) {
808 if ($dep[
'type'] !=
'pkg') {
811 if (strtolower($dep[
'name']) == strtolower($package)) {
820 if (isset($this->_packageInfo[
'configure_options'])) {
821 return $this->_packageInfo[
'configure_options'];
828 return isset($this->_packageInfo[
'configure_options']) &&
829 count($this->_packageInfo[
'configure_options']);
834 $o = array(
'name' => $name,
'prompt' => $prompt);
835 if ($default !==
false) {
836 $o[
'default'] = $default;
838 if (!isset($this->_packageInfo[
'configure_options'])) {
839 $this->_packageInfo[
'configure_options'] = array();
841 $this->_packageInfo[
'configure_options'][] = $o;
846 unset($this->_packageInfo[
'configure_options']);
851 if (isset($this->_packageInfo[
'provides'])) {
852 return $this->_packageInfo[
'provides'];
864 $dir = preg_replace(array(
'!\\\\+!',
'!/+!'), array(
'/',
'/'), $dir);
865 if ($dir ==
'/' || $dir ==
'') {
870 $file = $dir . $file;
871 $file = preg_replace(
'![\\/]+!',
'/', $file);
872 $this->_packageInfo[
'filelist'][$file] = $attrs;
882 if (isset($this->_packageInfo[
'filelist'])) {
883 return $this->_packageInfo[
'filelist'];
890 $this->_packageInfo[
'filelist'][$file][$attr] = $value;
895 $this->_packageInfo[
'filelist'] = array();
901 return $this->_packageInfo[
'filelist'][$file][
'installed_as'] = $path;
903 unset($this->_packageInfo[
'filelist'][$file][
'installed_as']);
908 if (isset($this->_packageInfo[
'filelist'][$file])) {
909 $this->_packageInfo[
'filelist'][$file] =
910 array_merge($this->_packageInfo[
'filelist'][$file], $atts);
912 $this->_packageInfo[
'filelist'][$file] = $atts;
918 if (isset($this->_packageInfo[
'changelog'])) {
919 return $this->_packageInfo[
'changelog'];
936 return $this->_stack->getErrors($purge);
948 $this->_stack->push($code,
'error', $params,
false,
false, debug_backtrace());
949 $this->_isValid =
false;
960 $this->_stack->push($code,
'warning', $params,
false,
false, debug_backtrace());
971 'Missing Package Name',
975 'Summary should be on one line',
977 'Missing description',
981 'No release version found',
983 'No release state found',
985 'No release date found',
987 'No release notes found',
989 'Package must have at least one lead maintainer',
991 'No maintainers found, at least one must be defined',
993 'Maintainer %index% has no handle (user ID at channel server)',
995 'Maintainer %index% has no role',
997 'Maintainer %index% has no name',
999 'Maintainer %index% has no email',
1001 'Dependency %index% is not a php dependency, and has no name',
1003 'Dependency %index% has no relation (rel)',
1005 'Dependency %index% has no type',
1007 'PHP Dependency %index% has a name attribute of "%name%" which will be' .
1010 'Dependency %index% is not a rel="has" or rel="not" dependency, ' .
1011 'and has no version',
1013 'Dependency %index% is a type="php" dependency, ' .
1014 'and has no version',
1016 'Dependency %index% is a rel="%rel%" dependency, versioning is ignored',
1018 'Dependency %index% has invalid optional value "%opt%", should be yes or no',
1020 'Dependency %index%: php dependencies cannot use "not" rel, use "ne"' .
1021 ' to exclude specific versions',
1023 'Configure Option %index% has no name',
1025 'Configure Option %index% has no prompt',
1027 'No files in <filelist> section of package.xml',
1029 'File "%file%" has no role, expecting one of "%roles%"',
1031 'File "%file%" has invalid role "%role%", expecting one of "%roles%"',
1033 'File "%file%" cannot start with ".", cannot package or install',
1035 'Parser error: invalid PHP found in file "%file%"',
1037 'in %file%: %type% "%name%" not prefixed with package name "%package%"',
1039 'Parser error: invalid PHP file "%file%"',
1041 'Channel validator error: field "%field%" - %reason%',
1043 'Error, PHP5 token encountered in %file%, analysis should be in PHP5',
1045 'File "%file%" in package.xml does not exist',
1047 'Package.xml contains non-ISO-8859-1 characters, and may not validate',
1059 if (($this->_isValid & $state) == $state) {
1062 $this->_isValid =
true;
1064 if (empty($info[
'package'])) {
1066 $this->_packageName = $pn =
'unknown';
1068 $this->_packageName = $pn = $info[
'package'];
1071 if (empty($info[
'summary'])) {
1073 } elseif (strpos(trim($info[
'summary']),
"\n") !==
false) {
1075 array(
'summary' => $info[
'summary']));
1077 if (empty($info[
'description'])) {
1080 if (empty($info[
'release_license'])) {
1083 if (empty($info[
'version'])) {
1086 if (empty($info[
'release_state'])) {
1089 if (empty($info[
'release_date'])) {
1092 if (empty($info[
'release_notes'])) {
1095 if (empty($info[
'maintainers'])) {
1100 foreach ($info[
'maintainers'] as $m) {
1101 if (empty($m[
'handle'])) {
1103 array(
'index' => $i));
1105 if (empty($m[
'role'])) {
1108 } elseif ($m[
'role'] ==
'lead') {
1111 if (empty($m[
'name'])) {
1113 array(
'index' => $i));
1115 if (empty($m[
'email'])) {
1117 array(
'index' => $i));
1125 if (!empty($info[
'release_deps'])) {
1127 foreach ($info[
'release_deps'] as $d) {
1128 if (!isset($d[
'type']) || empty($d[
'type'])) {
1133 if (!isset($d[
'rel']) || empty($d[
'rel'])) {
1138 if (!empty($d[
'optional'])) {
1139 if (!in_array($d[
'optional'], array(
'yes',
'no'))) {
1141 array(
'index' => $i,
'opt' => $d[
'optional']));
1144 if ($d[
'rel'] !=
'has' && $d[
'rel'] !=
'not' && empty($d[
'version'])) {
1146 array(
'index' => $i));
1147 } elseif (($d[
'rel'] ==
'has' || $d[
'rel'] ==
'not') && !empty($d[
'version'])) {
1149 array(
'index' => $i,
'rel' => $d[
'rel']));
1151 if ($d[
'type'] ==
'php' && !empty($d[
'name'])) {
1153 array(
'index' => $i,
'name' => $d[
'name']));
1154 } elseif ($d[
'type'] !=
'php' && empty($d[
'name'])) {
1156 array(
'index' => $i));
1158 if ($d[
'type'] ==
'php' && empty($d[
'version'])) {
1160 array(
'index' => $i));
1162 if (($d[
'rel'] ==
'not') && ($d[
'type'] ==
'php')) {
1164 array(
'index' => $i));
1169 if (!empty($info[
'configure_options'])) {
1171 foreach ($info[
'configure_options'] as $c) {
1172 if (empty($c[
'name'])) {
1174 array(
'index' => $i));
1176 if (empty($c[
'prompt'])) {
1178 array(
'index' => $i));
1183 if (empty($info[
'filelist'])) {
1185 $errors[] =
'no files';
1187 foreach ($info[
'filelist'] as $file => $fa) {
1188 if (empty($fa[
'role'])) {
1196 if (preg_match(
'~/\.\.?(/|\\z)|^\.\.?/~', str_replace(
'\\',
'/', $file))) {
1199 array(
'file' => $file));
1201 if (isset($fa[
'install-as']) &&
1202 preg_match(
'~/\.\.?(/|\\z)|^\.\.?/~',
1203 str_replace(
'\\',
'/', $fa[
'install-as']))) {
1206 array(
'file' => $file .
' [installed as ' . $fa[
'install-as'] .
']'));
1208 if (isset($fa[
'baseinstalldir']) &&
1209 preg_match(
'~/\.\.?(/|\\z)|^\.\.?/~',
1210 str_replace(
'\\',
'/', $fa[
'baseinstalldir']))) {
1213 array(
'file' => $file .
' [baseinstalldir ' . $fa[
'baseinstalldir'] .
']'));
1217 if (isset($this->_registry) && $this->_isValid) {
1218 $chan = $this->_registry->getChannel(
'pear.php.net');
1219 if (PEAR::isError($chan)) {
1221 return $this->_isValid = 0;
1223 $validator = $chan->getValidationObject();
1224 $validator->setPackageFile($this);
1225 $validator->validate($state);
1226 $failures = $validator->getFailures();
1227 foreach ($failures[
'errors'] as $error) {
1230 foreach ($failures[
'warnings'] as $warning) {
1236 $this->_isValid =
true;
1239 if ($this->_isValid) {
1240 return $this->_isValid = $state;
1242 return $this->_isValid = 0;
1247 if (!$this->_isValid) {
1250 if (!isset($this->_packageFile)) {
1253 $dir_prefix = dirname($this->_packageFile);
1255 $log = isset($this->_logger) ? array(&$this->_logger,
'log') :
1256 array($common,
'log');
1258 foreach ($info as $file => $fa) {
1259 if (!file_exists($dir_prefix . DIRECTORY_SEPARATOR . $file)) {
1261 array(
'file' => realpath($dir_prefix) . DIRECTORY_SEPARATOR . $file));
1264 if ($fa[
'role'] ==
'php' && $dir_prefix) {
1265 call_user_func_array($log, array(1,
"Analyzing $file"));
1272 $this->_packageName = $pn = $this->
getPackage();
1274 if (isset($this->_packageInfo[
'provides'])) {
1275 foreach ((array) $this->_packageInfo[
'provides'] as $key => $what) {
1276 if (isset($what[
'explicit'])) {
1282 if ($type ==
'class') {
1283 if (!strncasecmp($name, $pn, $pnl)) {
1287 array(
'file' => $file,
'type' => $type,
'name' => $name,
'package' => $pn));
1288 } elseif ($type ==
'function') {
1289 if (strstr($name,
'::') || !strncasecmp($name, $pn, $pnl)) {
1293 array(
'file' => $file,
'type' => $type,
'name' => $name,
'package' => $pn));
1307 if (!class_exists(
'PEAR_PackageFile_Generator_v1')) {
1308 require_once
'PEAR/PackageFile/Generator/v1.php';
1321 if ($this->_archiveFile == $this->_packageFile) {
1322 $dir = dirname($this->_packageFile);
1323 $file = $dir . DIRECTORY_SEPARATOR . $file;
1324 $file = str_replace(array(
'/',
'\\'),
1325 array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $file);
1326 if (file_exists($file) && is_readable($file)) {
1327 return implode(
'', file($file));
1330 if (!class_exists(
'Archive_Tar')) {
1331 require_once
'Archive/Tar.php';
1335 if ($file !=
'package.xml' && $file !=
'package2.xml') {
1338 $file = $tar->extractInString($file);
1339 $tar->popErrorHandling();
1340 if (PEAR::isError($file)) {
1341 return PEAR::raiseError(
"Cannot locate file '$file' in archive");
1357 if (!function_exists(
"token_get_all")) {
1360 if (!defined(
'T_DOC_COMMENT')) {
1361 define(
'T_DOC_COMMENT', T_COMMENT);
1363 if (!defined(
'T_INTERFACE')) {
1364 define(
'T_INTERFACE', -1);
1366 if (!defined(
'T_IMPLEMENTS')) {
1367 define(
'T_IMPLEMENTS', -1);
1369 if (!$fp = @fopen($file,
"r")) {
1373 $contents = file_get_contents($file);
1374 $tokens = token_get_all($contents);
1391 $current_class =
'';
1392 $current_interface =
'';
1393 $current_class_level = -1;
1394 $current_function =
'';
1395 $current_function_level = -1;
1396 $declared_classes = array();
1397 $declared_interfaces = array();
1398 $declared_functions = array();
1399 $declared_methods = array();
1400 $used_classes = array();
1401 $used_functions = array();
1403 $implements = array();
1407 for ($i = 0; $i <
sizeof($tokens); $i++) {
1408 if (is_array($tokens[$i])) {
1409 list($token, $data) = $tokens[$i];
1411 $token = $tokens[$i];
1415 if ($token !=
'"' && $token != T_END_HEREDOC) {
1427 $current_function =
'';
1428 $current_function_level = -1;
1432 case T_START_HEREDOC:
1436 case T_DOLLAR_OPEN_CURLY_BRACES:
1437 case '{': $brace_level++;
continue 2;
1440 if ($current_class_level == $brace_level) {
1441 $current_class =
'';
1442 $current_class_level = -1;
1444 if ($current_function_level == $brace_level) {
1445 $current_function =
'';
1446 $current_function_level = -1;
1449 case '[': $bracket_level++;
continue 2;
1450 case ']': $bracket_level--;
continue 2;
1451 case '(': $paren_level++;
continue 2;
1452 case ')': $paren_level--;
continue 2;
1456 if (($current_class_level != -1) || ($current_function_level != -1)) {
1458 array(
'file' => $file));
1468 if ($look_for == T_CLASS) {
1469 $current_class = $data;
1470 $current_class_level = $brace_level;
1471 $declared_classes[] = $current_class;
1472 } elseif ($look_for == T_INTERFACE) {
1473 $current_interface = $data;
1474 $current_class_level = $brace_level;
1475 $declared_interfaces[] = $current_interface;
1476 } elseif ($look_for == T_IMPLEMENTS) {
1477 $implements[$current_class] = $data;
1478 } elseif ($look_for == T_EXTENDS) {
1479 $extends[$current_class] = $data;
1480 } elseif ($look_for == T_FUNCTION) {
1481 if ($current_class) {
1482 $current_function =
"$current_class::$data";
1483 $declared_methods[$current_class][] = $data;
1484 } elseif ($current_interface) {
1485 $current_function =
"$current_interface::$data";
1486 $declared_methods[$current_interface][] = $data;
1488 $current_function = $data;
1489 $declared_functions[] = $current_function;
1491 $current_function_level = $brace_level;
1493 } elseif ($look_for == T_NEW) {
1494 $used_classes[$data] =
true;
1503 if (preg_match(
'!^/\*\*\s!', $data)) {
1504 $lastphpdoc = $data;
1505 if (preg_match_all(
'/@nodep\s+(\S+)/', $lastphpdoc, $m)) {
1506 $nodeps = array_merge($nodeps, $m[1]);
1510 case T_DOUBLE_COLON:
1511 if (!($tokens[$i - 1][0] == T_WHITESPACE || $tokens[$i - 1][0] == T_STRING)) {
1513 array(
'file' => $file));
1516 $class = $tokens[$i - 1][1];
1517 if (strtolower($class) !=
'parent') {
1518 $used_classes[$class] =
true;
1524 "source_file" => $file,
1525 "declared_classes" => $declared_classes,
1526 "declared_interfaces" => $declared_interfaces,
1527 "declared_methods" => $declared_methods,
1528 "declared_functions" => $declared_functions,
1529 "used_classes" => array_diff(array_keys($used_classes), $nodeps),
1530 "inheritance" => $extends,
1531 "implements" => $implements,
1556 if (!$this->_isValid) {
1559 $file = basename($srcinfo[
'source_file']);
1562 foreach ($srcinfo[
'declared_classes'] as $class) {
1563 $key =
"class;$class";
1564 if (isset($this->_packageInfo[
'provides'][$key])) {
1567 $this->_packageInfo[
'provides'][$key] =
1568 array(
'file'=> $file,
'type' =>
'class',
'name' => $class);
1569 if (isset($srcinfo[
'inheritance'][$class])) {
1570 $this->_packageInfo[
'provides'][$key][
'extends'] =
1571 $srcinfo[
'inheritance'][$class];
1574 foreach ($srcinfo[
'declared_methods'] as $class => $methods) {
1575 foreach ($methods as $method) {
1576 $function =
"$class::$method";
1577 $key =
"function;$function";
1578 if ($method[0] ==
'_' || !strcasecmp($method, $class) ||
1579 isset($this->_packageInfo[
'provides'][$key])) {
1582 $this->_packageInfo[
'provides'][$key] =
1583 array(
'file'=> $file,
'type' =>
'function',
'name' => $function);
1587 foreach ($srcinfo[
'declared_functions'] as $function) {
1588 $key =
"function;$function";
1589 if ($function[0] ==
'_' || isset($this->_packageInfo[
'provides'][$key])) {
1592 if (!strstr($function,
'::') && strncasecmp($function, $pn, $pnl)) {
1593 $warnings[] =
"in1 " . $file .
": function \"$function\" not prefixed with package name \"$pn\"";
1595 $this->_packageInfo[
'provides'][$key] =
1596 array(
'file'=> $file,
'type' =>
'function',
'name' => $function);
const PEAR_VALIDATE_PACKAGING
const PEAR_VALIDATE_NORMAL
static getDependencyTypes()
static getDependencyRelations()
setPackagefile($file, $archive=false)
_buildProvidesArray($srcinfo)
getDependencyGroup($group)
addMaintainer($role, $handle, $name, $email)
addPackageDep($name, $version, $rel, $optional='no')
deleteMaintainer($handle)
addExtensionDep($name, $version, $rel, $optional='no')
setFileAttribute($file, $attr, $value)
_validateError($code, $params=array())
addConfigureOption($name, $prompt, $default=false)
updateMaintainer($role, $handle, $name, $email)
_analyzeSourceCode($file)
getInstallationFilelist()
getValidationWarnings($purge=true)
installBinary($installer)
_validateWarning($code, $params=array())
addFile($dir, $file, $attrs)
addPhpDep($version, $rel)
setInstalledAs($file, $path)
setLastInstalledVersion($version)
dependsOn($package, $channel)
installedFile($file, $atts)
getLastInstalledVersion()
validate($state=PEAR_VALIDATE_NORMAL, $nofilechecking=false)
const PEAR_PACKAGEFILE_ERROR_INVALID_DEPOPTIONAL
const PEAR_PACKAGEFILE_ERROR_NO_MAINTNAME
const PEAR_PACKAGEFILE_ERROR_FILE_NOTFOUND
const PEAR_PACKAGEFILE_ERROR_NO_DESCRIPTION
const PEAR_PACKAGEFILE_ERROR_NO_DATE
const PEAR_PACKAGEFILE_ERROR_NO_SUMMARY
const PEAR_PACKAGEFILE_ERROR_NO_DEPREL
const PEAR_PACKAGEFILE_ERROR_PHP5
const PEAR_PACKAGEFILE_PHP_NO_NOT
const PEAR_PACKAGEFILE_ERROR_NO_MAINTROLE
const PEAR_PACKAGEFILE_ERROR_NO_PNAME_PREFIX
const PEAR_PACKAGEFILE_ERROR_NO_LICENSE
const PEAR_PACKAGEFILE_ERROR_INVALID_FILEROLE
const PEAR_PACKAGEFILE_ERROR_INVALID_FILENAME
const PEAR_PACKAGEFILE_ERROR_DEPNAME_IGNORED
const PEAR_PACKAGEFILE_ERROR_NO_MAINTEMAIL
const PEAR_PACKAGEFILE_ERROR_INVALID_PHPFILE
const PEAR_PACKAGEFILE_ERROR_NO_MAINTAINERS
const PEAR_PACKAGEFILE_ERROR_NO_DEPTYPE
const PEAR_PACKAGEFILE_ERROR_NO_DEPPHPVERSION
const PEAR_PACKAGEFILE_ERROR_CHANNELVAL
const PEAR_PACKAGEFILE_ERROR_NON_ISO_CHARS
const PEAR_PACKAGEFILE_ERROR_NO_FILES
const PEAR_PACKAGEFILE_ERROR_INVALID_FILE
const PEAR_PACKAGEFILE_ERROR_NO_CONFPROMPT
const PEAR_PACKAGEFILE_ERROR_DEPVERSION_IGNORED
const PEAR_PACKAGEFILE_ERROR_NO_DEPNAME
const PEAR_PACKAGEFILE_ERROR_NO_MAINTHANDLE
const PEAR_PACKAGEFILE_ERROR_NO_FILEROLE
const PEAR_PACKAGEFILE_ERROR_NO_LEAD
const PEAR_PACKAGEFILE_ERROR_NO_NAME
const PEAR_PACKAGEFILE_ERROR_NO_NOTES
const PEAR_PACKAGEFILE_ERROR_NO_VERSION
const PEAR_PACKAGEFILE_ERROR_MULTILINE_SUMMARY
const PEAR_PACKAGEFILE_ERROR_NO_DEPVERSION
const PEAR_PACKAGEFILE_ERROR_NO_STATE
const PEAR_PACKAGEFILE_ERROR_NO_CONFNAME