Merge pull request #3168 from stanley-cheung/php_routeguide_package_name

php: change routeguide package name
pull/3174/head
Michael Lumish 9 years ago
commit 4668600d11
  1. 20
      examples/php/route_guide/README.md
  2. 142
      examples/php/route_guide/route_guide.php
  3. 2
      examples/php/route_guide/route_guide.proto
  4. 16
      examples/php/route_guide/route_guide_client.php

@ -153,7 +153,7 @@ require dirname(__FILE__) . '/route_guide.php';
The file contains: The file contains:
- All the protocol buffer code to populate, serialize, and retrieve our request and response message types. - All the protocol buffer code to populate, serialize, and retrieve our request and response message types.
- A class called `examples\RouteGuideClient` that lets clients call the methods defined in the `RouteGuide` service. - A class called `routeguide\RouteGuideClient` that lets clients call the methods defined in the `RouteGuide` service.
<a name="client"></a> <a name="client"></a>
@ -166,7 +166,7 @@ In this section, we'll look at creating a PHP client for our `RouteGuide` servic
To call service methods, we first need to create a client object, an instance of the generated `RouteGuideClient` class. The constructor of the class expects the server address and port we want to connect to: To call service methods, we first need to create a client object, an instance of the generated `RouteGuideClient` class. The constructor of the class expects the server address and port we want to connect to:
```php ```php
$client = new examples\RouteGuideClient(new Grpc\BaseStub('localhost:50051', [])); $client = new routeguide\RouteGuideClient(new Grpc\BaseStub('localhost:50051', []));
``` ```
### Calling service methods ### Calling service methods
@ -178,13 +178,13 @@ Now let's look at how we call our service methods.
Calling the simple RPC `GetFeature` is nearly as straightforward as calling a local asynchronous method. Calling the simple RPC `GetFeature` is nearly as straightforward as calling a local asynchronous method.
```php ```php
$point = new examples\Point(); $point = new routeguide\Point();
$point->setLatitude(409146138); $point->setLatitude(409146138);
$point->setLongitude(-746188906); $point->setLongitude(-746188906);
list($feature, $status) = $client->GetFeature($point)->wait(); list($feature, $status) = $client->GetFeature($point)->wait();
``` ```
As you can see, we create and populate a request object, i.e. an `examples\Point` object. Then, we call the method on the stub, passing it the request object. If there is no error, then we can read the response information from the server from our response object, i.e. an `examples\Feature` object. As you can see, we create and populate a request object, i.e. an `routeguide\Point` object. Then, we call the method on the stub, passing it the request object. If there is no error, then we can read the response information from the server from our response object, i.e. an `routeguide\Feature` object.
```php ```php
print sprintf("Found %s \n at %f, %f\n", $feature->getName(), print sprintf("Found %s \n at %f, %f\n", $feature->getName(),
@ -197,15 +197,15 @@ As you can see, we create and populate a request object, i.e. an `examples\Point
Now let's look at our streaming methods. Here's where we call the server-side streaming method `ListFeatures`, which returns a stream of geographical `Feature`s: Now let's look at our streaming methods. Here's where we call the server-side streaming method `ListFeatures`, which returns a stream of geographical `Feature`s:
```php ```php
$lo_point = new examples\Point(); $lo_point = new routeguide\Point();
$hi_point = new examples\Point(); $hi_point = new routeguide\Point();
$lo_point->setLatitude(400000000); $lo_point->setLatitude(400000000);
$lo_point->setLongitude(-750000000); $lo_point->setLongitude(-750000000);
$hi_point->setLatitude(420000000); $hi_point->setLatitude(420000000);
$hi_point->setLongitude(-730000000); $hi_point->setLongitude(-730000000);
$rectangle = new examples\Rectangle(); $rectangle = new routeguide\Rectangle();
$rectangle->setLo($lo_point); $rectangle->setLo($lo_point);
$rectangle->setHi($hi_point); $rectangle->setHi($hi_point);
@ -219,12 +219,12 @@ Now let's look at our streaming methods. Here's where we call the server-side st
The `$call->responses()` method call returns an iterator. When the server sends a response, a `$feature` object will be returned in the `foreach` loop, until the server indiciates that there will be no more responses to be sent. The `$call->responses()` method call returns an iterator. When the server sends a response, a `$feature` object will be returned in the `foreach` loop, until the server indiciates that there will be no more responses to be sent.
The client-side streaming method `RecordRoute` is similar, except there we pass the method an iterator and get back a `examples\RouteSummary`. The client-side streaming method `RecordRoute` is similar, except there we pass the method an iterator and get back a `routeguide\RouteSummary`.
```php ```php
$points_iter = function($db) { $points_iter = function($db) {
for ($i = 0; $i < $num_points; $i++) { for ($i = 0; $i < $num_points; $i++) {
$point = new examples\Point(); $point = new routeguide\Point();
$point->setLatitude($lat); $point->setLatitude($lat);
$point->setLongitude($long); $point->setLongitude($long);
yield $point; yield $point;
@ -245,7 +245,7 @@ To write messages from the client:
```php ```php
foreach ($notes as $n) { foreach ($notes as $n) {
$route_note = new examples\RouteNote(); $route_note = new routerguide\RouteNote();
$call->write($route_note); $call->write($route_note);
} }
$call->writesDone(); $call->writesDone();

@ -1,9 +1,9 @@
<?php <?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0 // DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: route_guide.proto // Source: route_guide.proto
// Date: 2015-06-12 00:32:41 // Date: 2015-08-31 21:11:45
namespace examples { namespace routeguide {
class Point extends \DrSlump\Protobuf\Message { class Point extends \DrSlump\Protobuf\Message {
@ -19,7 +19,7 @@ namespace examples {
public static function descriptor() public static function descriptor()
{ {
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Point'); $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Point');
// OPTIONAL INT32 latitude = 1 // OPTIONAL INT32 latitude = 1
$f = new \DrSlump\Protobuf\Field(); $f = new \DrSlump\Protobuf\Field();
@ -58,7 +58,7 @@ namespace examples {
/** /**
* Clear <latitude> value * Clear <latitude> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function clearLatitude(){ public function clearLatitude(){
return $this->_clear(1); return $this->_clear(1);
@ -77,7 +77,7 @@ namespace examples {
* Set <latitude> value * Set <latitude> value
* *
* @param int $value * @param int $value
* @return \examples\Point * @return \routeguide\Point
*/ */
public function setLatitude( $value){ public function setLatitude( $value){
return $this->_set(1, $value); return $this->_set(1, $value);
@ -95,7 +95,7 @@ namespace examples {
/** /**
* Clear <longitude> value * Clear <longitude> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function clearLongitude(){ public function clearLongitude(){
return $this->_clear(2); return $this->_clear(2);
@ -114,7 +114,7 @@ namespace examples {
* Set <longitude> value * Set <longitude> value
* *
* @param int $value * @param int $value
* @return \examples\Point * @return \routeguide\Point
*/ */
public function setLongitude( $value){ public function setLongitude( $value){
return $this->_set(2, $value); return $this->_set(2, $value);
@ -122,14 +122,14 @@ namespace examples {
} }
} }
namespace examples { namespace routeguide {
class Rectangle extends \DrSlump\Protobuf\Message { class Rectangle extends \DrSlump\Protobuf\Message {
/** @var \examples\Point */ /** @var \routeguide\Point */
public $lo = null; public $lo = null;
/** @var \examples\Point */ /** @var \routeguide\Point */
public $hi = null; public $hi = null;
@ -138,7 +138,7 @@ namespace examples {
public static function descriptor() public static function descriptor()
{ {
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Rectangle'); $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Rectangle');
// OPTIONAL MESSAGE lo = 1 // OPTIONAL MESSAGE lo = 1
$f = new \DrSlump\Protobuf\Field(); $f = new \DrSlump\Protobuf\Field();
@ -146,7 +146,7 @@ namespace examples {
$f->name = "lo"; $f->name = "lo";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE; $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\examples\Point'; $f->reference = '\routeguide\Point';
$descriptor->addField($f); $descriptor->addField($f);
// OPTIONAL MESSAGE hi = 2 // OPTIONAL MESSAGE hi = 2
@ -155,7 +155,7 @@ namespace examples {
$f->name = "hi"; $f->name = "hi";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE; $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\examples\Point'; $f->reference = '\routeguide\Point';
$descriptor->addField($f); $descriptor->addField($f);
foreach (self::$__extensions as $cb) { foreach (self::$__extensions as $cb) {
@ -177,7 +177,7 @@ namespace examples {
/** /**
* Clear <lo> value * Clear <lo> value
* *
* @return \examples\Rectangle * @return \routeguide\Rectangle
*/ */
public function clearLo(){ public function clearLo(){
return $this->_clear(1); return $this->_clear(1);
@ -186,7 +186,7 @@ namespace examples {
/** /**
* Get <lo> value * Get <lo> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function getLo(){ public function getLo(){
return $this->_get(1); return $this->_get(1);
@ -195,10 +195,10 @@ namespace examples {
/** /**
* Set <lo> value * Set <lo> value
* *
* @param \examples\Point $value * @param \routeguide\Point $value
* @return \examples\Rectangle * @return \routeguide\Rectangle
*/ */
public function setLo(\examples\Point $value){ public function setLo(\routeguide\Point $value){
return $this->_set(1, $value); return $this->_set(1, $value);
} }
@ -214,7 +214,7 @@ namespace examples {
/** /**
* Clear <hi> value * Clear <hi> value
* *
* @return \examples\Rectangle * @return \routeguide\Rectangle
*/ */
public function clearHi(){ public function clearHi(){
return $this->_clear(2); return $this->_clear(2);
@ -223,7 +223,7 @@ namespace examples {
/** /**
* Get <hi> value * Get <hi> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function getHi(){ public function getHi(){
return $this->_get(2); return $this->_get(2);
@ -232,23 +232,23 @@ namespace examples {
/** /**
* Set <hi> value * Set <hi> value
* *
* @param \examples\Point $value * @param \routeguide\Point $value
* @return \examples\Rectangle * @return \routeguide\Rectangle
*/ */
public function setHi(\examples\Point $value){ public function setHi(\routeguide\Point $value){
return $this->_set(2, $value); return $this->_set(2, $value);
} }
} }
} }
namespace examples { namespace routeguide {
class Feature extends \DrSlump\Protobuf\Message { class Feature extends \DrSlump\Protobuf\Message {
/** @var string */ /** @var string */
public $name = null; public $name = null;
/** @var \examples\Point */ /** @var \routeguide\Point */
public $location = null; public $location = null;
@ -257,7 +257,7 @@ namespace examples {
public static function descriptor() public static function descriptor()
{ {
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.Feature'); $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.Feature');
// OPTIONAL STRING name = 1 // OPTIONAL STRING name = 1
$f = new \DrSlump\Protobuf\Field(); $f = new \DrSlump\Protobuf\Field();
@ -273,7 +273,7 @@ namespace examples {
$f->name = "location"; $f->name = "location";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE; $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\examples\Point'; $f->reference = '\routeguide\Point';
$descriptor->addField($f); $descriptor->addField($f);
foreach (self::$__extensions as $cb) { foreach (self::$__extensions as $cb) {
@ -295,7 +295,7 @@ namespace examples {
/** /**
* Clear <name> value * Clear <name> value
* *
* @return \examples\Feature * @return \routeguide\Feature
*/ */
public function clearName(){ public function clearName(){
return $this->_clear(1); return $this->_clear(1);
@ -314,7 +314,7 @@ namespace examples {
* Set <name> value * Set <name> value
* *
* @param string $value * @param string $value
* @return \examples\Feature * @return \routeguide\Feature
*/ */
public function setName( $value){ public function setName( $value){
return $this->_set(1, $value); return $this->_set(1, $value);
@ -332,7 +332,7 @@ namespace examples {
/** /**
* Clear <location> value * Clear <location> value
* *
* @return \examples\Feature * @return \routeguide\Feature
*/ */
public function clearLocation(){ public function clearLocation(){
return $this->_clear(2); return $this->_clear(2);
@ -341,7 +341,7 @@ namespace examples {
/** /**
* Get <location> value * Get <location> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function getLocation(){ public function getLocation(){
return $this->_get(2); return $this->_get(2);
@ -350,20 +350,20 @@ namespace examples {
/** /**
* Set <location> value * Set <location> value
* *
* @param \examples\Point $value * @param \routeguide\Point $value
* @return \examples\Feature * @return \routeguide\Feature
*/ */
public function setLocation(\examples\Point $value){ public function setLocation(\routeguide\Point $value){
return $this->_set(2, $value); return $this->_set(2, $value);
} }
} }
} }
namespace examples { namespace routeguide {
class RouteNote extends \DrSlump\Protobuf\Message { class RouteNote extends \DrSlump\Protobuf\Message {
/** @var \examples\Point */ /** @var \routeguide\Point */
public $location = null; public $location = null;
/** @var string */ /** @var string */
@ -375,7 +375,7 @@ namespace examples {
public static function descriptor() public static function descriptor()
{ {
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.RouteNote'); $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteNote');
// OPTIONAL MESSAGE location = 1 // OPTIONAL MESSAGE location = 1
$f = new \DrSlump\Protobuf\Field(); $f = new \DrSlump\Protobuf\Field();
@ -383,7 +383,7 @@ namespace examples {
$f->name = "location"; $f->name = "location";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE; $f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL; $f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\examples\Point'; $f->reference = '\routeguide\Point';
$descriptor->addField($f); $descriptor->addField($f);
// OPTIONAL STRING message = 2 // OPTIONAL STRING message = 2
@ -413,7 +413,7 @@ namespace examples {
/** /**
* Clear <location> value * Clear <location> value
* *
* @return \examples\RouteNote * @return \routeguide\RouteNote
*/ */
public function clearLocation(){ public function clearLocation(){
return $this->_clear(1); return $this->_clear(1);
@ -422,7 +422,7 @@ namespace examples {
/** /**
* Get <location> value * Get <location> value
* *
* @return \examples\Point * @return \routeguide\Point
*/ */
public function getLocation(){ public function getLocation(){
return $this->_get(1); return $this->_get(1);
@ -431,10 +431,10 @@ namespace examples {
/** /**
* Set <location> value * Set <location> value
* *
* @param \examples\Point $value * @param \routeguide\Point $value
* @return \examples\RouteNote * @return \routeguide\RouteNote
*/ */
public function setLocation(\examples\Point $value){ public function setLocation(\routeguide\Point $value){
return $this->_set(1, $value); return $this->_set(1, $value);
} }
@ -450,7 +450,7 @@ namespace examples {
/** /**
* Clear <message> value * Clear <message> value
* *
* @return \examples\RouteNote * @return \routeguide\RouteNote
*/ */
public function clearMessage(){ public function clearMessage(){
return $this->_clear(2); return $this->_clear(2);
@ -469,7 +469,7 @@ namespace examples {
* Set <message> value * Set <message> value
* *
* @param string $value * @param string $value
* @return \examples\RouteNote * @return \routeguide\RouteNote
*/ */
public function setMessage( $value){ public function setMessage( $value){
return $this->_set(2, $value); return $this->_set(2, $value);
@ -477,7 +477,7 @@ namespace examples {
} }
} }
namespace examples { namespace routeguide {
class RouteSummary extends \DrSlump\Protobuf\Message { class RouteSummary extends \DrSlump\Protobuf\Message {
@ -499,7 +499,7 @@ namespace examples {
public static function descriptor() public static function descriptor()
{ {
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'examples.RouteSummary'); $descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'routeguide.RouteSummary');
// OPTIONAL INT32 point_count = 1 // OPTIONAL INT32 point_count = 1
$f = new \DrSlump\Protobuf\Field(); $f = new \DrSlump\Protobuf\Field();
@ -556,7 +556,7 @@ namespace examples {
/** /**
* Clear <point_count> value * Clear <point_count> value
* *
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function clearPointCount(){ public function clearPointCount(){
return $this->_clear(1); return $this->_clear(1);
@ -575,7 +575,7 @@ namespace examples {
* Set <point_count> value * Set <point_count> value
* *
* @param int $value * @param int $value
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function setPointCount( $value){ public function setPointCount( $value){
return $this->_set(1, $value); return $this->_set(1, $value);
@ -593,7 +593,7 @@ namespace examples {
/** /**
* Clear <feature_count> value * Clear <feature_count> value
* *
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function clearFeatureCount(){ public function clearFeatureCount(){
return $this->_clear(2); return $this->_clear(2);
@ -612,7 +612,7 @@ namespace examples {
* Set <feature_count> value * Set <feature_count> value
* *
* @param int $value * @param int $value
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function setFeatureCount( $value){ public function setFeatureCount( $value){
return $this->_set(2, $value); return $this->_set(2, $value);
@ -630,7 +630,7 @@ namespace examples {
/** /**
* Clear <distance> value * Clear <distance> value
* *
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function clearDistance(){ public function clearDistance(){
return $this->_clear(3); return $this->_clear(3);
@ -649,7 +649,7 @@ namespace examples {
* Set <distance> value * Set <distance> value
* *
* @param int $value * @param int $value
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function setDistance( $value){ public function setDistance( $value){
return $this->_set(3, $value); return $this->_set(3, $value);
@ -667,7 +667,7 @@ namespace examples {
/** /**
* Clear <elapsed_time> value * Clear <elapsed_time> value
* *
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function clearElapsedTime(){ public function clearElapsedTime(){
return $this->_clear(4); return $this->_clear(4);
@ -686,7 +686,7 @@ namespace examples {
* Set <elapsed_time> value * Set <elapsed_time> value
* *
* @param int $value * @param int $value
* @return \examples\RouteSummary * @return \routeguide\RouteSummary
*/ */
public function setElapsedTime( $value){ public function setElapsedTime( $value){
return $this->_set(4, $value); return $this->_set(4, $value);
@ -694,38 +694,36 @@ namespace examples {
} }
} }
namespace examples { namespace routeguide {
class RouteGuideClient{ class RouteGuideClient extends \Grpc\BaseStub {
private $rpc_impl; public function __construct($hostname, $opts) {
parent::__construct($hostname, $opts);
public function __construct($rpc_impl) {
$this->rpc_impl = $rpc_impl;
} }
/** /**
* @param examples\Point $input * @param routeguide\Point $input
*/ */
public function GetFeature(\examples\Point $argument, $metadata = array()) { public function GetFeature(\routeguide\Point $argument, $metadata = array(), $options = array()) {
return $this->rpc_impl->_simpleRequest('/examples.RouteGuide/GetFeature', $argument, '\examples\Feature::deserialize', $metadata); return $this->_simpleRequest('/routeguide.RouteGuide/GetFeature', $argument, '\routeguide\Feature::deserialize', $metadata, $options);
} }
/** /**
* @param examples\Rectangle $input * @param routeguide\Rectangle $input
*/ */
public function ListFeatures($argument, $metadata = array()) { public function ListFeatures($argument, $metadata = array(), $options = array()) {
return $this->rpc_impl->_serverStreamRequest('/examples.RouteGuide/ListFeatures', $argument, '\examples\Feature::deserialize', $metadata); return $this->_serverStreamRequest('/routeguide.RouteGuide/ListFeatures', $argument, '\routeguide\Feature::deserialize', $metadata, $options);
} }
/** /**
* @param examples\Point $input * @param routeguide\Point $input
*/ */
public function RecordRoute($arguments, $metadata = array()) { public function RecordRoute($metadata = array()) {
return $this->rpc_impl->_clientStreamRequest('/examples.RouteGuide/RecordRoute', $arguments, '\examples\RouteSummary::deserialize', $metadata); return $this->_clientStreamRequest('/routeguide.RouteGuide/RecordRoute', '\routeguide\RouteSummary::deserialize', $metadata);
} }
/** /**
* @param examples\RouteNote $input * @param routeguide\RouteNote $input
*/ */
public function RouteChat($metadata = array()) { public function RouteChat($metadata = array()) {
return $this->rpc_impl->_bidiRequest('/examples.RouteGuide/RouteChat', '\examples\RouteNote::deserialize', $metadata); return $this->_bidiRequest('/routeguide.RouteGuide/RouteChat', '\routeguide\RouteNote::deserialize', $metadata);
} }
} }
} }

@ -31,7 +31,7 @@ syntax = "proto2";
option java_package = "io.grpc.examples"; option java_package = "io.grpc.examples";
package examples; package routeguide;
// Interface exported by the server. // Interface exported by the server.
service RouteGuide { service RouteGuide {

@ -37,7 +37,7 @@ require dirname(__FILE__) . '/route_guide.php';
define('COORD_FACTOR', 1e7); define('COORD_FACTOR', 1e7);
$client = new examples\RouteGuideClient( $client = new routeguide\RouteGuideClient(
new Grpc\BaseStub('localhost:50051', [])); new Grpc\BaseStub('localhost:50051', []));
function printFeature($feature) { function printFeature($feature) {
@ -60,7 +60,7 @@ function runGetFeature() {
print "Running GetFeature...\n"; print "Running GetFeature...\n";
global $client; global $client;
$point = new examples\Point(); $point = new routeguide\Point();
$points = array( $points = array(
array(409146138, -746188906), array(409146138, -746188906),
array(0, 0), array(0, 0),
@ -84,15 +84,15 @@ function runListFeatures() {
print "Running ListFeatures...\n"; print "Running ListFeatures...\n";
global $client; global $client;
$lo_point = new examples\Point(); $lo_point = new routeguide\Point();
$hi_point = new examples\Point(); $hi_point = new routeguide\Point();
$lo_point->setLatitude(400000000); $lo_point->setLatitude(400000000);
$lo_point->setLongitude(-750000000); $lo_point->setLongitude(-750000000);
$hi_point->setLatitude(420000000); $hi_point->setLatitude(420000000);
$hi_point->setLongitude(-730000000); $hi_point->setLongitude(-730000000);
$rectangle = new examples\Rectangle(); $rectangle = new routeguide\Rectangle();
$rectangle->setLo($lo_point); $rectangle->setLo($lo_point);
$rectangle->setHi($hi_point); $rectangle->setHi($hi_point);
@ -118,7 +118,7 @@ function runRecordRoute() {
$num_points_in_db = count($db); $num_points_in_db = count($db);
$num_points = 10; $num_points = 10;
for ($i = 0; $i < $num_points; $i++) { for ($i = 0; $i < $num_points; $i++) {
$point = new examples\Point(); $point = new routeguide\Point();
$index = rand(0, $num_points_in_db - 1); $index = rand(0, $num_points_in_db - 1);
$lat = $db[$index]['location']['latitude']; $lat = $db[$index]['location']['latitude'];
$long = $db[$index]['location']['longitude']; $long = $db[$index]['location']['longitude'];
@ -163,11 +163,11 @@ function runRouteChat() {
); );
foreach ($notes as $n) { foreach ($notes as $n) {
$point = new examples\Point(); $point = new routeguide\Point();
$point->setLatitude($lat = $n[0]); $point->setLatitude($lat = $n[0]);
$point->setLongitude($long = $n[1]); $point->setLongitude($long = $n[1]);
$route_note = new examples\RouteNote(); $route_note = new routeguide\RouteNote();
$route_note->setLocation($point); $route_note->setLocation($point);
$route_note->setMessage($message = $n[2]); $route_note->setMessage($message = $n[2]);

Loading…
Cancel
Save