code: protected function didStateChangeTo($resource, $state)
      {
          if (empty($stateCs = $this->tracker->getChangeSet($resource, 'state'))) {
              return false;
          }
  
          if ($stateCs[1] === $state && $stateCs[0] !== $state) {
              return true;
          }
  
          return false;
      }
docs: Returns whether the state of the given resource changed to the given state.
  
  @param object $resource
  @param string $state
  
  @return bool