Skip to content

Commit

Permalink
Format and signature changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Garethp committed Jul 6, 2015
1 parent f8fd8fe commit 8eacb14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
17 changes: 8 additions & 9 deletions src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class API
* @param string $name
* @return Calendar
*/
public function getCalendar($name='default.calendar')
public function getCalendar($name = 'default.calendar')
{
$calendar = new Calendar();
$calendar->setClient($this->getClient());
Expand Down Expand Up @@ -135,7 +135,7 @@ public function getFolderByFolderId($folderId)
));
}

public function getFolderByDisplayName($folderName, $parentFolder='root', $options=array())
public function getFolderByDisplayName($folderName, $parentFolder = 'root', $options = array())
{
$request = array(
'Traversal' => 'Shallow',
Expand All @@ -155,15 +155,14 @@ public function getFolderByDisplayName($folderName, $parentFolder='root', $opti
$folders = $response->ResponseMessages->FindFolderResponseMessage->RootFolder->Folders;
$types = get_object_vars($folders);

foreach($types as $type) {
if(!is_array($type) && is_object($type) && $type->DisplayName == $folderName) {
foreach ($types as $type) {
if (!is_array($type) && is_object($type) && $type->DisplayName == $folderName) {
return $type;
}

if(is_array($type)) {
foreach($type as $folder)
{
if($folder->DisplayName == $folderName) {
if (is_array($type)) {
foreach ($type as $folder) {
if ($folder->DisplayName == $folderName) {
return $folder;
}
}
Expand All @@ -181,7 +180,7 @@ public function getFolderByDisplayName($folderName, $parentFolder='root', $opti
* @param array $options
* @return mixed
*/
public function listChanges($folderId, $syncState = null, $options = array())
public function listItemChanges($folderId, $syncState = null, $options = array())
{
$request = array(
'ItemShape' => array('BaseShape' => 'IdOnly'),
Expand Down
11 changes: 5 additions & 6 deletions src/Calendar/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ class Calendar extends API
{
protected $_folderId;

public function pickCalendar($displayName='default.calendar')
public function pickCalendar($displayName = 'default.calendar')
{
if($displayName == 'default.calendar') {
if ($displayName == 'default.calendar') {
$folder = $this->getFolderByDistinguishedId('calendar')->CalendarFolder;
}
else {
} else {
$folder = $this->getFolderByDisplayName($displayName, 'calendar');
}

Expand All @@ -38,7 +37,7 @@ public function pickCalendar($displayName='default.calendar')
public function createCalendarItems($items)
{
//If the item passed in is an object, or if it's an assosiative array waiting to be an object, let's put it in to an array
if(!is_array($items) || Type::arrayIsAssoc($items)) {
if (!is_array($items) || Type::arrayIsAssoc($items)) {
$items = array($items);
}

Expand Down Expand Up @@ -113,6 +112,6 @@ public function getCalendarItems($start = '12:00 AM', $end = '11:59 PM', $option
*/
public function listChanges($syncState = null, $options = array())
{
return parent::listChanges($this->_folderId->Id, $syncState, $options);
return parent::listItemChanges($this->_folderId->Id, $syncState, $options);
}
}

0 comments on commit 8eacb14

Please sign in to comment.