Skip to content

Commit

Permalink
[smarcet]
Browse files Browse the repository at this point in the history
* fixed some issues from scrutinizer
  • Loading branch information
smarcet committed Mar 3, 2018
1 parent 416e54e commit 1f9fcca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 5 additions & 3 deletions src/Facade/CalDavClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ final class CalDavClient implements ICalDavClient

const CalendarAccessOption = 'calendar-access';

const DefaultAuthType = 'basic';

/**
* @var string
*/
Expand All @@ -80,7 +82,7 @@ final class CalDavClient implements ICalDavClient
/**
* @var string
*/
private $authtype = "basic";
private $authtype = self::DefaultAuthType;

/**
* @var Client
Expand All @@ -97,9 +99,9 @@ final class CalDavClient implements ICalDavClient
* @param string $server_url
* @param string|null $user
* @param string|null $password
* @param string|"basic" $authtype
* @param string $authtype
*/
public function __construct($server_url, $user = null, $password = null, $authtype = "basic")
public function __construct($server_url, $user = null, $password = null, $authtype = self::DefaultAuthType)
{
$this->server_url = $server_url;
$this->user = $user;
Expand Down
9 changes: 4 additions & 5 deletions src/Facade/Responses/CalendarSyncInfoResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ public function hasAvailableChanges(){
return count($this->responses) > 0;
}


/**
* @return ETagEntityResponse[]
*/
public function getUpdates(){
$res = [];
foreach ($this->responses as $entity){
if($entity->getStatus() != HttpResponse::HttpOKStatus) continue;
$res[] = $entity;
if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpOKStatus) continue;
$res[] = $entity;
}
return $res;
}
Expand All @@ -52,8 +51,8 @@ public function getUpdates(){
public function getDeletes(){
$res = [];
foreach ($this->responses as $entity){
if($entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue;
$res[] = $entity;
if($entity instanceof ETagEntityResponse && $entity->getStatus() != HttpResponse::HttpNotFoundStatus) continue;
$res[] = $entity;
}
return $res;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Facade/Responses/EventCreatedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class EventCreatedResponse extends HttpResponse
* @param int $etag
* @param string $resource_url
* @param string $body
* @param string $code
* @param int $code
*/
public function __construct($uid, $etag, $resource_url, $body, $code)
{
Expand Down

0 comments on commit 1f9fcca

Please sign in to comment.