Skip to content

Commit

Permalink
Merge pull request #20426 from nextcloud/techdebt/psr2
Browse files Browse the repository at this point in the history
It is done
  • Loading branch information
skjnldsv authored Apr 11, 2020
2 parents 97de425 + eea282c commit b5a30d5
Show file tree
Hide file tree
Showing 397 changed files with 1,383 additions and 1,370 deletions.
2 changes: 1 addition & 1 deletion apps/comments/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
use OCP\Util;

class Application extends App {
const APP_ID = 'comments';
public const APP_ID = 'comments';

public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
Expand Down
2 changes: 1 addition & 1 deletion apps/contactsinteraction/lib/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function delete(): void {
/**
* @inheritDoc
*/
function createFile($name, $data = null) {
public function createFile($name, $data = null) {
throw new Exception("This addressbook is immutable");
}

Expand Down
24 changes: 12 additions & 12 deletions apps/contactsinteraction/lib/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,84 +52,84 @@ public function __construct(RecentContact $contact, string $principal, array $ac
/**
* @inheritDoc
*/
function getOwner(): ?string {
public function getOwner(): ?string {
$this->principal;
}

/**
* @inheritDoc
*/
function getACL(): array {
public function getACL(): array {
return $this->acls;
}

/**
* @inheritDoc
*/
function setAcls(array $acls): void {
public function setAcls(array $acls): void {
throw new NotImplemented();
}

/**
* @inheritDoc
*/
function put($data): ?string {
public function put($data): ?string {
throw new NotImplemented();
}

/**
* @inheritDoc
*/
function get() {
public function get() {
return $this->contact->getCard();
}

/**
* @inheritDoc
*/
function getContentType(): ?string {
public function getContentType(): ?string {
return 'text/vcard; charset=utf-8';
}

/**
* @inheritDoc
*/
function getETag(): ?string {
public function getETag(): ?string {
return null;
}

/**
* @inheritDoc
*/
function getSize(): int {
public function getSize(): int {
throw new NotImplemented();
}

/**
* @inheritDoc
*/
function delete(): void {
public function delete(): void {
throw new NotImplemented();
}

/**
* @inheritDoc
*/
function getName(): string {
public function getName(): string {
return (string) $this->contact->getId();
}

/**
* @inheritDoc
*/
function setName($name): void {
public function setName($name): void {
throw new NotImplemented();
}

/**
* @inheritDoc
*/
function getLastModified(): ?int {
public function getLastModified(): ?int {
return $this->contact->getLastContact();
}
}
2 changes: 1 addition & 1 deletion apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
use Symfony\Component\EventDispatcher\GenericEvent;

class Application extends App {
const APP_ID = 'dav';
public const APP_ID = 'dav';

/**
* Application constructor.
Expand Down
18 changes: 9 additions & 9 deletions apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
use OCP\L10N\IFactory;

class Calendar extends Base {
const SUBJECT_ADD = 'calendar_add';
const SUBJECT_UPDATE = 'calendar_update';
const SUBJECT_DELETE = 'calendar_delete';
const SUBJECT_PUBLISH = 'calendar_publish';
const SUBJECT_UNPUBLISH = 'calendar_unpublish';
const SUBJECT_SHARE_USER = 'calendar_user_share';
const SUBJECT_SHARE_GROUP = 'calendar_group_share';
const SUBJECT_UNSHARE_USER = 'calendar_user_unshare';
const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare';
public const SUBJECT_ADD = 'calendar_add';
public const SUBJECT_UPDATE = 'calendar_update';
public const SUBJECT_DELETE = 'calendar_delete';
public const SUBJECT_PUBLISH = 'calendar_publish';
public const SUBJECT_UNPUBLISH = 'calendar_unpublish';
public const SUBJECT_SHARE_USER = 'calendar_user_share';
public const SUBJECT_SHARE_GROUP = 'calendar_group_share';
public const SUBJECT_UNSHARE_USER = 'calendar_user_unshare';
public const SUBJECT_UNSHARE_GROUP = 'calendar_group_unshare';

/** @var IFactory */
protected $languageFactory;
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/lib/CalDAV/Activity/Provider/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
use OCP\L10N\IFactory;

class Event extends Base {
const SUBJECT_OBJECT_ADD = 'object_add';
const SUBJECT_OBJECT_UPDATE = 'object_update';
const SUBJECT_OBJECT_DELETE = 'object_delete';
public const SUBJECT_OBJECT_ADD = 'object_add';
public const SUBJECT_OBJECT_UPDATE = 'object_update';
public const SUBJECT_OBJECT_DELETE = 'object_delete';

/** @var IFactory */
protected $languageFactory;
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/BirthdayCalendar/EnablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* @package OCA\DAV\CalDAV\BirthdayCalendar
*/
class EnablePlugin extends ServerPlugin {
const NS_Nextcloud = 'http://nextcloud.com/ns';
public const NS_Nextcloud = 'http://nextcloud.com/ns';

/**
* @var IConfig
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/BirthdayService.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* @package OCA\DAV\CalDAV
*/
class BirthdayService {
const BIRTHDAY_CALENDAR_URI = 'contact_birthdays';
public const BIRTHDAY_CALENDAR_URI = 'contact_birthdays';

/** @var GroupPrincipalBackend */
private $principalBackend;
Expand Down
58 changes: 29 additions & 29 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@
* @package OCA\DAV\CalDAV
*/
class CalDavBackend extends AbstractBackend implements SyncSupport, SubscriptionSupport, SchedulingSupport {
const CALENDAR_TYPE_CALENDAR = 0;
const CALENDAR_TYPE_SUBSCRIPTION = 1;
public const CALENDAR_TYPE_CALENDAR = 0;
public const CALENDAR_TYPE_SUBSCRIPTION = 1;

const PERSONAL_CALENDAR_URI = 'personal';
const PERSONAL_CALENDAR_NAME = 'Personal';
public const PERSONAL_CALENDAR_URI = 'personal';
public const PERSONAL_CALENDAR_NAME = 'Personal';

const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';
public const RESOURCE_BOOKING_CALENDAR_URI = 'calendar';
public const RESOURCE_BOOKING_CALENDAR_NAME = 'Calendar';

/**
* We need to specify a max date, because we need to stop *somewhere*
Expand All @@ -94,12 +94,12 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
* in 2038-01-19 to avoid problems when the date is converted
* to a unix timestamp.
*/
const MAX_DATE = '2038-01-01';
public const MAX_DATE = '2038-01-01';

const ACCESS_PUBLIC = 4;
const CLASSIFICATION_PUBLIC = 0;
const CLASSIFICATION_PRIVATE = 1;
const CLASSIFICATION_CONFIDENTIAL = 2;
public const ACCESS_PUBLIC = 4;
public const CLASSIFICATION_PUBLIC = 0;
public const CLASSIFICATION_PRIVATE = 1;
public const CLASSIFICATION_CONFIDENTIAL = 2;

/**
* List of CalDAV properties, and how they map to database field names
Expand Down Expand Up @@ -253,7 +253,7 @@ public function getCalendarsForUserCount($principalUri, $excludeBirthday = true)
* @param string $principalUri
* @return array
*/
function getCalendarsForUser($principalUri) {
public function getCalendarsForUser($principalUri) {
$principalUriOriginal = $principalUri;
$principalUri = $this->convertPrincipal($principalUri, true);
$fields = array_values($this->propertyMap);
Expand Down Expand Up @@ -722,7 +722,7 @@ public function getSubscriptionById($subscriptionId) {
* @return int
* @suppress SqlInjectionChecker
*/
function createCalendar($principalUri, $calendarUri, array $properties) {
public function createCalendar($principalUri, $calendarUri, array $properties) {
$values = [
'principaluri' => $this->convertPrincipal($principalUri, true),
'uri' => $calendarUri,
Expand Down Expand Up @@ -790,7 +790,7 @@ function createCalendar($principalUri, $calendarUri, array $properties) {
* @param PropPatch $propPatch
* @return void
*/
function updateCalendar($calendarId, PropPatch $propPatch) {
public function updateCalendar($calendarId, PropPatch $propPatch) {
$supportedProperties = array_keys($this->propertyMap);
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';

Expand Down Expand Up @@ -840,7 +840,7 @@ function updateCalendar($calendarId, PropPatch $propPatch) {
* @param mixed $calendarId
* @return void
*/
function deleteCalendar($calendarId) {
public function deleteCalendar($calendarId) {
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent(
'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar',
[
Expand Down Expand Up @@ -873,7 +873,7 @@ function deleteCalendar($calendarId) {
* @param string $principaluri
* @return void
*/
function deleteAllSharesByUser($principaluri) {
public function deleteAllSharesByUser($principaluri) {
$this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
}

Expand Down Expand Up @@ -1048,7 +1048,7 @@ public function getMultipleCalendarObjects($id, array $uris, $calendarType=self:
* @param int $calendarType
* @return string
*/
function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
$extraData = $this->getDenormalizedData($calendarData);

$q = $this->db->getQueryBuilder();
Expand Down Expand Up @@ -1131,7 +1131,7 @@ function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarT
* @param int $calendarType
* @return string
*/
function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
$extraData = $this->getDenormalizedData($calendarData);
$query = $this->db->getQueryBuilder();
$query->update('calendarobjects')
Expand Down Expand Up @@ -1207,7 +1207,7 @@ public function setClassification($calendarObjectId, $classification) {
* @param int $calendarType
* @return void
*/
function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
public function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
if (is_array($data)) {
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
Expand Down Expand Up @@ -1688,7 +1688,7 @@ private function transformSearchProperty(Property $prop) {
* @param string $uid
* @return string|null
*/
function getCalendarObjectByUID($principalUri, $uid) {
public function getCalendarObjectByUID($principalUri, $uid) {
$query = $this->db->getQueryBuilder();
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
->from('calendarobjects', 'co')
Expand Down Expand Up @@ -1763,7 +1763,7 @@ function getCalendarObjectByUID($principalUri, $uid) {
* @param int $calendarType
* @return array
*/
function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
// Current synctoken
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
$stmt->execute([ $calendarId ]);
Expand Down Expand Up @@ -1854,7 +1854,7 @@ function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = nul
* @param string $principalUri
* @return array
*/
function getSubscriptionsForUser($principalUri) {
public function getSubscriptionsForUser($principalUri) {
$fields = array_values($this->subscriptionPropertyMap);
$fields[] = 'id';
$fields[] = 'uri';
Expand Down Expand Up @@ -1906,7 +1906,7 @@ function getSubscriptionsForUser($principalUri) {
* @param array $properties
* @return mixed
*/
function createSubscription($principalUri, $uri, array $properties) {
public function createSubscription($principalUri, $uri, array $properties) {
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
}
Expand Down Expand Up @@ -1969,7 +1969,7 @@ function createSubscription($principalUri, $uri, array $properties) {
* @param PropPatch $propPatch
* @return void
*/
function updateSubscription($subscriptionId, PropPatch $propPatch) {
public function updateSubscription($subscriptionId, PropPatch $propPatch) {
$supportedProperties = array_keys($this->subscriptionPropertyMap);
$supportedProperties[] = '{http://calendarserver.org/ns/}source';

Expand Down Expand Up @@ -2015,7 +2015,7 @@ function updateSubscription($subscriptionId, PropPatch $propPatch) {
* @param mixed $subscriptionId
* @return void
*/
function deleteSubscription($subscriptionId) {
public function deleteSubscription($subscriptionId) {
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent(
'\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
[
Expand Down Expand Up @@ -2061,7 +2061,7 @@ function deleteSubscription($subscriptionId) {
* @param string $objectUri
* @return array
*/
function getSchedulingObject($principalUri, $objectUri) {
public function getSchedulingObject($principalUri, $objectUri) {
$query = $this->db->getQueryBuilder();
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
->from('schedulingobjects')
Expand Down Expand Up @@ -2095,7 +2095,7 @@ function getSchedulingObject($principalUri, $objectUri) {
* @param string $principalUri
* @return array
*/
function getSchedulingObjects($principalUri) {
public function getSchedulingObjects($principalUri) {
$query = $this->db->getQueryBuilder();
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
->from('schedulingobjects')
Expand Down Expand Up @@ -2123,7 +2123,7 @@ function getSchedulingObjects($principalUri) {
* @param string $objectUri
* @return void
*/
function deleteSchedulingObject($principalUri, $objectUri) {
public function deleteSchedulingObject($principalUri, $objectUri) {
$query = $this->db->getQueryBuilder();
$query->delete('schedulingobjects')
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
Expand All @@ -2139,7 +2139,7 @@ function deleteSchedulingObject($principalUri, $objectUri) {
* @param string $objectData
* @return void
*/
function createSchedulingObject($principalUri, $objectUri, $objectData) {
public function createSchedulingObject($principalUri, $objectUri, $objectData) {
$query = $this->db->getQueryBuilder();
$query->insert('schedulingobjects')
->values([
Expand Down
Loading

0 comments on commit b5a30d5

Please sign in to comment.