<?php

/*
 * Copyright 2012 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @group conduit
 */
abstract class ConduitAPI_repository_Method extends ConduitAPIMethod {

  protected function buildDictForRepository(PhabricatorRepository $repository) {
    return array(
      'name'        => $repository->getName(),
      'callsign'    => $repository->getCallsign(),
      'vcs'         => $repository->getVersionControlSystem(),
      'uri'         => PhabricatorEnv::getProductionURI($repository->getURI()),
      'remoteURI'   => (string)$repository->getPublicRemoteURI(),
      'tracking'    => $repository->getDetail('tracking-enabled'),
    );
  }

}

<?php

/*
 * Copyright 2012 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @group conduit
 */
abstract class ConduitAPI_repository_Method extends ConduitAPIMethod {

  protected function buildDictForRepository(PhabricatorRepository $repository) {
    return array(
      'name'        => $repository->getName(),
      'callsign'    => $repository->getCallsign(),
      'vcs'         => $repository->getVersionControlSystem(),
      'uri'         => PhabricatorEnv::getProductionURI($repository->getURI()),
      'remoteURI'   => $repository->getPublicRemoteURI(),
      'tracking'    => $repository->getDetail('tracking-enabled'),
    );
  }

}

--- 
+++ 
@@ -27,7 +27,7 @@
       'callsign'    => $repository->getCallsign(),
       'vcs'         => $repository->getVersionControlSystem(),
       'uri'         => PhabricatorEnv::getProductionURI($repository->getURI()),
-      'remoteURI'   => $repository->getPublicRemoteURI(),
+      'remoteURI'   => (string)$repository->getPublicRemoteURI(),
       'tracking'    => $repository->getDetail('tracking-enabled'),
     );
   }
Add a missing (string) cast to repository.query

Summary: The method returns a PhutilURI object, which json_encode() encodes as "{}" since all the properties are private.

Test Plan:
Examined the output of "repository.query" more carefully:

  "0" : {
    "name"      : "Phabricator",
    "callsign"  : "P",
    "vcs"       : "git",
    "uri"       : "http:\/\/local.aphront.com:8080\/diffusion\/P\/",
    "remoteURI" : "git:\/\/github.com\/facebook\/phabricator.git",
    "tracking"  : true
  },

Reviewers: csilvers, btrahan, vrana, jungejason

Reviewed By: csilvers

CC: aran

Differential Revision: https://secure.phabricator.com/D2402
