PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/gespac/config/PEAR/PEAR/ChannelFile/Parser.php

http://gespac.googlecode.com/
PHP | 68 lines | 33 code | 6 blank | 29 comment | 2 complexity | c530153bde718e2028c5ee0edcde919f MD5 | raw file
 1<?php
 2/**
 3 * PEAR_ChannelFile_Parser for parsing channel.xml
 4 *
 5 * PHP versions 4 and 5
 6 *
 7 * @category   pear
 8 * @package    PEAR
 9 * @author     Greg Beaver <cellog@php.net>
10 * @copyright  1997-2009 The Authors
11 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
12 * @version    CVS: $Id: Parser.php 276383 2009-02-24 23:39:37Z dufuz $
13 * @link       http://pear.php.net/package/PEAR
14 * @since      File available since Release 1.4.0a1
15 */
16
17/**
18 * base xml parser class
19 */
20require_once 'PEAR/XMLParser.php';
21require_once 'PEAR/ChannelFile.php';
22/**
23 * Parser for channel.xml
24 * @category   pear
25 * @package    PEAR
26 * @author     Greg Beaver <cellog@php.net>
27 * @copyright  1997-2009 The Authors
28 * @license    http://opensource.org/licenses/bsd-license.php New BSD License
29 * @version    Release: 1.9.1
30 * @link       http://pear.php.net/package/PEAR
31 * @since      Class available since Release 1.4.0a1
32 */
33class PEAR_ChannelFile_Parser extends PEAR_XMLParser
34{
35    var $_config;
36    var $_logger;
37    var $_registry;
38
39    function setConfig(&$c)
40    {
41        $this->_config = &$c;
42        $this->_registry = &$c->getRegistry();
43    }
44
45    function setLogger(&$l)
46    {
47        $this->_logger = &$l;
48    }
49
50    function parse($data, $file)
51    {
52        if (PEAR::isError($err = parent::parse($data, $file))) {
53            return $err;
54        }
55
56        $ret = new PEAR_ChannelFile;
57        $ret->setConfig($this->_config);
58        if (isset($this->_logger)) {
59            $ret->setLogger($this->_logger);
60        }
61
62        $ret->fromArray($this->_unserializedData);
63        // make sure the filelist is in the easy to read format needed
64        $ret->flattenFilelist();
65        $ret->setPackagefile($file, $archive);
66        return $ret;
67    }
68}