From 9158dd702aae6ea9b8d71ea89a3bba99a6aa20f7 Mon Sep 17 00:00:00 2001 From: Stephen Binns Date: Mon, 20 Aug 2018 16:00:10 +0100 Subject: [PATCH] Fix line length violations --- cronofy.php | 42 +++++++++++++++++++++---------- ruleset.xml | 6 +++++ tests/ApplicationCalendarTest.php | 15 ++++++++++- tests/CronofyTest.php | 25 ++++++++++++------ 4 files changed, 67 insertions(+), 21 deletions(-) diff --git a/cronofy.php b/cronofy.php index fa3e8ea..7830173 100644 --- a/cronofy.php +++ b/cronofy.php @@ -240,7 +240,9 @@ public function getAuthorizationURL($params) $scope_list = rawurlencode(join(" ", $params['scope'])); - $url = $this->app_root_url . "/oauth/authorize?response_type=code&client_id=" . $this->client_id . "&redirect_uri=" . urlencode($params['redirect_uri']) . "&scope=" . $scope_list; + $url = $this->app_root_url . "/oauth/authorize?response_type=code&client_id=" + . $this->client_id . "&redirect_uri=" . urlencode($params['redirect_uri']) . "&scope=" . $scope_list; + if (!empty($params['state'])) { $url.="&state=" . $params['state']; } @@ -270,7 +272,10 @@ public function getEnterpriseConnectAuthorizationUrl($params) $scope_list = rawurlencode(join(" ", $params['scope'])); $delegated_scope_list = rawurlencode(join(" ", $params['delegated_scope'])); - $url = $this->app_root_url . "/enterprise_connect/oauth/authorize?response_type=code&client_id=" . $this->client_id . "&redirect_uri=" . urlencode($params['redirect_uri']) . "&scope=" . $scope_list . "&delegated_scope=" . $delegated_scope_list; + $url = $this->app_root_url . "/enterprise_connect/oauth/authorize?response_type=code&client_id=" + . $this->client_id . "&redirect_uri=" . urlencode($params['redirect_uri']) . "&scope=" + . $scope_list . "&delegated_scope=" . $delegated_scope_list; + if (!empty($params['state'])) { $url.="&state=" . rawurlencode($params['state']); } @@ -435,14 +440,22 @@ public function read_events($params) Date from : The minimum date from which to return events. Defaults to 16 days in the past. OPTIONAL Date to : The date to return events up until. Defaults to 201 days in the future. OPTIONAL String tzid : A string representing a known time zone identifier from the IANA Time Zone Database. REQUIRED - Boolean include_deleted : Indicates whether to include or exclude events that have been deleted. Defaults to excluding deleted events. OPTIONAL - Boolean include_moved: Indicates whether events that have ever existed within the given window should be included or excluded from the results. Defaults to only include events currently within the search window. OPTIONAL - Time last_modified : The Time that events must be modified on or after in order to be returned. Defaults to including all events regardless of when they were last modified. OPTIONAL - Boolean include_managed : Indiciates whether events that you are managing for the account should be included or excluded from the results. Defaults to include only non-managed events. OPTIONAL - Boolean only_managed : Indicates whether only events that you are managing for the account should be included in the results. OPTIONAL - Array calendar_ids : Restricts the returned events to those within the set of specified calendar_ids. Defaults to returning events from all of a user's calendars. OPTIONAL - Boolean localized_times : Indicates whether the events should have their start and end times returned with any available localization information. Defaults to returning start and end times as simple Time values. OPTIONAL - Boolean include_geo : Indicates whether the events should have their location's latitude and longitude returned where available. OPTIONAL + Boolean include_deleted : Indicates whether to include or exclude events that have been deleted. + Defaults to excluding deleted events. OPTIONAL + Boolean include_moved: Indicates whether events that have ever existed within the given window should be + included or excluded from the results. Defaults to only include events currently within the search window. OPTIONAL + Time last_modified : The Time that events must be modified on or after in order to be returned. + Defaults to including all events regardless of when they were last modified. OPTIONAL + Boolean include_managed : Indiciates whether events that you are managing for the account should be included + or excluded from the results. Defaults to include only non-managed events. OPTIONAL + Boolean only_managed : Indicates whether only events that you are managing for the account should be included + in the results. OPTIONAL + Array calendar_ids : Restricts the returned events to those within the set of specified calendar_ids. + Defaults to returning events from all of a user's calendars. OPTIONAL + Boolean localized_times : Indicates whether the events should have their start and end times returned with any + available localization information. Defaults to returning start and end times as simple Time values. OPTIONAL + Boolean include_geo : Indicates whether the events should have their location's latitude and longitude + returned where available. OPTIONAL returns $result - Array of events */ @@ -457,9 +470,12 @@ public function free_busy($params) Date from : The minimum date from which to return free-busy information. Defaults to 16 days in the past. OPTIONAL Date to : The date to return free-busy information up until. Defaults to 201 days in the future. OPTIONAL String tzid : A string representing a known time zone identifier from the IANA Time Zone Database. REQUIRED - Boolean include_managed : Indiciates whether events that you are managing for the account should be included or excluded from the results. Defaults to include only non-managed events. OPTIONAL - Array calendar_ids : Restricts the returned free-busy information to those within the set of specified calendar_ids. Defaults to returning free-busy information from all of a user's calendars. OPTIONAL - Boolean localized_times : Indicates whether the free-busy information should have their start and end times returned with any available localization information. Defaults to returning start and end times as simple Time values. OPTIONAL + Boolean include_managed : Indiciates whether events that you are managing for the account should be included or + excluded from the results. Defaults to include only non-managed events. OPTIONAL + Array calendar_ids : Restricts the returned free-busy information to those within the set of specified calendar_ids. + Defaults to returning free-busy information from all of a user's calendars. OPTIONAL + Boolean localized_times : Indicates whether the free-busy information should have their start and end times returned + with any available localization information. Defaults to returning start and end times as simple Time values. OPTIONAL returns $result - Array of events */ diff --git a/ruleset.xml b/ruleset.xml index 6f9f704..8c3059b 100644 --- a/ruleset.xml +++ b/ruleset.xml @@ -5,6 +5,12 @@ + + + + + + diff --git a/tests/ApplicationCalendarTest.php b/tests/ApplicationCalendarTest.php index a698c93..1d51caf 100644 --- a/tests/ApplicationCalendarTest.php +++ b/tests/ApplicationCalendarTest.php @@ -13,7 +13,20 @@ public function testCreateApplicationCalendar() "application_calendar_id" => $application_calendar_id, ); - $token_response = '{"token_type":"bearer","access_token":"fffff","expires_in":3600,"refresh_token":"2222","scope":"read_write","application_calendar_id":"my-unique-string","sub":"apc_567236000909002","linking_profile":{"provider_name":"cronofy","profile_id":"pro_n23kjnwrw2","profile_name":"n23kjnwrw2"}}'; + $token_response = '{ + "token_type":"bearer", + "access_token":"fffff", + "expires_in":3600, + "refresh_token":"2222", + "scope":"read_write", + "application_calendar_id":"my-unique-string", + "sub":"apc_567236000909002", + "linking_profile":{ + "provider_name":"cronofy", + "profile_id":"pro_n23kjnwrw2", + "profile_name":"n23kjnwrw2" + } + }'; $http = $this->createMock('HttpRequest'); $http->expects($this->once()) diff --git a/tests/CronofyTest.php b/tests/CronofyTest.php index 007a1b4..c28a98a 100644 --- a/tests/CronofyTest.php +++ b/tests/CronofyTest.php @@ -14,7 +14,8 @@ public function testAuthorizationUrl() ); $auth = $cronofy->getAuthorizationURL($params); - $this->assertEquals("https://app.cronofy.com/oauth/authorize?response_type=code&client_id=clientId&redirect_uri=http%3A%2F%2Fyoursite.dev%2Foauth2%2Fcallback&scope=read_account%20list_calendars", $auth); + $this->assertEquals("https://app.cronofy.com/oauth/authorize?response_type=code&client_id=clientId" + . "&redirect_uri=http%3A%2F%2Fyoursite.dev%2Foauth2%2Fcallback&scope=read_account%20list_calendars", $auth); } public function testErrorHandling() @@ -50,12 +51,9 @@ public function testErrorHandling() $raised_error = false; - try - { + try { $cronofy->create_calendar($args); - } - catch (CronofyException $exception) - { + } catch (CronofyException $exception) { $raised_error = true; $this->assertEquals(json_decode($error_response, true), $exception->error_details()); $this->assertEquals(422, $exception->getCode()); @@ -74,7 +72,20 @@ public function testRequestToken() "redirect_uri" => "http://example.com", ); - $token_response = '{"token_type":"bearer","access_token":"fffff","expires_in":3600,"refresh_token":"2222","scope":"read_write","application_calendar_id":"my-unique-string","sub":"apc_567236000909002","linking_profile":{"provider_name":"cronofy","profile_id":"pro_n23kjnwrw2","profile_name":"n23kjnwrw2"}}'; + $token_response = '{ + "token_type":"bearer", + "access_token":"fffff", + "expires_in":3600, + "refresh_token":"2222", + "scope":"read_write", + "application_calendar_id":"my-unique-string", + "sub":"apc_567236000909002", + "linking_profile":{ + "provider_name":"cronofy", + "profile_id":"pro_n23kjnwrw2", + "profile_name":"n23kjnwrw2" + } + }'; $http = $this->createMock('HttpRequest'); $http->expects($this->once())