diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-08-26 14:12:06 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-05 19:22:22 +0200 |
commit | afd24385a8b8a9ba75e6e0e7f3c56dfe1628991b (patch) | |
tree | ea66491be651b6b04ef50449038e2a3ac96d6e07 /lib/private/search | |
parent | a6583d39769e48253835b28e0c2e717b9575bf5d (diff) | |
download | nextcloud-server-afd24385a8b8a9ba75e6e0e7f3c56dfe1628991b.tar.gz nextcloud-server-afd24385a8b8a9ba75e6e0e7f3c56dfe1628991b.zip |
fix formatting
Diffstat (limited to 'lib/private/search')
-rw-r--r-- | lib/private/search/provider.php | 38 | ||||
-rw-r--r-- | lib/private/search/provider/file.php | 69 | ||||
-rw-r--r-- | lib/private/search/result.php | 70 |
3 files changed, 89 insertions, 88 deletions
diff --git a/lib/private/search/provider.php b/lib/private/search/provider.php index e45d3790c3f..45d9f823c55 100644 --- a/lib/private/search/provider.php +++ b/lib/private/search/provider.php @@ -24,24 +24,24 @@ namespace OC\Search; */ abstract class Provider { - /** - * List of options (currently unused) - * @var array - */ - private $options; + /** + * List of options (currently unused) + * @var array + */ + private $options; - /** - * Constructor - * @param array $options - */ - public function __construct($options) { - $this->options = $options; - } + /** + * Constructor + * @param array $options + */ + public function __construct($options) { + $this->options = $options; + } - /** - * Search for $query - * @param string $query - * @return array An array of OC\Search\Result's - */ - abstract public function search($query); -}
\ No newline at end of file + /** + * Search for $query + * @param string $query + * @return array An array of OC\Search\Result's + */ + abstract public function search($query); +} diff --git a/lib/private/search/provider/file.php b/lib/private/search/provider/file.php index 5e3fb83721e..a9082763002 100644 --- a/lib/private/search/provider/file.php +++ b/lib/private/search/provider/file.php @@ -22,38 +22,39 @@ namespace OC\Search\Provider; /** * Provide search results from the 'files' app */ -class File extends \OC\Search\Provider{ - - /** - * Search for files and folders matching the given query - * @param string $query - * @return \OC\Search\Result - */ - function search($query) { - $files = \OC\Files\Filesystem::search($query); - $results = array(); - // edit results - foreach ($files as $fileData) { - // skip versions - if (strpos($fileData['path'], '_versions') === 0) { - continue; - } - // skip top-level folder - if ($fileData['name'] == 'files' && $fileData['parent'] == -1) { - continue; - } - // create folder result - if($fileData['mimetype'] == 'httpd/unix-directory'){ - $result = new \OC\Search\Result\Folder($fileData); - } - // or create file result - else{ - $result = new \OC\Search\Result\File($fileData); - } - // add to results - $results[] = $result; - } - // return - return $results; - } +class File extends \OC\Search\Provider { + + /** + * Search for files and folders matching the given query + * @param string $query + * @return \OC\Search\Result + */ + function search($query) { + $files = \OC\Files\Filesystem::search($query); + $results = array(); + // edit results + foreach ($files as $fileData) { + // skip versions + if (strpos($fileData['path'], '_versions') === 0) { + continue; + } + // skip top-level folder + if ($fileData['name'] === 'files' && $fileData['parent'] === -1) { + continue; + } + // create folder result + if($fileData['mimetype'] === 'httpd/unix-directory'){ + $result = new \OC\Search\Result\Folder($fileData); + } + // or create file result + else{ + $result = new \OC\Search\Result\File($fileData); + } + // add to results + $results[] = $result; + } + // return + return $results; + } + } diff --git a/lib/private/search/result.php b/lib/private/search/result.php index e671aa1b609..90e7081e753 100644 --- a/lib/private/search/result.php +++ b/lib/private/search/result.php @@ -24,42 +24,42 @@ namespace OC\Search; */ abstract class Result { - /** - * A unique identifier for the result, usually given as the item ID in its - * corresponding application. - * @var string - */ - public $id; + /** + * A unique identifier for the result, usually given as the item ID in its + * corresponding application. + * @var string + */ + public $id; - /** - * The name of the item returned; this will be displayed in the search - * results. - * @var string - */ - public $name; + /** + * The name of the item returned; this will be displayed in the search + * results. + * @var string + */ + public $name; - /** - * URL to the application item. - * @var string - */ - public $link; - - /** - * The type of search result returned; for consistency, name this the same - * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. - * @var string - */ - public $type = 'generic'; + /** + * URL to the application item. + * @var string + */ + public $link; - /** - * Create a new search result - * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]' - * @param string $name displayed text of result - * @param string $link URL to the result within its app - */ - public function __construct($id = null, $name = null, $link = null) { - $this->id = $id; - $this->name = $name; - $this->link = $link; - } + /** + * The type of search result returned; for consistency, name this the same + * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. + * @var string + */ + public $type = 'generic'; + + /** + * Create a new search result + * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]' + * @param string $name displayed text of result + * @param string $link URL to the result within its app + */ + public function __construct($id = null, $name = null, $link = null) { + $this->id = $id; + $this->name = $name; + $this->link = $link; + } } |