PageRenderTime 76ms CodeModel.GetById 37ms RepoModel.GetById 1ms app.codeStats 0ms

/app/code/core/Mage/DesignEditor/Model/History/CompactAbstract.php

https://bitbucket.org/sunil_nextbits/magento2
PHP | 78 lines | 24 code | 4 blank | 50 comment | 2 complexity | 831b23e0318c177ad3b3b1fd2fb7e9ac MD5 | raw file
  1. <?php
  2. /**
  3. * Magento
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@magentocommerce.com so we can send you a copy immediately.
  14. *
  15. * DISCLAIMER
  16. *
  17. * Do not edit or add to this file if you wish to upgrade Magento to newer
  18. * versions in the future. If you wish to customize Magento for your
  19. * needs please refer to http://www.magentocommerce.com for more information.
  20. *
  21. * @category Mage
  22. * @package Mage_DesignEditor
  23. * @copyright Copyright (c) 2012 X.commerce, Inc. (http://www.magentocommerce.com)
  24. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  25. */
  26. /**
  27. * Compaction model abstract
  28. */
  29. abstract class Mage_DesignEditor_Model_History_CompactAbstract
  30. implements Mage_DesignEditor_Model_History_CompactInterface
  31. {
  32. /**
  33. * Changes collection
  34. *
  35. * @var Mage_DesignEditor_Model_Change_Collection
  36. */
  37. protected $_changesCollection;
  38. /**
  39. * Set change collection
  40. *
  41. * @param Mage_DesignEditor_Model_Change_Collection $collection
  42. * @return Mage_DesignEditor_Model_History_Compact_Layout
  43. */
  44. public function setChangesCollection(Mage_DesignEditor_Model_Change_Collection $collection)
  45. {
  46. $this->_changesCollection = $collection;
  47. return $this;
  48. }
  49. /**
  50. * Get change collection
  51. *
  52. * @return Mage_DesignEditor_Model_Change_Collection
  53. */
  54. public function getChangesCollection()
  55. {
  56. return $this->_changesCollection;
  57. }
  58. /**
  59. * Signature of compact method to implement in subclasses
  60. *
  61. * @param Mage_DesignEditor_Model_Change_Collection $collection
  62. * @throws Magento_Exception
  63. * @return Mage_DesignEditor_Model_History_CompactInterface
  64. */
  65. public function compact($collection = null)
  66. {
  67. if (null === $collection) {
  68. if (!$this->getChangesCollection()) {
  69. throw new Magento_Exception('Compact collection is missed');
  70. }
  71. }
  72. return $this->setChangesCollection($collection);
  73. }
  74. }