/**
  * {@inheritDoc}
  */
 public function get($poetryId)
 {
     if (!in_array($poetryId, $this->list)) {
         throw new InvalidArgumentException('Invalid poetry ID!');
     }
     return $this->container->load($poetryId);
 }
예제 #2
0
 /**
  * @param string $deckName
  * @param array  $paths
  * @throws TarotException
  */
 public function __construct($deckName, array $paths = [])
 {
     $container = new Container();
     $container->setDefaultFormat('json')->addPath(__DIR__ . '/../resources/');
     $paths and $container->addPaths($paths);
     $data = $container->load($deckName);
     if (!isset($data['cards']) or !isset($data['groups'])) {
         throw new TarotException('Content errors!');
     }
     $this->cards = $data['cards'];
     $this->groups = $data['groups'];
 }
 /**
  * @expectedException LogicException
  */
 public function testLoadWithoutAddPath()
 {
     $this->assertFalse($this->container->load('foo'));
 }