fetchChildObjects(); } /** * Gets the child drive items in the OneDrive folder referenced by this * Folder instance. * * @return array The drive items in the OneDrive folder referenced by this * Folder instance, as DriveItem instances. */ public function fetchChildObjects() { return $this->_client->fetchObjects($this->_id); } /** * Gets the descendant drive items under the OneDrive folder referenced by * this Folder instance. * * @return array The files in the OneDrive folder referenced by this Folder * instance, as DriveItem instances. */ public function fetchDescendantObjects() { $driveItems = []; foreach ($this->fetchChildObjects() as $driveItem) { if ($driveItem->isFolder()) { $driveItems = array_merge( $driveItem->fetchDescendantObjects(), $driveItems ); } else { array_push($driveItems, $driveItem); } } return $driveItems; } /** * Creates a folder in the OneDrive folder referenced by this Folder * instance. * * @param string $name The name of the OneDrive folder to be * created. * @param null|string $description The description of the OneDrive folder * to be created, or null to create it * without a description. Default: null. * * @return Folder The folder created, as a Folder instance. */ public function createFolder($name, $description = null) { return $this->_client->createFolder($name, $this->_id, $description); } /** * Creates a file in the OneDrive folder referenced by this Folder instance. * * @param string $name The name of the OneDrive file to be * created. * @param string|resource $content The content of the OneDrive file to be * created, as a string or handle to an * already opened file. In the latter case, * the responsibility to close the handle is * is left to the calling function. Default: * ''. * @param array $options The options. * * @return File The file created, as a File instance. * * @throws \Exception Thrown on I/O errors. */ public function createFile($name, $content = '', array $options = []) { $client = $this->_client; $options = array_merge([ 'name_conflict_behavior' => $client->getNameConflictBehavior(), 'stream_back_end' => $client->getStreamBackEnd(), ], $options); return $this->_client->createFile( $name, $this->_id, $content, $options ); } }