示例#1
0
 /**
  * @test
  */
 public function canReplaceExistingRecognition()
 {
     Parse::addRecognition(function ($string) {
         if ('Binford 6100' === $string) {
             return true;
         }
     }, 'booleanTrue');
     assertTrue(Parse::toType('Binford 6100'));
 }
示例#2
0
 /**
  * @test
  */
 public function parseRecognizesHttpsUris()
 {
     assert(Parse::toType('https://example.net/'), equals(HttpUri::fromString('https://example.net/')));
 }
示例#3
0
 /**
  * parses value to correct type
  *
  * @param   string  $value
  * @return  mixed
  */
 private function parseType(string $value)
 {
     if (substr($value, 0, 1) === '"' && substr($value, -1) === '"' || substr($value, 0, 1) === "'" && substr($value, -1) === "'") {
         return substr($value, 1, strlen($value) - 2);
     }
     return Parse::toType($value);
 }