コード例 #1
0
ファイル: RegRevGenerator.php プロジェクト: fakerino/fakerino
 /**
  * @param string $regex
  *
  * @return string
  * @throws InvalidRegexException
  */
 public function generate($regex)
 {
     $expr = substr($regex, 1, -1);
     try {
         $result = RegRev::generate($expr);
     } catch (\Exception $e) {
         throw new InvalidRegexException($expr);
     }
     return $result;
 }
コード例 #2
0
ファイル: RegRevGenerator.php プロジェクト: jmolivas/Fakerino
 /**
  * @param string $regex
  *
  * @return string
  * @throws InvalidRegexException
  */
 public function generate($regex)
 {
     $expr = substr($regex, 1, -1);
     $result = RegRev::generate($expr);
     if ($result !== null) {
         return $result;
     } else {
         throw new InvalidRegexException($expr);
     }
 }
コード例 #3
0
ファイル: Subpattern.php プロジェクト: arthaud/write-ups-2016
 /**
  * {@inheritdoc}
  */
 public function generate()
 {
     return RegRev::generate(substr($this->getMatch(), 1, -1));
 }
コード例 #4
0
ファイル: test.php プロジェクト: arthaud/write-ups-2016
<?php

require 'vendor/autoload.php';
use RegRev\RegRev;
echo RegRev::generate($argv[1]);
//ouput a random number
echo "\n";