Пример #1
0
 public function __construct($template, array $options = array())
 {
     $template = preg_replace_callback('#^\\+([^\\+]+)\\+#', function ($match) use(&$delimiter) {
         $delimiter = $match[1];
         return '';
     }, $template);
     parent::__construct($template, $options);
     if (isset($delimiter)) {
         $this->delimiter = $delimiter;
     }
     $itemsCount = count($this->template);
     $this->permutation = new Permutation($itemsCount);
     $firstSequence = $this->permutation->current();
     $this->sequenceArray[0] = $firstSequence;
     $this->currentTemplateKeySequence = $firstSequence;
 }
Пример #2
0
 public function testCurrent()
 {
     $permutation = new Permutation(3);
     $this->assertEquals(array(0, 1, 2), $permutation->current());
 }