diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-22 21:10:16 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-07-22 21:10:16 +0200 |
commit | 361d2badd8f5be949acd94f52fc9ba2d0a98052d (patch) | |
tree | 76811147fccd8c0c62bc9884e32a349bf72c8806 | |
parent | 9a151056d034f4124ea837f77b5a13f35834fd22 (diff) | |
download | nextcloud-server-361d2badd8f5be949acd94f52fc9ba2d0a98052d.tar.gz nextcloud-server-361d2badd8f5be949acd94f52fc9ba2d0a98052d.zip |
Some phpstorm inspection fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r-- | lib/public/AppFramework/Http/DataDisplayResponse.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/ICallbackResponse.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/IApi.php | 10 | ||||
-rw-r--r-- | lib/public/AppFramework/IAppContainer.php | 14 | ||||
-rw-r--r-- | lib/public/Contacts/IManager.php | 239 | ||||
-rw-r--r-- | lib/public/DB.php | 4 | ||||
-rw-r--r-- | lib/public/Files.php | 14 | ||||
-rw-r--r-- | lib/public/Files/ObjectStore/IObjectStore.php | 9 | ||||
-rw-r--r-- | lib/public/JSON.php | 2 | ||||
-rw-r--r-- | lib/public/Search/PagedProvider.php | 2 | ||||
-rw-r--r-- | lib/public/Security/ISecureRandom.php | 2 | ||||
-rw-r--r-- | lib/public/Template.php | 28 | ||||
-rw-r--r-- | lib/public/Util.php | 32 |
13 files changed, 179 insertions, 181 deletions
diff --git a/lib/public/AppFramework/Http/DataDisplayResponse.php b/lib/public/AppFramework/Http/DataDisplayResponse.php index 0fc10129b8a..820e00ff963 100644 --- a/lib/public/AppFramework/Http/DataDisplayResponse.php +++ b/lib/public/AppFramework/Http/DataDisplayResponse.php @@ -46,7 +46,7 @@ class DataDisplayResponse extends Response { * @param array $headers additional key value based headers * @since 8.1.0 */ - public function __construct($data="", $statusCode=Http::STATUS_OK, + public function __construct($data='', $statusCode=Http::STATUS_OK, $headers=[]) { $this->data = $data; $this->setStatus($statusCode); diff --git a/lib/public/AppFramework/Http/ICallbackResponse.php b/lib/public/AppFramework/Http/ICallbackResponse.php index 4bf5ce36f7e..2e23946112e 100644 --- a/lib/public/AppFramework/Http/ICallbackResponse.php +++ b/lib/public/AppFramework/Http/ICallbackResponse.php @@ -39,6 +39,6 @@ interface ICallbackResponse { * @param IOutput $output a small wrapper that handles output * @since 8.1.0 */ - function callback(IOutput $output); + public function callback(IOutput $output); } diff --git a/lib/public/AppFramework/IApi.php b/lib/public/AppFramework/IApi.php index 419e1782686..1c3f9419ccd 100644 --- a/lib/public/AppFramework/IApi.php +++ b/lib/public/AppFramework/IApi.php @@ -43,7 +43,7 @@ interface IApi { * @return string the user id of the current user * @deprecated 8.0.0 Use \OC::$server->getUserSession()->getUser()->getUID() */ - function getUserId(); + public function getUserId(); /** @@ -53,7 +53,7 @@ interface IApi { * @param string $appName the name of the app, defaults to the current one * @return void */ - function addScript($scriptName, $appName = null); + public function addScript($scriptName, $appName = null); /** @@ -63,7 +63,7 @@ interface IApi { * @param string $appName the name of the app, defaults to the current one * @return void */ - function addStyle($styleName, $appName = null); + public function addStyle($styleName, $appName = null); /** @@ -72,7 +72,7 @@ interface IApi { * @param string $name the name of the file without the suffix * @return void */ - function add3rdPartyScript($name); + public function add3rdPartyScript($name); /** @@ -81,7 +81,7 @@ interface IApi { * @param string $name the name of the file without the suffix * @return void */ - function add3rdPartyStyle($name); + public function add3rdPartyStyle($name); /** diff --git a/lib/public/AppFramework/IAppContainer.php b/lib/public/AppFramework/IAppContainer.php index f26afbdcd17..4aac6085d63 100644 --- a/lib/public/AppFramework/IAppContainer.php +++ b/lib/public/AppFramework/IAppContainer.php @@ -42,41 +42,41 @@ interface IAppContainer extends IContainer { * @return string the name of your application * @since 6.0.0 */ - function getAppName(); + public function getAppName(); /** * @deprecated 8.0.0 implements only deprecated methods * @return IApi * @since 6.0.0 */ - function getCoreApi(); + public function getCoreApi(); /** * @return \OCP\IServerContainer * @since 6.0.0 */ - function getServer(); + public function getServer(); /** * @param string $middleWare * @return boolean * @since 6.0.0 */ - function registerMiddleWare($middleWare); + public function registerMiddleWare($middleWare); /** * @deprecated 8.0.0 use IUserSession->isLoggedIn() * @return boolean * @since 6.0.0 */ - function isLoggedIn(); + public function isLoggedIn(); /** * @deprecated 8.0.0 use IGroupManager->isAdmin($userId) * @return boolean * @since 6.0.0 */ - function isAdminUser(); + public function isAdminUser(); /** * @deprecated 8.0.0 use the ILogger instead @@ -85,7 +85,7 @@ interface IAppContainer extends IContainer { * @return mixed * @since 6.0.0 */ - function log($message, $level); + public function log($message, $level); /** * Register a capability diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php index 328b40931d7..117d28525fb 100644 --- a/lib/public/Contacts/IManager.php +++ b/lib/public/Contacts/IManager.php @@ -32,140 +32,139 @@ // use OCP namespace for all classes that are considered public. // This means that they should be used by apps instead of the internal ownCloud classes -namespace OCP\Contacts { +namespace OCP\Contacts; + +/** + * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. + * + * Contacts in general will be expressed as an array of key-value-pairs. + * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 + * + * Proposed workflow for working with contacts: + * - search for the contacts + * - manipulate the results array + * - createOrUpdate will save the given contacts overwriting the existing data + * + * For updating it is mandatory to keep the id. + * Without an id a new contact will be created. + * + * @since 6.0.0 + */ +interface IManager { /** - * This class provides access to the contacts app. Use this class exclusively if you want to access contacts. + * This function is used to search and find contacts within the users address books. + * In case $pattern is empty all contacts will be returned. + * + * Example: + * Following function shows how to search for contacts for the name and the email address. + * + * public static function getMatchingRecipient($term) { + * $cm = \OC::$server->getContactsManager(); + * // The API is not active -> nothing to do + * if (!$cm->isEnabled()) { + * return array(); + * } * - * Contacts in general will be expressed as an array of key-value-pairs. - * The keys will match the property names defined in https://tools.ietf.org/html/rfc2426#section-1 + * $result = $cm->search($term, array('FN', 'EMAIL')); + * $receivers = array(); + * foreach ($result as $r) { + * $id = $r['id']; + * $fn = $r['FN']; + * $email = $r['EMAIL']; + * if (!is_array($email)) { + * $email = array($email); + * } * - * Proposed workflow for working with contacts: - * - search for the contacts - * - manipulate the results array - * - createOrUpdate will save the given contacts overwriting the existing data + * // loop through all email addresses of this contact + * foreach ($email as $e) { + * $displayName = $fn . " <$e>"; + * $receivers[] = array( + * 'id' => $id, + * 'label' => $displayName, + * 'value' => $displayName); + * } + * } * - * For updating it is mandatory to keep the id. - * Without an id a new contact will be created. + * return $receivers; + * } * + * + * @param string $pattern which should match within the $searchProperties + * @param array $searchProperties defines the properties within the query pattern should match + * @param array $options - for future use. One should always have options! + * @return array an array of contacts which are arrays of key-value-pairs * @since 6.0.0 */ - interface IManager { - - /** - * This function is used to search and find contacts within the users address books. - * In case $pattern is empty all contacts will be returned. - * - * Example: - * Following function shows how to search for contacts for the name and the email address. - * - * public static function getMatchingRecipient($term) { - * $cm = \OC::$server->getContactsManager(); - * // The API is not active -> nothing to do - * if (!$cm->isEnabled()) { - * return array(); - * } - * - * $result = $cm->search($term, array('FN', 'EMAIL')); - * $receivers = array(); - * foreach ($result as $r) { - * $id = $r['id']; - * $fn = $r['FN']; - * $email = $r['EMAIL']; - * if (!is_array($email)) { - * $email = array($email); - * } - * - * // loop through all email addresses of this contact - * foreach ($email as $e) { - * $displayName = $fn . " <$e>"; - * $receivers[] = array( - * 'id' => $id, - * 'label' => $displayName, - * 'value' => $displayName); - * } - * } - * - * return $receivers; - * } - * - * - * @param string $pattern which should match within the $searchProperties - * @param array $searchProperties defines the properties within the query pattern should match - * @param array $options - for future use. One should always have options! - * @return array an array of contacts which are arrays of key-value-pairs - * @since 6.0.0 - */ - function search($pattern, $searchProperties = array(), $options = array()); + public function search($pattern, $searchProperties = array(), $options = array()); - /** - * This function can be used to delete the contact identified by the given id - * - * @param object $id the unique identifier to a contact - * @param string $address_book_key identifier of the address book in which the contact shall be deleted - * @return bool successful or not - * @since 6.0.0 - */ - function delete($id, $address_book_key); + /** + * This function can be used to delete the contact identified by the given id + * + * @param object $id the unique identifier to a contact + * @param string $address_book_key identifier of the address book in which the contact shall be deleted + * @return bool successful or not + * @since 6.0.0 + */ + public function delete($id, $address_book_key); - /** - * This function is used to create a new contact if 'id' is not given or not present. - * Otherwise the contact will be updated by replacing the entire data set. - * - * @param array $properties this array if key-value-pairs defines a contact - * @param string $address_book_key identifier of the address book in which the contact shall be created or updated - * @return array an array representing the contact just created or updated - * @since 6.0.0 - */ - function createOrUpdate($properties, $address_book_key); + /** + * This function is used to create a new contact if 'id' is not given or not present. + * Otherwise the contact will be updated by replacing the entire data set. + * + * @param array $properties this array if key-value-pairs defines a contact + * @param string $address_book_key identifier of the address book in which the contact shall be created or updated + * @return array an array representing the contact just created or updated + * @since 6.0.0 + */ + public function createOrUpdate($properties, $address_book_key); - /** - * Check if contacts are available (e.g. contacts app enabled) - * - * @return bool true if enabled, false if not - * @since 6.0.0 - */ - function isEnabled(); + /** + * Check if contacts are available (e.g. contacts app enabled) + * + * @return bool true if enabled, false if not + * @since 6.0.0 + */ + public function isEnabled(); - /** - * Registers an address book - * - * @param \OCP\IAddressBook $address_book - * @return void - * @since 6.0.0 - */ - function registerAddressBook(\OCP\IAddressBook $address_book); + /** + * Registers an address book + * + * @param \OCP\IAddressBook $address_book + * @return void + * @since 6.0.0 + */ + public function registerAddressBook(\OCP\IAddressBook $address_book); - /** - * Unregisters an address book - * - * @param \OCP\IAddressBook $address_book - * @return void - * @since 6.0.0 - */ - function unregisterAddressBook(\OCP\IAddressBook $address_book); + /** + * Unregisters an address book + * + * @param \OCP\IAddressBook $address_book + * @return void + * @since 6.0.0 + */ + public function unregisterAddressBook(\OCP\IAddressBook $address_book); - /** - * In order to improve lazy loading a closure can be registered which will be called in case - * address books are actually requested - * - * @param \Closure $callable - * @return void - * @since 6.0.0 - */ - function register(\Closure $callable); + /** + * In order to improve lazy loading a closure can be registered which will be called in case + * address books are actually requested + * + * @param \Closure $callable + * @return void + * @since 6.0.0 + */ + public function register(\Closure $callable); - /** - * @return array - * @since 6.0.0 - */ - function getAddressBooks(); + /** + * @return array + * @since 6.0.0 + */ + public function getAddressBooks(); - /** - * removes all registered address book instances - * @return void - * @since 6.0.0 - */ - function clear(); - } + /** + * removes all registered address book instances + * @return void + * @since 6.0.0 + */ + public function clear(); } diff --git a/lib/public/DB.php b/lib/public/DB.php index d22da39d9c2..5018392f650 100644 --- a/lib/public/DB.php +++ b/lib/public/DB.php @@ -57,7 +57,7 @@ class DB { * @since 4.5.0 */ static public function prepare( $query, $limit=null, $offset=null ) { - return(\OC_DB::prepare($query, $limit, $offset)); + return \OC_DB::prepare($query, $limit, $offset); } /** @@ -117,7 +117,7 @@ class DB { * @since 8.0.0 */ public static function rollback() { - \OC::$server->getDatabaseConnection()->rollback(); + \OC::$server->getDatabaseConnection()->rollBack(); } /** diff --git a/lib/public/Files.php b/lib/public/Files.php index 08fcbe0bbeb..3b924ea6a29 100644 --- a/lib/public/Files.php +++ b/lib/public/Files.php @@ -50,7 +50,7 @@ class Files { * @return bool * @since 5.0.0 */ - static function rmdirr( $dir ) { + static public function rmdirr( $dir ) { return \OC_Helper::rmdirr( $dir ); } @@ -61,7 +61,7 @@ class Files { * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead * @since 5.0.0 */ - static function getMimeType( $path ) { + static public function getMimeType( $path ) { return \OC::$server->getMimeTypeDetector()->detect($path); } @@ -71,8 +71,8 @@ class Files { * @return array * @since 6.0.0 */ - static public function searchByMime( $mimetype ) { - return(\OC\Files\Filesystem::searchByMime( $mimetype )); + static public function searchByMime($mimetype) { + return \OC\Files\Filesystem::searchByMime($mimetype); } /** @@ -119,8 +119,8 @@ class Files { * @return string * @since 5.0.0 */ - public static function buildNotExistingFileName( $path, $filename ) { - return(\OC_Helper::buildNotExistingFileName( $path, $filename )); + public static function buildNotExistingFileName($path, $filename) { + return \OC_Helper::buildNotExistingFileName($path, $filename); } /** @@ -130,7 +130,7 @@ class Files { * @return \OC\Files\View * @since 5.0.0 */ - public static function getStorage( $app ) { + public static function getStorage($app) { return \OC_App::getStorage( $app ); } } diff --git a/lib/public/Files/ObjectStore/IObjectStore.php b/lib/public/Files/ObjectStore/IObjectStore.php index 7ae34ce1bc0..3126791d873 100644 --- a/lib/public/Files/ObjectStore/IObjectStore.php +++ b/lib/public/Files/ObjectStore/IObjectStore.php @@ -34,7 +34,7 @@ interface IObjectStore { * @return string the container or bucket name where objects are stored * @since 7.0.0 */ - function getStorageId(); + public function getStorageId(); /** * @param string $urn the unified resource name used to identify the object @@ -42,7 +42,7 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function readObject($urn); + public function readObject($urn); /** * @param string $urn the unified resource name used to identify the object @@ -50,7 +50,7 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function writeObject($urn, $stream); + public function writeObject($urn, $stream); /** * @param string $urn the unified resource name used to identify the object @@ -58,6 +58,5 @@ interface IObjectStore { * @throws \Exception when something goes wrong, message will be logged * @since 7.0.0 */ - function deleteObject($urn); - + public function deleteObject($urn); } diff --git a/lib/public/JSON.php b/lib/public/JSON.php index 02c515e863e..7db61ff1571 100644 --- a/lib/public/JSON.php +++ b/lib/public/JSON.php @@ -95,7 +95,7 @@ class JSON { * Send json success msg * * Return a json success message with optional extra data. - * @see OCP\JSON::error() for the format to use. + * @see \OCP\JSON::error() for the format to use. * * @param array $data The data to use * @return string json formatted string. diff --git a/lib/public/Search/PagedProvider.php b/lib/public/Search/PagedProvider.php index 43d8c316652..3bd5b75cc2d 100644 --- a/lib/public/Search/PagedProvider.php +++ b/lib/public/Search/PagedProvider.php @@ -42,7 +42,7 @@ abstract class PagedProvider extends Provider { * @since 8.0.0 */ public function __construct($options) { - $this->options = $options; + parent::__construct($options); } /** diff --git a/lib/public/Security/ISecureRandom.php b/lib/public/Security/ISecureRandom.php index 14190639f44..2f74a003f51 100644 --- a/lib/public/Security/ISecureRandom.php +++ b/lib/public/Security/ISecureRandom.php @@ -49,7 +49,7 @@ interface ISecureRandom { * generate human readable random strings. Lower- and upper-case characters and digits * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on. */ - const CHAR_HUMAN_READABLE = "abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789"; + const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789'; /** * Convenience method to get a low strength random number generator. diff --git a/lib/public/Template.php b/lib/public/Template.php index 590f430e24c..85c60cfb0a2 100644 --- a/lib/public/Template.php +++ b/lib/public/Template.php @@ -49,8 +49,8 @@ namespace OCP; * @see \OCP\IURLGenerator::imagePath * @deprecated 8.0.0 Use \OCP\Template::image_path() instead */ -function image_path( $app, $image ) { - return(\image_path( $app, $image )); +function image_path($app, $image) { + return \image_path($app, $image); } @@ -60,8 +60,8 @@ function image_path( $app, $image ) { * @return string to the image of this file type. * @deprecated 8.0.0 Use \OCP\Template::mimetype_icon() instead */ -function mimetype_icon( $mimetype ) { - return(\mimetype_icon( $mimetype )); +function mimetype_icon($mimetype) { + return \mimetype_icon($mimetype); } /** @@ -70,8 +70,8 @@ function mimetype_icon( $mimetype ) { * @return string to the preview of the image * @deprecated 8.0.0 Use \OCP\Template::preview_icon() instead */ -function preview_icon( $path ) { - return(\preview_icon( $path )); +function preview_icon($path) { + return \preview_icon($path); } /** @@ -82,8 +82,8 @@ function preview_icon( $path ) { * @return string link to the preview * @deprecated 8.0.0 Use \OCP\Template::publicPreview_icon() instead */ -function publicPreview_icon ( $path, $token ) { - return(\publicPreview_icon( $path, $token )); +function publicPreview_icon($path, $token) { + return \publicPreview_icon($path, $token); } /** @@ -93,8 +93,8 @@ function publicPreview_icon ( $path, $token ) { * @return string size as string * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead */ -function human_file_size( $bytes ) { - return(\human_file_size( $bytes )); +function human_file_size($bytes) { + return \human_file_size($bytes); } @@ -106,8 +106,8 @@ function human_file_size( $bytes ) { * * @deprecated 8.0.0 Use \OCP\Template::relative_modified_date() instead */ -function relative_modified_date( $timestamp, $dateOnly = false ) { - return(\relative_modified_date($timestamp, null, $dateOnly)); +function relative_modified_date($timestamp, $dateOnly = false) { + return \relative_modified_date($timestamp, null, $dateOnly); } @@ -118,7 +118,7 @@ function relative_modified_date( $timestamp, $dateOnly = false ) { * @deprecated 8.0.0 Use \OCP\Template::human_file_size() instead */ function simple_file_size($bytes) { - return(\human_file_size($bytes)); + return \human_file_size($bytes); } @@ -131,7 +131,7 @@ function simple_file_size($bytes) { * @deprecated 8.0.0 Use \OCP\Template::html_select_options() instead */ function html_select_options($options, $selected, $params=array()) { - return(\html_select_options($options, $selected, $params)); + return \html_select_options($options, $selected, $params); } diff --git a/lib/public/Util.php b/lib/public/Util.php index 02b59c370a0..6f2e455c3e4 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -73,7 +73,7 @@ class Util { * @since 4.0.0 */ public static function getVersion() { - return(\OC_Util::getVersion()); + return \OC_Util::getVersion(); } /** @@ -119,11 +119,11 @@ class Util { $message->setPlainBody($mailtext); $message->setFrom([$fromaddress => $fromname]); if($html === 1) { - $message->setHTMLBody($altbody); + $message->setHtmlBody($altbody); } if($altbody === '') { - $message->setHTMLBody($mailtext); + $message->setHtmlBody($mailtext); $message->setPlainBody(''); } else { $message->setHtmlBody($mailtext); @@ -254,7 +254,7 @@ class Util { * @since 4.0.0 */ public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) { - return(\OC_Util::formatDate($timestamp, $dateOnly, $timeZone)); + return \OC_Util::formatDate($timestamp, $dateOnly, $timeZone); } /** @@ -440,8 +440,8 @@ class Util { * @return string a human readable file size * @since 4.0.0 */ - public static function humanFileSize( $bytes ) { - return(\OC_Helper::humanFileSize( $bytes )); + public static function humanFileSize($bytes) { + return \OC_Helper::humanFileSize($bytes); } /** @@ -452,8 +452,8 @@ class Util { * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 * @since 4.0.0 */ - public static function computerFileSize( $str ) { - return(\OC_Helper::computerFileSize( $str )); + public static function computerFileSize($str) { + return \OC_Helper::computerFileSize($str); } /** @@ -470,8 +470,8 @@ class Util { * TODO: write example * @since 4.0.0 */ - static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) { - return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName )); + static public function connectHook($signalClass, $signalName, $slotClass, $slotName) { + return \OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName); } /** @@ -484,8 +484,8 @@ class Util { * TODO: write example * @since 4.0.0 */ - static public function emitHook( $signalclass, $signalname, $params = array()) { - return(\OC_Hook::emit( $signalclass, $signalname, $params )); + static public function emitHook($signalclass, $signalname, $params = array()) { + return \OC_Hook::emit($signalclass, $signalname, $params); } /** @@ -518,7 +518,7 @@ class Util { exit(); } - if (!(\OC::$server->getRequest()->passesCSRFCheck())) { + if (!\OC::$server->getRequest()->passesCSRFCheck()) { exit(); } } @@ -549,7 +549,7 @@ class Util { * @since 6.0.0 */ public static function encodePath($component) { - return(\OC_Util::encodePath($component)); + return \OC_Util::encodePath($component); } /** @@ -562,7 +562,7 @@ class Util { * @since 4.5.0 */ public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') { - return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding)); + return \OC_Helper::mb_array_change_key_case($input, $case, $encoding); } /** @@ -607,7 +607,7 @@ class Util { * @since 4.5.0 */ public static function recursiveArraySearch($haystack, $needle, $index = null) { - return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index)); + return \OC_Helper::recursiveArraySearch($haystack, $needle, $index); } /** |