public function setPlatformState(MaintenanceState $state)
    {
        if ($previous = $this->getDriver()->get(self::PREFIX . self::LAST_MODE)) {
            $currentState = new MaintenanceState(json_decode($previous, true));
            $currentState->setEndTime($state->getStartTime());
            $this->getDriver()->set(self::PREFIX . $currentState->getId(), json_encode($currentState->toArray()));

            $state->setId($currentState->getId() + 1);
        }


        $this->getDriver()->set(self::PREFIX . self::LAST_MODE, json_encode($state->toArray()));
    }
public function setPlatformState(MaintenanceState $state)
    {
        if ($previous = $this->getDriver()->get(self::PREFIX . self::LAST_MODE)) {
            $currentState = new MaintenanceState(json_decode($previous, true));
            $currentState->setEndTime($state->getStartTime());
            $this->getDriver()->set(self::PREFIX . $currentState->getId(), json_encode($currentState->toArray()));

            $state->setId($currentState->getId() + 1);
        }


        $this->getDriver()->set(self::PREFIX . self::LAST_MODE, json_encode($state->toArray()));
    }
public function setPlatformState ( MaintenanceState $ state ) { if ( $ previous = $ this -> getDriver ( ) -> get ( self :: PREFIX . self :: LAST_MODE ) ) { $ currentState = new MaintenanceState ( json_decode ( $ previous , true ) ) ; $ currentState -> setEndTime ( $ state -> getStartTime ( ) ) ; $ this -> getDriver ( ) -> set ( self :: PREFIX . $ currentState -> getId ( ) , json_encode ( $ currentState -> toArray ( ) ) ) ; $ state -> setId ( $ currentState -> getId ( ) + 1 ) ; } $ this -> getDriver ( ) -> set ( self :: PREFIX . self :: LAST_MODE , json_encode ( $ state -> toArray ( ) ) ) ; }
Persist the maintenance state

If old maintenance exists, set key with old state id
Persist new maintenance state with key 'last'

@param MaintenanceState $state
Persist the maintenance state