Skip to content

Commit

Permalink
Adds Client::getFolderByPath() (#12)
Browse files Browse the repository at this point in the history
* Adds Client::getFolderByPath()
* Adds Client::getFolderByName() to prevent ambiguity
  • Loading branch information
Max13 authored Oct 2, 2020
1 parent 4d0badc commit 6dffce0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,33 @@ public function disconnect() {
* @throws FolderFetchingException
*/
public function getFolder($folder_name) {
return $this->getFolderByName($folder_name);
}

/**
* Get a folder instance by a folder name
* @param $folder_name
*
* @return mixed
* @throws ConnectionFailedException
* @throws FolderFetchingException
*/
public function getFolderByName($folder_name) {
return $this->getFolders(false)->where("name", $folder_name)->first();
}

/**
* Get a folder instance by a folder path
* @param $folder_path
*
* @return mixed
* @throws ConnectionFailedException
* @throws FolderFetchingException
*/
public function getFolderByPath($folder_path) {
return $this->getFolders(false)->where("path", $folder_path)->first();
}

/**
* Get folders list.
* If hierarchical order is set to true, it will make a tree of folders, otherwise it will return flat array.
Expand Down

0 comments on commit 6dffce0

Please sign in to comment.