コード例 #1
0
 /**
  * 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];
     }
 }
コード例 #2
0
ファイル: TarotDeck.php プロジェクト: destinylab/tarot
 /**
  * @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'];
 }
コード例 #3
0
 public function testGetPaths()
 {
     $this->assertInternalType('array', $this->container->getPaths());
 }