/** * Set list */ protected function setList() { $format = $this->container->getDefaultFormat(); $finder = new Finder(); $finder->files()->in($this->resourcePath)->name('*.' . $format); foreach ($finder as $file) { $regex = '/^(.*)\\.' . $format . '$/'; preg_match($regex, $file->getFilename(), $matches); $this->list[] = $matches[1]; } }
/** * @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']; }
public function testGetPaths() { $this->assertInternalType('array', $this->container->getPaths()); }