/**
  * {@inheritdoc}
  */
 public function asConfig()
 {
     if (!count($this->collection)) {
         return;
     }
     $pregs = [];
     foreach ($this->collection as list($tagName, $regexp, $passthroughIdx)) {
         $captures = RegexpParser::getCaptureNames($regexp);
         $pregs[] = [$tagName, new Regexp($regexp, true), $passthroughIdx, $captures];
     }
     return ['generics' => $pregs];
 }
Exemple #2
0
 public function asConfig()
 {
     if (!\count($this->collection)) {
         return;
     }
     $pregs = array();
     foreach ($this->collection as $_ca164be8) {
         list($tagName, $regexp, $passthroughIdx) = $_ca164be8;
         $captures = RegexpParser::getCaptureNames($regexp);
         $pregs[] = array($tagName, new Regexp($regexp, \true), $passthroughIdx, $captures);
     }
     return array('generics' => $pregs);
 }
Exemple #3
0
 /**
  * Return the name of each capture in this regexp
  *
  * @return string[]
  */
 public function getCaptureNames()
 {
     return RegexpParser::getCaptureNames($this->regexp);
 }
 /**
  * @testdox getCaptureNames() works
  * @dataProvider getGetCaptureNamesTests
  */
 public function testGetCaptureNamesTests($regexp, array $expected)
 {
     $this->assertSame($expected, RegexpParser::getCaptureNames($regexp));
 }