Varien_Convert_Container_Abstract Class Reference

Inheritance diagram for Varien_Convert_Container_Abstract:

Varien_Convert_Container_Interface Varien_Convert_Adapter_Abstract Varien_Convert_Container_Generic Varien_Convert_Mapper_Abstract Varien_Convert_Parser_Abstract Varien_Convert_Validator_Abstract Mage_Core_Model_Convert_Adapter_Interactive Varien_Convert_Adapter_Db_Table Varien_Convert_Adapter_Http Varien_Convert_Adapter_Http_Curl Varien_Convert_Adapter_Io Varien_Convert_Adapter_Soap Varien_Convert_Adapter_Std Varien_Convert_Adapter_Zend_Cache Varien_Convert_Adapter_Zend_Db Varien_Convert_Mapper_Column Varien_Convert_Parser_Csv Varien_Convert_Parser_Serialize Varien_Convert_Parser_Xml_Excel Varien_Convert_Validator_Column Varien_Convert_Validator_Dryrun

List of all members.

Public Member Functions

 getVar ($key, $default=null)
 getVars ()
 setVar ($key, $value=null)
 getProfile ()
 setProfile (Varien_Convert_Profile_Abstract $profile)
 getData ()
 setData ($data)
 validateDataString ($data=null)
 validateDataArray ($data=null)
 validateDataGrid ($data=null)
 getGridFields ($grid)
 addException ($error, $level=null)
 getPosition ()
 setPosition ($position)

Protected Attributes

 $_vars
 $_profile
 $_data
 $_position


Detailed Description

Definition at line 35 of file Abstract.php.


Member Function Documentation

addException ( error,
level = null 
)

Definition at line 142 of file Abstract.php.

00143     {
00144         $e = new Varien_Convert_Exception($error);
00145         $e->setLevel(!is_null($level) ? $level : Varien_Convert_Exception::NOTICE);
00146         $e->setContainer($this);
00147         $e->setPosition($this->getPosition());
00148 
00149         if ($this->getProfile()) {
00150             $this->getProfile()->addException($e);
00151         }
00152 
00153         return $e;
00154     }

getData (  ) 

Definition at line 76 of file Abstract.php.

00077     {
00078         if (is_null($this->_data) && $this->getProfile()) {
00079             $this->_data = $this->getProfile()->getContainer()->getData();
00080         }
00081         return $this->_data;
00082     }

getGridFields ( grid  ) 

Definition at line 129 of file Abstract.php.

00130     {
00131         $fields = array();
00132         foreach ($grid as $i=>$row) {
00133             foreach ($row as $fieldName=>$data) {
00134                 if (!in_array($fieldName, $fields)) {
00135                     $fields[] = $fieldName;
00136                 }
00137             }
00138         }
00139         return $fields;
00140     }

getPosition (  ) 

Definition at line 156 of file Abstract.php.

00157     {
00158         return $this->_position;
00159     }

getProfile (  ) 

Definition at line 65 of file Abstract.php.

00066     {
00067         return $this->_profile;
00068     }

getVar ( key,
default = null 
)

Definition at line 42 of file Abstract.php.

00043     {
00044         if (!isset($this->_vars[$key])) {
00045             return $default;
00046         }
00047         return $this->_vars[$key];
00048     }

getVars (  ) 

Definition at line 50 of file Abstract.php.

00051     {
00052         return $this->_vars;
00053     }

setData ( data  ) 

Definition at line 84 of file Abstract.php.

00085     {
00086         if ($this->getProfile()) {
00087             $this->getProfile()->getContainer()->setData($data);
00088         }
00089         $this->_data = $data;
00090         return $this;
00091     }

setPosition ( position  ) 

Definition at line 161 of file Abstract.php.

00162     {
00163         $this->_position = $position;
00164         return $this;
00165     }

setProfile ( Varien_Convert_Profile_Abstract profile  ) 

Definition at line 70 of file Abstract.php.

00071     {
00072         $this->_profile = $profile;
00073         return $this;
00074     }

setVar ( key,
value = null 
)

Definition at line 55 of file Abstract.php.

00056     {
00057         if (is_array($key) && is_null($value)) {
00058             $this->_vars = $key;
00059         } else {
00060             $this->_vars[$key] = $value;
00061         }
00062         return $this;
00063     }

validateDataArray ( data = null  ) 

Definition at line 104 of file Abstract.php.

00105     {
00106         if (is_null($data)) {
00107             $data = $this->getData();
00108         }
00109         if (!is_array($data)) {
00110             $this->addException("Invalid data type, expecting array.", Varien_Convert_Exception::FATAL);
00111         }
00112         return true;
00113     }

validateDataGrid ( data = null  ) 

Definition at line 115 of file Abstract.php.

00116     {
00117         if (is_null($data)) {
00118             $data = $this->getData();
00119         }
00120         if (!is_array($data) || !is_array(current($data))) {
00121             if (count($data)==0) {
00122                 return true;
00123             }
00124             $this->addException("Invalid data type, expecting 2D grid array.", Varien_Convert_Exception::FATAL);
00125         }
00126         return true;
00127     }

validateDataString ( data = null  ) 

Definition at line 93 of file Abstract.php.

00094     {
00095         if (is_null($data)) {
00096             $data = $this->getData();
00097         }
00098         if (!is_string($data)) {
00099             $this->addException("Invalid data type, expecting string.", Varien_Convert_Exception::FATAL);
00100         }
00101         return true;
00102     }


Member Data Documentation

$_data [protected]

Definition at line 39 of file Abstract.php.

$_position [protected]

Definition at line 40 of file Abstract.php.

$_profile [protected]

Definition at line 38 of file Abstract.php.

$_vars [protected]

Definition at line 37 of file Abstract.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:58 2009 for Magento by  doxygen 1.5.8