src/Client.php
public function listFolder(string $path, bool $recursive = false) : array
	{
		$path = $this->normalizePath($path);
			
		$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath.$path.'\')/Folders';
		
		$options = [
			'headers' => $this->requestHeaders,
		];
			
		$response = $this->send('GET', $requestUrl, $options);
			
		$folders = json_decode($response->getBody())->d ?? ['results' => []];
			
		// Making sure we convert the object to an array
		if (!is_array($folders)) {
			$folders = json_decode(json_encode($folders), true);
		}
			
		return $folders['results'];
	}
public function listFolder(string $path, bool $recursive = false) : array
	{
		$path = $this->normalizePath($path);
			
		$requestUrl = $this->siteUrl.'/sites/'.$this->siteName.'/_api/Web/GetFolderByServerRelativeUrl(\''.$this->folderPath.$path.'\')/Folders';
		
		$options = [
			'headers' => $this->requestHeaders,
		];
			
		$response = $this->send('GET', $requestUrl, $options);
			
		$folders = json_decode($response->getBody())->d ?? ['results' => []];
			
		// Making sure we convert the object to an array
		if (!is_array($folders)) {
			$folders = json_decode(json_encode($folders), true);
		}
			
		return $folders['results'];
	}
public function listFolder ( string $ path , bool $ recursive = false ) : array { $ path = $ this -> normalizePath ( $ path ) ; $ requestUrl = $ this -> siteUrl . '/sites/' . $ this -> siteName . '/_api/Web/GetFolderByServerRelativeUrl(\'' . $ this -> folderPath . $ path . '\')/Folders' ; $ options = [ 'headers' => $ this -> requestHeaders , ] ; $ response = $ this -> send ( 'GET' , $ requestUrl , $ options ) ; $ folders = json_decode ( $ response -> getBody ( ) ) -> d ?? [ 'results' => [ ] ] ; // Making sure we convert the object to an array if ( ! is_array ( $ folders ) ) { $ folders = json_decode ( json_encode ( $ folders ) , true ) ; } return $ folders [ 'results' ] ; }
Returns the contents of a folder.
Returns the contents of a folder .