Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

correcting method name in Node.php

  • Loading branch information...
commit 0deecf56cddd0f1678a1dd24bf6e89ee180ca17e 1 parent a3258cd
Jonathan Moss authored
Showing with 13 additions and 18 deletions.
  1. +12 −17 src/classes/freebase/Freebase.php
  2. +1 −1  src/classes/freebase/Node.php
View
29 src/classes/freebase/Freebase.php
@@ -12,42 +12,37 @@
*/
class Freebase
{
- /**
- * @var string
- */
- private $baseFetchUrl;
+
+ const PATH_TOPIC = 'experimental/topic/standard/';
+
+ const PATH_MQLREAD = 'service/mqlread';
/**
* @var string
*/
- private $baseApiUrl;
+ private $baseUrl;
/**
* @param string $baseUrl
*/
- public function __construct($baseFetchUrl = "http://www.freebase.com/experimental/topic/standard/", $baseApiUrl = "http://api.freebase.com/api/service/")
+ public function __construct($baseUrl = "http://api.freebase.com/api/")
{
- if (\substr($baseFetchUrl, -1) !== '/') {
- $baseFetchUrl .= '/';
- }
- $this->baseFetchUrl = $baseFetchUrl;
-
- if (\substr($baseApiUrl, -1) !== '/') {
- $baseApiUrl .= '/';
+ if (\substr($baseUrl, -1) !== '/') {
+ $baseUrl .= '/';
}
- $this->baseApiUrl = $baseApiUrl;
+ $this->baseUrl = $baseUrl;
}
/**
* @param string $id
* @return \freebase\Node
*/
- public function fetchById($id)
+ public function fetchByTopicId($id)
{
if (\substr($id, 0, 1) === '/') {
$id = \substr($id, 1); //strip first / if needed as already insured in constructor
}
- $url = $this->baseFetchUrl . $id;
+ $url = $this->baseUrl . self::PATH_TOPIC . $id;
$json = $this->doRequest($url);
return DomFactory::createDomFromJson($json);
}
@@ -58,7 +53,7 @@ public function fetchById($id)
*/
public function fetchByQuery(Query $query)
{
- $url = $this->baseApiUrl . 'mqlread';
+ $url = $this->baseUrl . self::PATH_MQLREAD;
$json = $this->doRequest($url, $query->__toJson());
return DomFactory::createDomFromJson($json);
}
View
2  src/classes/freebase/Node.php
@@ -176,7 +176,7 @@ public function getChildByPath($path)
if (null === $node) {
break;
}
- $node = $node->getNodeByName($name);
+ $node = $node->getChildByName($name);
}
if (null === $node) {
throw new exception\InvalidPath($path);
Please sign in to comment.
Something went wrong with that request. Please try again.