Source of file TransactionModifierStateTrait.php
Size: 1,224 Bytes - Last Modified: 2021-12-24T06:51:34+00:00
/var/www/docs.ssmods.com/process/src/src/Transaction/Traits/TransactionModifierStateTrait.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 | <?php /** * This file is part of the Ecommerce-Core package * * @package Ecommerce-Core */ /** * Traits namespace */ namespace Heystack\Ecommerce\Transaction\Traits; /** * Provides an implementation for the Statable Interface for Transaction Modifiers * * @copyright Heyday * @author Glenn Bautista <glenn@heyday.co.nz> * @package Ecommerce-Core */ trait TransactionModifierStateTrait { use TransactionModifierHasDataTrait; /** * Saves the data array on the State service * @return void */ public function saveState() { $this->getStateService()->setByKey( $this->getIdentifier()->getFull(), $this->getData() ); } /** * Uses the State service to restore the data array * @return void */ public function restoreState() { $this->setData( $this->getStateService()->getByKey( $this->getIdentifier()->getFull() ) ); } /** * @return \Heystack\Core\State\State */ abstract public function getStateService(); /** * @return \Heystack\Core\Identifier\IdentifierInterface */ abstract public function getIdentifier(); } |