Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to change request contents #16

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions src/Facade/Requests/CalDAVRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,31 @@
* Class CalDAVRequestFactory
* @package CalDAVClient\Facade\Requests
*/
final class CalDAVRequestFactory
final class CalDAVRequestFactory implements ICalDAVRequestFactory
{
const PrincipalRequestType = 'PRINCIPAL';
const CalendarHomeRequestType = 'CALENDAR_HOME';
const CalendarsRequestType = 'CALENDARS';
const CalendarRequestType = 'CALENDAR';
const CalendarSyncRequestType = 'CALENDAR_SYNC';
const CalendarMultiGetRequestType = 'CALENDAR_MULTIGET';
const CalendarQueryRequestType = 'CALENDAR_QUERY';
const CalendarCreateRequestType = 'CREATE_CALENDAR';
const EventCreateRequestType = 'CREATE_EVENT';
const EventUpdateRequestType = 'UPDATE_EVENT';

private function __construct(){}

/**
* @var CalDAVRequestFactory
* @var ICalDAVRequestFactory
*/
private static $instance;

/**
* @return CalDAVRequestFactory
* @return ICalDAVRequestFactory
*/
public static function getInstance(){
if(is_null(self::$instance)) self::$instance = new CalDAVRequestFactory();
return self::$instance;
}

/**
* Override which class is used to create new request objects.
* @param ICalDAVRequestFactory $factory
*/
public static function setInstance(ICalDAVRequestFactory $factory) {
self::$instance = $factory;
}

/**
* @param string $type
* @param array $params
Expand Down
40 changes: 40 additions & 0 deletions src/Facade/Requests/ICalDAVRequestFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php namespace CalDAVClient\Facade\Requests;
/**
* Copyright 2019 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

/**
* Interface ICalDAVRequestFactory
* @package CalDAVClient\Facade\Requests
*/
interface ICalDAVRequestFactory {
const PrincipalRequestType = 'PRINCIPAL';
const CalendarHomeRequestType = 'CALENDAR_HOME';
const CalendarsRequestType = 'CALENDARS';
const CalendarRequestType = 'CALENDAR';
const CalendarSyncRequestType = 'CALENDAR_SYNC';
const CalendarMultiGetRequestType = 'CALENDAR_MULTIGET';
const CalendarQueryRequestType = 'CALENDAR_QUERY';
const CalendarCreateRequestType = 'CREATE_CALENDAR';
const EventCreateRequestType = 'CREATE_EVENT';
const EventUpdateRequestType = 'UPDATE_EVENT';

/**
* Builds a request of a certain type.
*
* @param string $type
* @param array $params
* @return IAbstractWebDAVRequest|null
* @throws \InvalidArgumentException
*/
public function build($type, $params = []);
}
14 changes: 14 additions & 0 deletions src/Facade/Responses/GenericSinglePROPFINDCalDAVResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ public function getHRef()
return isset($this->content['response']['href']) ? $this->content['response']['href'] : null;
}

/**
* @return array
*/
public function getFoundProps() {
return $this->found_props;
}

/**
* @return array
*/
public function getNotFoundProps() {
return $this->not_found_props;
}

/**
* @return bool
*/
Expand Down