1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-11-28 10:24:11 +01:00

Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
Scrutinizer Auto-Fixer 2015-05-07 22:57:33 +00:00 committed by Thomas Müller
parent b82e877b0b
commit cf7c31b6bb
23 changed files with 102 additions and 105 deletions

View File

@ -38,7 +38,7 @@ abstract class AbstractPIMObject implements IPIMObject {
/**
* @param integer $permission
* @return boolean
* @return integer
*/
public function hasPermission($permission) {
return $this->getPermissions() & $permission;

View File

@ -23,7 +23,6 @@
namespace OCA\Contacts;
use OCA\Contacts\Utils\JSONSerializer;
use OCA\Contacts\Utils\Properties;
use OCA\Contacts\Utils\TemporaryPhoto;
use OCA\Contacts\VObject\VCard;
/**
@ -71,22 +70,22 @@ class AddressbookProvider implements \OCP\IAddressBook {
/**
* In comparison to getKey() this function returns a human readable (maybe translated) name
* @return mixed
* @return string
*/
public function getDisplayName() {
return $this->addressBook->getDisplayName();
}
/**
* @return mixed
* @return integer
*/
public function getPermissions() {
return $this->addressBook->getPermissions();
}
/**
* @param $pattern
* @param $searchProperties
* @param string $pattern
* @param string[] $searchProperties
* @param $options
* @return array|false
*/
@ -177,7 +176,7 @@ SQL;
/**
* @param $properties
* @return mixed
* @return Contact|null
*/
public function createOrUpdate($properties) {
$addressBook = $this->getAddressbook();

View File

@ -175,7 +175,7 @@ abstract class AbstractBackend {
* cannot determine the number.
*
* @param string $addressBookId
* @return integer|null
* @return integer
*/
public function numContacts($addressBookId) {
@ -313,7 +313,7 @@ abstract class AbstractBackend {
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
*
* @param string $addressBookId
* @param mixed $id
* @param string $id
* @param array $options - Optional options
* @return array|null
*/
@ -401,7 +401,7 @@ abstract class AbstractBackend {
/**
* @brief Query whether a backend or an address book is active
* @param string $addressbookid If null it checks whether the backend is activated.
* @param string $addressBookId If null it checks whether the backend is activated.
* @return boolean
*/
public function isActive($addressBookId = null) {
@ -415,7 +415,7 @@ abstract class AbstractBackend {
/**
* @brief Activate a backend or an address book
* @param bool active
* @param string $addressbookid If null it activates the backend.
* @param string $addressBookId If null it activates the backend.
* @return boolean
*/
public function setActive($active, $addressBookId = null) {
@ -429,7 +429,6 @@ abstract class AbstractBackend {
/**
* @brief get all the preferences for the addressbook
* @param string $id
* @return array Format array('param1' => 'value', 'param2' => 'value')
*/
public function getPreferences($addressBookId) {
@ -442,7 +441,6 @@ abstract class AbstractBackend {
/**
* @brief sets the preferences for the addressbook given in parameter
* @param string $id
* @param array the preferences, format array('param1' => 'value', 'param2' => 'value')
* @return boolean
*/
@ -455,6 +453,9 @@ abstract class AbstractBackend {
: false;
}
/**
* @param string $addressbookid
*/
public function removePreferences($addressbookid) {
$key = $this->combinedKey($addressbookid);
$key = 'prefs_' . $key;

View File

@ -22,10 +22,10 @@
namespace OCA\Contacts\Backend;
use OCA\Contacts\Contact,
OCA\Contacts\VObject\VCard,
OCA\Contacts\Utils\Properties,
Sabre\VObject\Reader;
use OCA\Contacts\Contact;
use OCA\Contacts\VObject\VCard;
use OCA\Contacts\Utils\Properties;
use Sabre\VObject\Reader;
/**
* Backend class for a users own contacts.
@ -73,8 +73,6 @@ class Database extends AbstractBackend {
/**
* Sets up the backend
*
* @param string $addressBooksTableName
* @param string $cardsTableName
*/
public function __construct(
$userid = null,
@ -179,6 +177,7 @@ class Database extends AbstractBackend {
/**
* {@inheritdoc}
* @param string|false $addressBookId
*/
public function hasAddressBook($addressBookId) {
@ -268,7 +267,6 @@ class Database extends AbstractBackend {
* 'displayname' MUST be present.
*
* @param array $properties
* @param array $options - Optional (backend specific options)
* @return string|false The ID if the newly created AddressBook or false on error.
*/
public function createAddressBook(array $properties) {
@ -356,7 +354,6 @@ class Database extends AbstractBackend {
* property indexes and category/group relations by itself.
*
* @param string $addressBookId
* @param array $options - Optional (backend specific options)
* @return bool
*/
public function deleteAddressBook($addressBookId) {
@ -420,8 +417,7 @@ class Database extends AbstractBackend {
* Returns the number of contacts in a specific address book.
*
* @param string $addressBookId
* @param bool $omitdata Don't fetch the entire carddata or vcard.
* @return array
* @return null|integer
*/
public function numContacts($addressBookId) {
@ -555,6 +551,10 @@ class Database extends AbstractBackend {
return $row;
}
/**
* @param string|false $addressBookId
* @param false|string $id
*/
public function hasContact($addressBookId, $id) {
try {
return $this->getContact($addressBookId, $id) !== null;
@ -575,9 +575,9 @@ class Database extends AbstractBackend {
* set, or the contact has a UID. If neither is set, it will fail.
*
* @param string $addressBookId
* @param VCard|string $contact
* @param string $contact
* @param array $options - Optional (backend specific options)
* @return string|bool The identifier for the new contact or false on error.
* @return false|string The identifier for the new contact or false on error.
*/
public function createContact($addressBookId, $contact, array $options = array()) {
//\OCP\Util::writeLog('contacts', __METHOD__.' addressBookId: ' . $addressBookId, \OCP\Util::DEBUG);
@ -644,8 +644,8 @@ class Database extends AbstractBackend {
* Updates a contact
*
* @param string $addressBookId
* @param string|array $id Contact ID
* @param VCard|string $contact
* @param false|string $id Contact ID
* @param string $contact
* @param array $options - Optional (backend specific options)
* @see getContact
* @return bool
@ -743,7 +743,7 @@ class Database extends AbstractBackend {
* Deletes a contact
*
* @param string $addressBookId
* @param string|array $id
* @param false|string $id
* @param array $options - Optional (backend specific options)
* @see getContact
* @return bool
@ -828,7 +828,7 @@ class Database extends AbstractBackend {
/**
* @brief Get the contact id from the uri.
*
* @param mixed $addressBookId,$id
* @param string $addressBookId
* @returns int | null
*/
public function getIdFromUri($addressBookId,$uri) {

View File

@ -22,7 +22,6 @@
namespace OCA\Contacts\Backend;
use OCA\Contacts\Contact;
use OCA\Contacts\VObject\VCard;
use Sabre\VObject\Reader;
use OCA\Contacts\Connector\LdapConnector;
@ -90,7 +89,7 @@ class Ldap extends AbstractBackend {
/**
* @brief close the current connection
* @return boolean closing success
* @return boolean|null closing success
*/
public function ldapCloseConnection() {
if (self::ldapIsConnected()) {
@ -199,7 +198,7 @@ class Ldap extends AbstractBackend {
/**
* @brief adds a new ldap entry
* @param $ldapDN the new DN (must be unique)
* @param string $ldapDN the new DN (must be unique)
* @param $ldapValues the ldif values
* @return boolean insert status
*/
@ -212,7 +211,7 @@ class Ldap extends AbstractBackend {
/**
* @brief modify a ldap entry
* @param $ldapDN the DN (must exists)
* @param string $ldapDN the DN (must exists)
* @param $ldapValues the ldif values
* @return boolean modify status
*/
@ -225,7 +224,7 @@ class Ldap extends AbstractBackend {
/**
* @brief delete a ldap entry
* @param $ldapDN the DN (must exists)
* @param string $ldapDN the DN (must exists)
* @return boolean delete status
*/
public function ldapDelete($ldapDN) {
@ -239,7 +238,6 @@ class Ldap extends AbstractBackend {
/**
* Sets up the backend
*
* @param string $cardsTableName
*/
public function __construct(
$userid = null,
@ -252,7 +250,6 @@ class Ldap extends AbstractBackend {
/**
* Returns the list of active addressbooks for a specific user.
*
* @param string $userid
* @return array
*/
public function getAddressBooksForUser(array $options = array()) {
@ -471,7 +468,6 @@ class Ldap extends AbstractBackend {
* TODO: Some sort of ETag?
*
* @param string $addressbookid
* @param bool $omitdata Don't fetch the entire carddata or vcard.
* @return array
*/
public function getContacts($addressbookid, array $options = array()) {
@ -522,7 +518,7 @@ class Ldap extends AbstractBackend {
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
*
* @param string $addressbookid
* @param mixed $id
* @param mixed $ids
* @return array|bool
*/
public function getContact($addressbookid, $ids, array $options = array()) {
@ -564,7 +560,7 @@ class Ldap extends AbstractBackend {
/**
* @brief construct a vcard in Sabre format
* @param integer $aid Addressbook Id
* @param OC_VObject $card VCard
* @param OC_VObject $vcard VCard
* @return array
*/
public static function getSabreFormatCard($aid, $vcard) {
@ -597,7 +593,6 @@ class Ldap extends AbstractBackend {
* Creates a new contact
*
* @param string $addressbookid
* @param VCard|string $carddata
* @return string|bool The identifier for the new contact or false on error.
*/
public function createContact($addressbookid, $contact, array $options = array()) {

View File

@ -86,7 +86,6 @@ class Backend extends \Sabre\CardDAV\Backend\AbstractBackend {
* well as the return value.
*
* @param mixed $addressbookid
* @param PropPatch $mutations
* @see \Sabre\DAV\IProperties::updateProperties
* @return bool|array
*/

View File

@ -22,8 +22,7 @@
namespace OCA\Contacts\Connector;
use Sabre\VObject\Component,
Sabre\VObject\StringUtil;
use Sabre\VObject\StringUtil;
/**
* Abstract class used to implement import classes
@ -33,6 +32,9 @@ abstract class ImportConnector {
// XML Configuration, class SimpleXml format
protected $configContent;
/**
* @param \SimpleXMLElement $xml_config
*/
public function __construct($xml_config = null) {
if ($xml_config != null) {
$this->setConfig($xml_config);

View File

@ -179,7 +179,7 @@ class ImportCsvConnector extends ImportConnector {
/**
* @brief gets the import entry corresponding to the position given in parameter
* @param $position the position to look for in the connector
* @param string $position the position to look for in the connector
* @return int|false
*/
private function getImportEntryFromPosition($position) {

View File

@ -22,9 +22,9 @@
namespace OCA\Contacts\Connector;
use Sabre\VObject\Component,
Sabre\VObject\StringUtil,
Sabre\VObject;
use Sabre\VObject\Component;
use Sabre\VObject\StringUtil;
use Sabre\VObject;
/**
* @brief Implementation of the LDIF import format

View File

@ -21,7 +21,6 @@
*/
namespace OCA\Contacts\Connector;
use Sabre\VObject\Component;
class LdapConnector {
@ -45,7 +44,7 @@ class LdapConnector {
* @brief transform a ldap entry into an VCard object
* for each ldap entry which is like "property: value"
* to a VCard entry which is like "PROPERTY[;PARAMETER=param]:value"
* @param array $ldap_entry
* @param array $ldapEntry
* @return OC_VCard
*/
public function ldapToVCard($ldapEntry) {
@ -102,7 +101,7 @@ class LdapConnector {
* creates the property if it doesn't exists yet
* @param $vcard the vcard to get or create the properties with
* @param $v_param the parameter the find
* @param $index the position of the property in the vcard to find
* @param integer $index the position of the property in the vcard to find
*/
public function getOrCreateVCardProperty(&$vcard, $v_param, $index) {
@ -309,7 +308,7 @@ class LdapConnector {
* @brief updates the ldifEntry with $ldifNewValues
* @param $ldifEntry the array to modify
* @param $ldifNewValues the new values
* @return boolean
* @return boolean|null
*/
public function updateLdifProperty(&$ldifEntries, $ldifNewValues) {
foreach ($ldifNewValues as $key => $value) {

View File

@ -22,8 +22,8 @@
namespace OCA\Contacts;
use Sabre\VObject\Property,
OCA\Contacts\Utils\Properties;
use Sabre\VObject\Property;
use OCA\Contacts\Utils\Properties;
/**
* Subclass this class or implement IPIMObject interface for PIM objects
@ -179,7 +179,7 @@ class Contact extends VObject\VCard implements IPIMObject {
}
/**
* @return string|null
* @return string
* TODO: Cache result.
*/
public function getETag() {
@ -212,7 +212,7 @@ class Contact extends VObject\VCard implements IPIMObject {
/**
* @param integer $permission
* @return bool
* @return integer
*/
public function hasPermission($permission) {
return $this->getPermissions() & $permission;
@ -456,7 +456,7 @@ class Contact extends VObject\VCard implements IPIMObject {
* Get a property index in the contact by the checksum of its serialized value
*
* @param string $checksum An 8 char m5d checksum.
* @return \Sabre\VObject\Property Property by reference
* @return integer Property by reference
* @throws An exception with error code 404 if the property is not found.
*/
public function getPropertyIndexByChecksum($checksum) {
@ -790,6 +790,9 @@ class Contact extends VObject\VCard implements IPIMObject {
$this->setSaved(false);
}
/**
* @param boolean $state
*/
public function setRetrieved($state) {
$this->props['retrieved'] = $state;
}

View File

@ -10,21 +10,22 @@
namespace OCA\Contacts\Controller;
use OCA\Contacts\App,
OCA\Contacts\JSONResponse,
OCA\Contacts\Controller,
Sabre\VObject,
OCA\Contacts\VObject\VCard as MyVCard,
OCA\Contacts\ImportManager,
OCP\IRequest,
OCP\ICache,
OCP\ITags;
use OCA\Contacts\App;
use OCA\Contacts\JSONResponse;
use OCA\Contacts\Controller;
use OCA\Contacts\ImportManager;
use OCP\IRequest;
use OCP\ICache;
use OCP\ITags;
/**
* Controller importing contacts
*/
class ImportController extends Controller {
/**
* @param string $appName
*/
public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) {
parent::__construct($appName, $request, $app);
$this->cache = $cache;
@ -274,8 +275,8 @@ class ImportController extends Controller {
}
/**
* @param $pct
* @param $total
* @param integer $pct
* @param integer $total
* @param $progresskey
*/
protected function writeProcess($pct, $total, $progresskey) {
@ -285,9 +286,9 @@ class ImportController extends Controller {
/**
* @param $view
* @param $filename
* @param string $filename
* @param $progresskey
* @param $response
* @param JSONResponse $response
*/
protected function cleanup($view, $filename, $progresskey, $response) {
if (!$view->unlink('/imports/' . $filename)) {

View File

@ -10,19 +10,19 @@
namespace OCA\Contacts;
use OCP\AppFramework\App as MainApp,
OCP\AppFramework\IAppContainer,
OCA\Contacts\App,
OCA\Contacts\Middleware\Http as HttpMiddleware,
OCA\Contacts\Controller\PageController,
OCA\Contacts\Controller\AddressBookController,
OCA\Contacts\Controller\BackendController,
OCA\Contacts\Controller\GroupController,
OCA\Contacts\Controller\ContactController,
OCA\Contacts\Controller\ContactPhotoController,
OCA\Contacts\Controller\SettingsController,
OCA\Contacts\Controller\ImportController,
OCA\Contacts\Controller\ExportController;
use OCP\AppFramework\App as MainApp;
use OCP\AppFramework\IAppContainer;
use OCA\Contacts\App;
use OCA\Contacts\Middleware\Http as HttpMiddleware;
use OCA\Contacts\Controller\PageController;
use OCA\Contacts\Controller\AddressBookController;
use OCA\Contacts\Controller\BackendController;
use OCA\Contacts\Controller\GroupController;
use OCA\Contacts\Controller\ContactController;
use OCA\Contacts\Controller\ContactPhotoController;
use OCA\Contacts\Controller\SettingsController;
use OCA\Contacts\Controller\ImportController;
use OCA\Contacts\Controller\ExportController;
/**
* This class manages our app actions

View File

@ -42,7 +42,7 @@ class Hooks{
/**
* @brief Add default Addressbook for a certain user
* @param paramters parameters from postCreateUser-Hook
* @return array
* @return boolean
*/
public static function userCreated($parameters) {
//Addressbook::addDefault($parameters['uid']);

View File

@ -21,17 +21,18 @@
*/
namespace OCA\Contacts;
use Sabre\VObject\Component;
use OCA\Contacts\Connector\ImportCsvConnector;
use OCA\Contacts\Connector\ImportVCardConnector;
use OCA\Contacts\Connector\ImportLdifConnector;
use OCA\Contacts\Addressbook;
/**
* Manages the import with basic functionalities
*/
class ImportManager {
/**
* @param string $path
*/
private function loadXmlFile($path) {
if (file_exists($path)) {
$format = simplexml_load_file ( $path );
@ -72,7 +73,6 @@ class ImportManager {
/**
* @brief get all the preferences for the addressbook
* @param string $id
* @return SimpleXml
*/
public function getType($typeName) {

View File

@ -29,7 +29,7 @@ class Addressbook implements \OCP\Share_Backend_Collection {
* @brief Get the source of the item to be stored in the database
* @param string Item
* @param string Owner of the item
* @return mixed|array|false Source
* @return boolean Source
*
* Return an array if the item is file dependent, the array needs two keys: 'item' and 'file'
* Return false if the item does not exist for the user

View File

@ -23,8 +23,8 @@
namespace OCA\Contacts\Utils;
use OCA\Contacts\VObject;
use OCA\Contacts\Contact,
OCA\Contacts\Utils\Properties;
use OCA\Contacts\Contact;
use OCA\Contacts\Utils\Properties;
/**
* This class serializes properties, components an

View File

@ -195,7 +195,7 @@ Class Properties {
/**
* @brief returns the default categories of ownCloud
* @return (array) $categories
* @return string[] $categories
*/
public static function getDefaultCategories() {
$l10n = self::$l10n;

View File

@ -22,8 +22,8 @@
namespace OCA\Contacts\Utils;
use OCP\ICache,
OCP\Image;
use OCP\ICache;
use OCP\Image;
/**
* This class is used for getting a temporary contact photo for cropping.
@ -98,9 +98,6 @@ class TemporaryPhoto {
/**
* Returns an instance of a subclass of this class
*
* @param \OCP\IServerContainer $server
* @param int|null $type One of the pre-defined types.
* @param mixed|null $data Whatever data is needed to load the photo.
*/
public static function create(ICache $cache, $type = null, $data = null) {
if (isset(self::$classMap[$type])) {

View File

@ -22,9 +22,9 @@
namespace OCA\Contacts\Utils\TemporaryPhoto;
use OCA\Contacts\Contact as ContactObject,
OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto,
OCP\ICache;
use OCA\Contacts\Contact as ContactObject;
use OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto;
use OCP\ICache;
/**
* This class loads the PHOTO or LOGO property from a contact.

View File

@ -22,12 +22,11 @@
namespace OCA\Contacts\Utils\TemporaryPhoto;
use OCA\Contacts\Contact as ContactObject,
OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto,
OCP\IRequest,
OCP\AppFramework\Http,
OCP\Image,
OCP\ICache;
use OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto;
use OCP\IRequest;
use OCP\AppFramework\Http;
use OCP\Image;
use OCP\ICache;
/**
* This class loads an image from the virtual file system.

View File

@ -15,6 +15,9 @@ class Mock extends AbstractBackend {
public $contacts;
public $userid;
/**
* @param string $userid
*/
function __construct($userid = null, $addressBooks = null, $contacts = null) {
$this->userid = $userid ? $userid : \OC::$server->getUserSession()->getUser()->getUId();

View File

@ -8,7 +8,6 @@
namespace OCA\Contacts;
use Sabre\VObject\Reader;
use OCA\Contacts\Utils\JSONSerializer;
require_once __DIR__ . '/backend/mock.php';