Пример #1
0
 protected function _test_create_http_uri_example_com_here_params()
 {
     $messages = array('Path with //example.com/here?first=one');
     $expected_exception = null;
     $callback = function () {
         $wrapper = new h\uri\path();
         $wrapper->set_impl(new h\uri\hierarchical_part());
         $wrapper->path->set_impl(new h\uri\net_path());
         $wrapper->authority->host->set_impl(new h\inet\host());
         $wrapper->authority->host->segments[] = 'example';
         $wrapper->authority->host->segments[] = 'com';
         $wrapper->path->path->set_impl(new h\uri\absolute_path());
         $wrapper->path->path->segments[] = 'here';
         $wrapper->query['first'] = 'one';
         return h\string('//example.com/here?first=one')->is_equal($wrapper->_to_string());
     };
     $this->add_test($callback, $messages, $expected_exception);
 }
Пример #2
0
 public function do_feed(h\string $meat)
 {
     $path = new path();
     if (0 === $meat->search(h\string('//'))) {
         $impl = $this->do_create_net_path($meat);
     } elseif (0 === $meat->search(h\string('/'))) {
         $impl = $this->do_create_absolute_path($meat);
     } elseif (0 === $meat->search(h\string('.'))) {
         $impl = $this->do_create_relative_path($meat);
     } else {
         throw $this->_exception('No path');
     }
     $path->set_impl($impl);
     return $path;
 }