Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_PackageFile_Parser_v2 Class Reference
Inheritance diagram for PEAR_PackageFile_Parser_v2:
Collaboration diagram for PEAR_PackageFile_Parser_v2:

Public Member Functions

 _unIndent ($str)
 parse ($data, $file=null, $archive=false, $class='PEAR_PackageFile_v2')
 postProcess ($data, $element)
 setConfig (&$c)
 setLogger (&$l)
Public Member Functions inherited from PEAR_XMLParser
 cdataHandler ($parser, $cdata)
 endHandler ($parser, $element)
 getData ()
 parse ($data)
 startHandler ($parser, $element, $attribs)

Data Fields

 $_config
 $_logger
 $_registry
Data Fields inherited from PEAR_XMLParser
 $_dataStack = array()
 $_depth = 0
 $_root = null
 $_unserializedData = null
 $_valStack = array()
 $encoding = 'ISO-8859-1'

Detailed Description

Definition at line 31 of file v2.php.

Member Function Documentation

◆ _unIndent()

_unIndent ( $str)

Unindent given string

Parameters
string$strThe string that has to be unindented.
Returns
string @access private

Definition at line 54 of file v2.php.

55 {
56 // remove leading newlines
57 $str = preg_replace('/^[\r\n]+/', '', $str);
58 // find whitespace at the beginning of the first line
59 $indent_len = strspn($str, " \t");
60 $indent = substr($str, 0, $indent_len);
61 $data = '';
62 // remove the same amount of whitespace from following lines
63 foreach (explode("\n", $str) as $line) {
64 if (substr($line, 0, $indent_len) == $indent) {
65 $data .= substr($line, $indent_len) . "\n";
66 } else {
67 $data .= $line . "\n";
68 }
69 }
70 return $data;
71 }

Referenced by postProcess().

Here is the caller graph for this function:

◆ parse()

parse ( $data,
$file = null,
$archive = false,
$class = 'PEAR_PackageFile_v2' )
Parameters
string
stringfile name of the package.xml
string|falsename of the archive this package.xml came from, if any
stringclass name to instantiate and return. This must be PEAR_PackageFile_v2 or a subclass
Returns
PEAR_PackageFile_v2

Definition at line 95 of file v2.php.

96 {
97 if (PEAR::isError($err = parent::parse($data))) {
98 return $err;
99 }
100
101 $ret = new $class;
102 $ret->encoding = $this->encoding;
103 $ret->setConfig($this->_config);
104 if (isset($this->_logger)) {
105 $ret->setLogger($this->_logger);
106 }
107
108 $ret->fromArray($this->_unserializedData);
109 $ret->setPackagefile($file, $archive);
110 return $ret;
111 }

References PEAR_XMLParser\$encoding.

◆ postProcess()

postProcess ( $data,
$element )

post-process data

Parameters
string$data
string$elementelement name

Reimplemented from PEAR_XMLParser.

Definition at line 79 of file v2.php.

80 {
81 if ($element == 'notes') {
82 return trim($this->_unIndent($data));
83 }
84 return trim($data);
85 }

References _unIndent().

Here is the call graph for this function:

◆ setConfig()

setConfig ( & $c)

Definition at line 37 of file v2.php.

38 {
39 $this->_config = &$c;
40 $this->_registry = &$c->getRegistry();
41 }

◆ setLogger()

setLogger ( & $l)

Definition at line 43 of file v2.php.

44 {
45 $this->_logger = &$l;
46 }

Field Documentation

◆ $_config

$_config

Definition at line 33 of file v2.php.

◆ $_logger

$_logger

Definition at line 34 of file v2.php.

◆ $_registry

$_registry

Definition at line 35 of file v2.php.


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/PackageFile/Parser/v2.php