Permalink
Browse files

Converting indentation to spaces - trying a new editor, didn't realiz…

…e it spoke tab
  • Loading branch information...
1 parent 90d0fe2 commit 18c59f95a842b2862555933b077d984226a699eb Zachary Parmley committed Aug 2, 2012
Showing with 218 additions and 218 deletions.
  1. +95 −95 Petfound/API/Request.php
  2. +93 −93 Petfound/Pet.php
  3. +30 −30 example.php
@@ -12,101 +12,101 @@
**/
class Request {
- /**
- * Signed API request url
- *
- * @var string
- **/
- protected $_url;
-
- /**
- * JSON decoded results from a pietfinder API call
- *
- * @var mixed
- **/
- protected $_result;
-
- /**
- * Constructor
- *
- * @param string|Petfound\URL $url (Optional) A string or object representing an API request call
- * @return void
- **/
- public function __construct($url = null) {
- if (is_null($url) === false) {
- $this->setUrl($url);
- }
- }
-
- /**
- * Set the internal url to a passed in string or the string version of
- *
- * @return void
- * @author
- **/
- public function setUrl($url) {
- if (($url instanceof URL)
- or ((is_string($url) === true) and (substr($url, 0, 7) === 'http://'))){
- $this->_url = (string) $url;
- } else {
- var_dump($url);
- throw new PetfoundException ('PetfinderAPI Result url must be Petfound\API\URL object or a url begining with "http://"');
- }
- }
-
- /**
- * Load data from the petfinder API based on the URL, and decode them into internal _results property
- *
- * @return void
- * @author
- **/
- public function load($url = null) {
- if (is_null($url) === false) {
- $this->_url = $url;
- }
-
- if (is_null($this->_url) === true) {
- throw new PetfoundException('Cannot load with a null url');
- }
-
- $this->_result = json_decode(file_get_contents($this->_url));
- }
-
- /**
- * Public accessor for _result property
- *
- * @return mixed
- **/
- public function getResult() {
- return $this->_result;
- }
-
- /**
- * Method to parse a pet list result (which some api methods will return) into a more usable data structure
- *
- * @return array
- **/
- public function getPets() {
-
- if (is_null($this->_result) === true) {
- throw new PetfoundException('Cannot parse pets before loading api results; Use $obj->load()');
- }
-
- $result = $this->getResult();
- if ((isset($result->petfinder) === false)
- or (isset($result->petfinder->pets) === false)
- or (isset($result->petfinder->pets->pet) === false)) {
- throw new PetfoundException('Result data does not match expected format - does the api call type you specified return a list of pets?');
- }
-
- $pets = $this->getResult()->petfinder->pets->pet;
- $petObjects = array();
- foreach ($pets as $pet) {
- $petObjects []= new Pet($pet);
- }
-
- return $petObjects;
- }
+ /**
+ * Signed API request url
+ *
+ * @var string
+ **/
+ protected $_url;
+
+ /**
+ * JSON decoded results from a pietfinder API call
+ *
+ * @var mixed
+ **/
+ protected $_result;
+
+ /**
+ * Constructor
+ *
+ * @param string|Petfound\URL $url (Optional) A string or object representing an API request call
+ * @return void
+ **/
+ public function __construct($url = null) {
+ if (is_null($url) === false) {
+ $this->setUrl($url);
+ }
+ }
+
+ /**
+ * Set the internal url to a passed in string or the string version of
+ *
+ * @return void
+ * @author
+ **/
+ public function setUrl($url) {
+ if (($url instanceof URL)
+ or ((is_string($url) === true) and (substr($url, 0, 7) === 'http://'))){
+ $this->_url = (string) $url;
+ } else {
+ var_dump($url);
+ throw new PetfoundException ('PetfinderAPI Result url must be Petfound\API\URL object or a url begining with "http://"');
+ }
+ }
+
+ /**
+ * Load data from the petfinder API based on the URL, and decode them into internal _results property
+ *
+ * @return void
+ * @author
+ **/
+ public function load($url = null) {
+ if (is_null($url) === false) {
+ $this->_url = $url;
+ }
+
+ if (is_null($this->_url) === true) {
+ throw new PetfoundException('Cannot load with a null url');
+ }
+
+ $this->_result = json_decode(file_get_contents($this->_url));
+ }
+
+ /**
+ * Public accessor for _result property
+ *
+ * @return mixed
+ **/
+ public function getResult() {
+ return $this->_result;
+ }
+
+ /**
+ * Method to parse a pet list result (which some api methods will return) into a more usable data structure
+ *
+ * @return array
+ **/
+ public function getPets() {
+
+ if (is_null($this->_result) === true) {
+ throw new PetfoundException('Cannot parse pets before loading api results; Use $obj->load()');
+ }
+
+ $result = $this->getResult();
+ if ((isset($result->petfinder) === false)
+ or (isset($result->petfinder->pets) === false)
+ or (isset($result->petfinder->pets->pet) === false)) {
+ throw new PetfoundException('Result data does not match expected format - does the api call type you specified return a list of pets?');
+ }
+
+ $pets = $this->getResult()->petfinder->pets->pet;
+ $petObjects = array();
+ foreach ($pets as $pet) {
+ $petObjects []= new Pet($pet);
+ }
+
+ return $petObjects;
+ }
}
Oops, something went wrong.

0 comments on commit 18c59f9

Please sign in to comment.