getData() public method

public getData ( )
示例#1
0
 public function testConstruct()
 {
     // simple new object
     $object = new Object();
     $this->assertEmpty($object->getData());
     // more complex object
     $data = new \StdClass();
     $data->woot = 'sauce';
     $object = new Object($data, ['Content-Type' => 'text/plain']);
     $this->assertEquals('sauce', $object->getData()->woot);
     $this->assertEquals('text/plain', $object->getContentType());
 }
示例#2
0
 public function getData()
 {
     return $this->object->getData();
 }
 /**
  * Search a secondary index
  *
  * @author Eric Stevens <*****@*****.**>
  * @param string $indexName - The name of the index to search
  * @param string $indexType - The type of index ('int' or 'bin')
  * @param string|int $startOrExact
  * @param string|int optional $end
  * @param bool optional $dedupe - whether to eliminate duplicate entries if any
  * @return array of Links
  */
 public function indexSearch($indexName, $indexType, $startOrExact, $end = null, $dedupe = false)
 {
     $url = Utils::buildIndexPath($this->client, $this, strtolower("{$indexName}_{$indexType}"), $startOrExact, $end, null);
     //print_r($url);
     $response = Utils::httpRequest('GET', $url);
     $obj = new Object($this->client, $this, null);
     //var_dump($response);
     //print_r($response);
     $obj->populate($response, array(200));
     if (!$obj->exists()) {
         throw new Exception("Error searching index.");
     }
     $data = $obj->getData();
     $keys = array_map("urldecode", $data["keys"]);
     $seenKeys = array();
     foreach ($keys as $id => &$key) {
         if ($dedupe) {
             if (isset($seenKeys[$key])) {
                 unset($keys[$id]);
                 continue;
             }
             $seenKeys[$key] = true;
         }
         $key = new Link($this->name, $key);
         $key->client = $this->client;
     }
     return $keys;
 }