This allows us to load the statemachine configuration from a specific source and use a different sink to write the current state and history information to. You might want to do this to read the relatively static content for the configuration from the filesystem and use a fast backend system to write the state and transition history data to. for example: - use an xml file with the PDO (sql) adapter: izzum\statemachine\loader\XML & izzum\statemachine\persistence\PDO - use a json file with the Redis adapter: izzum\statemachine\loader\JSON & izzum\statemachine\persistence\Redis classes - use php code to configure the machine with the Session adapter: izzum\statemachine\loader\LoaderArray & izzum\statemachine\persistence\Session classes)
Author: Rolf Vreijdenberger
Inheritance: extends izzum\statemachine\persistence\Adapter, implements izzum\statemachine\loader\Loader
 /**
  * @test
  */
 public function shouldBehave()
 {
     $loader = XML::createFromFile(__DIR__ . '/../../../../assets/xml/example.xml');
     $writer = new Memory();
     $delegator = new ReaderWriterDelegator($loader, $writer);
     $this->assertSame($loader, $delegator->getReader());
     $this->assertSame($writer, $delegator->getWriter());
     $this->assertContains('Memory', $delegator->toString());
     $this->assertContains('XML', $delegator->toString());
     $this->assertContains('Memory', $delegator . '');
     $this->assertContains('XML', $delegator . '');
 }
 /**
  * @test
  */
 public function shouldBehave()
 {
     $loader = XML::createFromFile(__DIR__ . '/../../../../assets/xml/example.xml');
     $writer = new Memory();
     Memory::clear();
     $delegator = new ReaderWriterDelegator($loader, $writer);
     $this->assertSame($loader, $delegator->getReader());
     $this->assertSame($writer, $delegator->getWriter());
     $this->assertContains('Memory', $delegator->toString());
     $this->assertContains('XML', $delegator->toString());
     $this->assertContains('Memory', $delegator . '');
     $this->assertContains('XML', $delegator . '');
     $this->assertCount(0, $delegator->getEntityIds('test'));
     $this->assertFalse($delegator->isPersisted(new Identifier('123', 'bogus')));
     $delegator->setFailedTransition(new Identifier('foo', 'bar'), new Transition(new State('foo'), new State('bar')), new \Exception('bogus'));
 }