Skip to content

Commit

Permalink
Fix line length violations
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenbinns committed Aug 20, 2018
1 parent a9a2bdf commit 9158dd7
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 21 deletions.
42 changes: 29 additions & 13 deletions cronofy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down Expand Up @@ -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']);
}
Expand Down Expand Up @@ -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
*/
Expand All @@ -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
*/
Expand Down
6 changes: 6 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
<exclude name="PSR1.Classes.ClassDeclaration"/>
</rule>
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="180"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>

<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
</ruleset>
15 changes: 14 additions & 1 deletion tests/ApplicationCalendarTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
25 changes: 18 additions & 7 deletions tests/CronofyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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());
Expand All @@ -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())
Expand Down

0 comments on commit 9158dd7

Please sign in to comment.