public function getMagentoEnvironment() { if (!class_exists('Mage')) { $mage_filename = $this->_magentoRootDir . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'Mage.php'; require_once $mage_filename; } return \Mage::app(); }