/** * SharePoint Folder constructor * * @access public * @param SPSite $site SharePoint Site * @param array $json JSON response from the SharePoint REST API * @param array $settings Instantiation settings * @return SPFolder */ public function __construct(SPSite $site, array $json, array $settings = []) { $settings = array_replace_recursive(['fetch' => false], $settings, ['extra' => [], 'items' => []]); parent::__construct(['type' => 'odata.type', 'guid' => 'UniqueId', 'name' => 'Name', 'title' => 'Name', 'created' => 'TimeCreated', 'modified' => 'TimeLastModified', 'relativeUrl' => 'ServerRelativeUrl', 'itemCount' => 'ItemCount', 'listGUID' => 'ListItemAllFields->ParentList->Id', 'listTitle' => 'Properties->vti_x005f_listtitle'], $settings['extra']); $this->site = $site; $this->hydrate($json); if ($settings['fetch'] && $this->itemCount > 0) { $this->getSPItems($settings['items']); } }
/** * SharePoint List constructor * * @access public * @param SPSite $site SharePoint Site * @param array $json JSON response from the SharePoint REST API * @param array $settings Instantiation settings * @return SPList */ public function __construct(SPSite $site, array $json, array $settings = []) { $settings = array_replace_recursive(['fetch' => false], $settings, ['extra' => [], 'items' => []]); parent::__construct(['template' => 'BaseTemplate', 'type' => 'odata.type', 'itemType' => 'ListItemEntityTypeFullName', 'guid' => 'Id', 'title' => 'Title', 'relativeUrl' => 'RootFolder->ServerRelativeUrl', 'description' => 'Description', 'itemCount' => 'ItemCount', 'created' => 'RootFolder->TimeCreated', 'modified' => 'RootFolder->TimeLastModified'], $settings['extra']); $this->site = $site; $this->hydrate($json); if ($settings['fetch'] && $this->itemCount > 0) { $this->getSPItems($settings['items']); } }