Public Member Functions | |
getContainers () | |
getContainer ($name) | |
addContainer ($name, Varien_Convert_Container_Interface $container) | |
getProfiles () | |
getProfile ($name) | |
addProfile ($name, Varien_Convert_Profile_Abstract $profile=null) | |
run ($profile) | |
getClassNameByType ($type) | |
importXml ($xml) | |
importProfileXml ($name) | |
Protected Attributes | |
$_xml | |
$_containers | |
$_profiles = array() | |
$_simplexmlDefaultClass = 'Varien_Simplexml_Element' | |
$_profileDefaultClass = 'Varien_Convert_Profile' | |
$_profileCollectionDefaultClass = 'Varien_Convert_Profile_Collection' | |
$_containerDefaultClass = 'Varien_Convert_Container_Generic' | |
$_containerCollectionDefaultClass = 'Varien_Convert_Container_Collection' |
Definition at line 35 of file Collection.php.
addContainer | ( | $ | name, | |
Varien_Convert_Container_Interface $ | container | |||
) |
Definition at line 62 of file Collection.php.
00063 { 00064 $container = $this->getContainers()->addItem($name, $container); 00065 return $container; 00066 }
addProfile | ( | $ | name, | |
Varien_Convert_Profile_Abstract $ | profile = null | |||
) |
Definition at line 81 of file Collection.php.
00082 { 00083 if (is_null($profile)) { 00084 $profile = new $this->_profileDefaultClass(); 00085 } 00086 $this->_profiles[$name] = $profile; 00087 return $profile; 00088 }
getClassNameByType | ( | $ | type | ) |
getContainer | ( | $ | name | ) |
Definition at line 56 of file Collection.php.
00057 { 00058 return $this->getContainers()->getItem($name); 00059 }
getContainers | ( | ) |
Definition at line 47 of file Collection.php.
00048 { 00049 if (!$this->_containers) { 00050 $this->_containers = new $this->_containerCollectionDefaultClass(); 00051 $this->_containers->setDefaultClass($this->_containerDefaultClass); 00052 } 00053 return $this->_containers; 00054 }
getProfile | ( | $ | name | ) |
Definition at line 73 of file Collection.php.
00074 { 00075 if (!isset($this->_profiles[$name])) { 00076 $this->importProfileXml($name); 00077 } 00078 return $this->_profiles[$name]; 00079 }
getProfiles | ( | ) |
importProfileXml | ( | $ | name | ) |
Definition at line 124 of file Collection.php.
00125 { 00126 if (!$this->_xml) { 00127 return $this; 00128 } 00129 $nodes = $this->_xml->xpath("//profile[@name='".$name."']"); 00130 if (!$nodes) { 00131 return $this; 00132 } 00133 $profileNode = $nodes[0]; 00134 00135 $profile = $this->addProfile($name); 00136 $profile->setContainers($this->getContainers()); 00137 foreach ($profileNode->action as $actionNode) { 00138 $action = $profile->addAction(); 00139 foreach ($actionNode->attributes() as $key=>$value) { 00140 $action->setParam($key, (string)$value); 00141 } 00142 00143 if ($actionNode['use']) { 00144 $container = $profile->getContainer((string)$actionNode['use']); 00145 } else { 00146 $action->setParam('class', $this->getClassNameByType((string)$actionNode['type'])); 00147 $container = $action->getContainer(); 00148 } 00149 $action->setContainer($container); 00150 if ($action->getParam('name')) { 00151 $this->addContainer($action->getParam('name'), $container); 00152 } 00153 foreach ($actionNode->var as $varNode) { 00154 $container->setVar((string)$varNode['name'], (string)$varNode); 00155 } 00156 } 00157 00158 return $this; 00159 }
importXml | ( | $ | xml | ) |
Definition at line 101 of file Collection.php.
00102 { 00103 if (is_string($xml)) { 00104 $xml = simplexml_load_string($xml, $this->_simplexmlDefaultClass); 00105 } 00106 if (!$xml instanceof SimpleXMLElement) { 00107 return $this; 00108 } 00109 $this->_xml = $xml; 00110 00111 foreach ($xml->container as $containerNode) { 00112 if (!$containerNode['name'] || !$containerNode['type']) { 00113 continue; 00114 } 00115 $class = $this->getClassNameByType((string)$containerNode['type']); 00116 $container = $this->addContainer((string)$containerNode['name'], new $class()); 00117 foreach ($containerNode->var as $varNode) { 00118 $container->setVar((string)$varNode['name'], (string)$varNode); 00119 } 00120 } 00121 return $this; 00122 }
run | ( | $ | profile | ) |
Definition at line 90 of file Collection.php.
00091 { 00092 $this->getProfile($profile)->run(); 00093 return $this; 00094 }
$_containerCollectionDefaultClass = 'Varien_Convert_Container_Collection' [protected] |
Definition at line 45 of file Collection.php.
$_containerDefaultClass = 'Varien_Convert_Container_Generic' [protected] |
Definition at line 44 of file Collection.php.
$_containers [protected] |
Definition at line 38 of file Collection.php.
$_profileCollectionDefaultClass = 'Varien_Convert_Profile_Collection' [protected] |
Definition at line 43 of file Collection.php.
$_profileDefaultClass = 'Varien_Convert_Profile' [protected] |
Definition at line 42 of file Collection.php.
$_profiles = array() [protected] |
Definition at line 39 of file Collection.php.
$_simplexmlDefaultClass = 'Varien_Simplexml_Element' [protected] |
Definition at line 41 of file Collection.php.
$_xml [protected] |
Definition at line 37 of file Collection.php.