Permalink
Browse files

Cleanup

  • Loading branch information...
1 parent 2c75d68 commit 5d027d8011fc940afea643732affa9a8533c480d @bwoodhead bwoodhead committed Nov 2, 2011
View
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * Description of PropertyObject
- *
- * From example code at http://www.php.net/manual/en/language.oop5.properties.php#98267
- */
-abstract class PropertyObject {
- private $_construct = FALSE;
- protected $_populated = TRUE;
- protected function _refresh() {
-
- }
-
- public function __get($name) {
- $var_name = "_$name";
- if ((!property_exists($this, $var_name) || $this->$var_name == NULL) && !$this->_populated) {
- $this->_refresh();
- }
- if (method_exists($this, ($method = 'get_'.$name))) {
- return $this->$method();
- }
- else return;
- }
-
- public function __isset($name) {
- if (method_exists($this, ($method = 'isset_'.$name))){
- return $this->$method();
- }
- else return;
- }
-
- public function __set($name, $value) {
- if (method_exists($this, ($method = 'set_'.$name))) {
- $this->$method($value);
- }
- else {
- $this->$name = $value;
- }
- }
-
- public function __unset($name) {
- if (method_exists($this, ($method = 'unset_'.$name))){
- $this->$method();
- }
- }
-}
@@ -34,19 +34,24 @@ class FedoraAPITestCase extends DrupalWebTestCase {
}
public function testAPIA() {
+
global $base_url;
- $api = new FedoraAPIA();
- $client = new FedoraClient();
-
- $profile = $api->getObjectProfile('islandora:demos');
+
+ //FedoraRepository
+ $api = new FedoraAPIA();
+ $client = new FedoraClient();
+
+ $profile = $api->getObjectProfile('islandora:demos');
if (empty($profile->error)) {
$this->pass('Fedora API-A getObjectProfile passed.');
}
+
$dslist = $api->listDatastreams('islandora:demos');
if (empty($dslist->error)) {
$this->pass('Fedora API-A listDatastreams passed.');
}
+
$methodlist = $api->listMethods('islandora:demos');
if (empty($methodlist->error)) {
$this->pass('Fedora API-A listMethods passed.');
@@ -56,6 +61,7 @@ class FedoraAPITestCase extends DrupalWebTestCase {
if (empty($find_results->error)) {
$this->pass('Fedora API-A findObjects passed.');
}
+
$dc_stream = $api->getDatastreamDissemination("fedora-system:FedoraObject-3.0", "DC", '', 'false');
if (empty($dc_stream->error)) {
if (strpos($dc_stream->data, '<oai_dc:dc') >= 0) {
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
@@ -44,6 +44,8 @@ class FedoraObject extends PropertyObject {
$this->client = $client;
}
else {
+ module_load_include('repository.inc', 'islandora_fedora_api');
+
// Make a default client using Drupal's variables.
$this->client = new FedoraRepository();
}
File renamed without changes.
@@ -1,7 +1,5 @@
<?php
-// $Id$
-
/**
* @file
*
View
@@ -0,0 +1,85 @@
+<?php
+
+/**
+ * @file
+ * Property base class
+ */
+
+/**
+ * Properties base class
+ *
+ * PropertyObject is a workaround to allow you to create real properties in php.
+ * PHP properties act like attributes by allowing you to set the variable instead
+ * of calling a function.
+ *
+ * From details go to: http://www.php.net/manual/en/language.oop5.properties.php#98267
+ */
+abstract class PropertyObject {
+
+ private $_construct = FALSE;
+ protected $_populated = TRUE;
+
+ /**
+ * ?
+ */
+ protected function _refresh() {
+
+ }
+
+ /**
+ * Magic get function that catches a function call
+ * @param type $name The method name ( ie: $obj->a then a is the name )
+ * @return type
+ */
+ public function __get($name) {
+ $var_name = "_$name";
+ if ((!property_exists($this, $var_name) || $this->$var_name == NULL) && !$this->_populated) {
+ $this->_refresh();
+ }
+ if (method_exists($this, ($method = 'get_' . $name))) {
+ return $this->$method();
+ }
+ else {
+ return;
+ }
+ }
+
+ /**
+ * Isset
+ * @param type $name
+ * @return type
+ */
+ public function __isset($name) {
+ if (method_exists($this, ($method = 'isset_' . $name))) {
+ return $this->$method();
+ }
+ else {
+ return;
+ }
+ }
+
+ /**
+ * Magic set function that will catch assignments and call a function using the assignment
+ * @param type $name The name of the variable to assign a value to
+ * @param type $value The value
+ */
+ public function __set($name, $value) {
+ if (method_exists($this, ($method = 'set_' . $name))) {
+ $this->$method($value);
+ }
+ else {
+ $this->$name = $value;
+ }
+ }
+
+ /**
+ * Unset
+ * @param type $name
+ */
+ public function __unset($name) {
+ if (method_exists($this, ($method = 'unset_' . $name))) {
+ $this->$method();
+ }
+ }
+
+}
@@ -1,5 +1,10 @@
<?php
+/**
+ * @file
+ * Fedora API Exceptions
+ */
+
/**
* General exception thrown on unexpected REST response.
*/
@@ -33,34 +38,6 @@ class FedoraAPIRestException extends Exception {
$this->pid = $pid;
parent::__construct($http->error, $http->code);
}
-
}
-/**
- * Exception thrown when an Object isn't found in the repository.
- */
-class FedoraAPIObjectNotFoundException extends Exception {
-
- /**
- * The PID of the Object not found.
- *
- * @var string
- */
- public $pid;
-
- /**
- * Construct an Object Not Found exception.
- *
- * @param string $pid
- * The pid of the item not found.
- * @param string $message
- * (Optional) The message to be reported. Defaults to: "Not Found".
- * @param int $code
- * (Optional) Defaults to 404.
- */
- function __construct($pid, $message = 'Not Found.', $code = 404) {
- $this->pid = $pid;
- parent::__construct($message);
- }
-
-}
+?>
@@ -0,0 +1,36 @@
+<?php
+/**
+ * @file
+ * Fedora API Exceptions
+ */
+
+/**
+ * Exception thrown when an Object isn't found in the repository.
+ */
+class FedoraAPIObjectNotFoundException extends Exception {
+
+ /**
+ * The PID of the Object not found.
+ *
+ * @var string
+ */
+ public $pid;
+
+ /**
+ * Construct an Object Not Found exception.
+ *
+ * @param string $pid
+ * The pid of the item not found.
+ * @param string $message
+ * (Optional) The message to be reported. Defaults to: "Not Found".
+ * @param int $code
+ * (Optional) Defaults to 404.
+ */
+ function __construct($pid, $message = 'Not Found.', $code = 404) {
+ $this->pid = $pid;
+ parent::__construct($message);
+ }
+
+}
+
+?>
Oops, something went wrong.

0 comments on commit 5d027d8

Please sign in to comment.