示例#1
0
 /**
  * This method tests the "min" method.
  *
  * @dataProvider data_min
  */
 public function test_min(array $provided, array $expected)
 {
     $p0 = IRegex\Module::min(IRegex\Type::box($provided[0]), IRegex\Type::box($provided[1]));
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IRegex\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
示例#2
0
 /**
  * This method returns the latter value should the former value evaluates
  * to null.
  *
  * @access public
  * @static
  * @param IRegex\Type $x                                    the value to be evaluated
  * @param IRegex\Type $y                                    the default value
  * @return IRegex\Type                                      the result
  */
 public static function nvl(IRegex\Type $x = null, IRegex\Type $y = null) : IRegex\Type
 {
     return $x ?? $y ?? IRegex\Type::box('/^.*$/');
 }
示例#3
0
 /**
  * This method tests the "toString" method.
  *
  * @dataProvider data_toString
  */
 public function test_toString(array $provided, array $expected)
 {
     $p0 = IRegex\Type::box($provided[0])->toString();
     $e0 = $expected[0];
     $this->assertInstanceOf('\\Saber\\Data\\IString\\Type', $p0);
     $this->assertSame($e0, $p0->unbox());
 }
示例#4
0
 /**
  * This method returns an array list of substrings that were delimited by a whitespace
  * character.
  *
  * @access public
  * @static
  * @param IString\Type $xs                                   the left operand
  * @return IArrayList\Type                                   an array list of substrings
  */
 public static function words(IString\Type $xs)
 {
     return IRegex\Module::split(IRegex\Type::box('/\\s+/'), $xs);
 }