You are here

class NodeResourceFeedModel in Services 6.3

Same name and namespace in other branches
  1. 6.2 services/node_service/node_resource.models.inc \NodeResourceFeedModel
  2. 7 services/node_service/node_resource.models.inc \NodeResourceFeedModel

@file This file will parse a node resource feed And will also provide the necessary manip functions

Hierarchy

Expanded class hierarchy of NodeResourceFeedModel

1 string reference to 'NodeResourceFeedModel'
rest_server_services_resources_alter in servers/rest_server/rest_server.module
Implements hook_services_resources_alter().

File

servers/rest_server/includes/node_resource.models.inc, line 9
This file will parse a node resource feed And will also provide the necessary manip functions

View source
class NodeResourceFeedModel implements ResourceTimeFeedModel {
  protected $nodes = NULL;
  protected $mode = 'raw';
  protected $item_length = 'fulltext';
  public function __construct($data, $arguments) {
    $this->nodes = $data;
    if (isset($arguments['mode'])) {
      $this->mode = $arguments['mode'];
    }
    if (isset($arguments['item_length'])) {
      $this->item_length = $arguments['item_length'];
    }
  }
  public function current() {
    $node = current($this->nodes);
    if ($node !== FALSE) {
      return new NodeResourceFeedModelItem($node, $this->mode, $this->item_length);
    }
    return FALSE;
  }
  public function key() {
    return key($this->nodes);
  }
  public function next() {
    next($this->nodes);
  }
  public function rewind() {
    reset($this->nodes);
  }
  public function valid() {

    // It's safe to use current as there never should be a boolean
    // in the node array.
    return current($this->nodes) !== FALSE;
  }

}

Members