rw.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * <tasks:replace> - read/write version
  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. * @link http://pear.php.net/package/PEAR
  13. * @since File available since Release 1.4.0a10
  14. */
  15. /**
  16. * Base class
  17. */
  18. require_once 'PEAR/Task/Replace.php';
  19. /**
  20. * Abstracts the replace task xml.
  21. * @category pear
  22. * @package PEAR
  23. * @author Greg Beaver <cellog@php.net>
  24. * @copyright 1997-2009 The Authors
  25. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  26. * @version Release: 1.10.10
  27. * @link http://pear.php.net/package/PEAR
  28. * @since Class available since Release 1.4.0a10
  29. */
  30. class PEAR_Task_Replace_rw extends PEAR_Task_Replace
  31. {
  32. public function __construct(&$pkg, &$config, &$logger, $fileXml)
  33. {
  34. parent::__construct($config, $logger, PEAR_TASK_PACKAGE);
  35. $this->_contents = $fileXml;
  36. $this->_pkg = &$pkg;
  37. $this->_params = array();
  38. }
  39. public function validate()
  40. {
  41. return $this->validateXml($this->_pkg, $this->_params, $this->config, $this->_contents);
  42. }
  43. public function setInfo($from, $to, $type)
  44. {
  45. $this->_params = array('attribs' => array('from' => $from, 'to' => $to, 'type' => $type));
  46. }
  47. public function getName()
  48. {
  49. return 'replace';
  50. }
  51. public function getXml()
  52. {
  53. return $this->_params;
  54. }
  55. }