From 98c125360bb496d91292007632503ae0a5516508 Mon Sep 17 00:00:00 2001 From: helpfulrobot Date: Wed, 18 Nov 2015 16:38:28 +1300 Subject: [PATCH] Converted to PSR-2 --- code/extensions/SiteTreeContentReview.php | 24 +++++++++++------------ code/reports/PagesDueForReviewReport.php | 2 +- tests/ContentReviewSettingsTest.php | 24 +++++++++++------------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/code/extensions/SiteTreeContentReview.php b/code/extensions/SiteTreeContentReview.php index 15fc6cc..d6c0d3e 100644 --- a/code/extensions/SiteTreeContentReview.php +++ b/code/extensions/SiteTreeContentReview.php @@ -352,7 +352,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider $userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap) ->setMultiple(true) - ->addExtraClass('custom-setting') + ->addExtraClass('custom-setting') ->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users")) ->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews')); @@ -365,7 +365,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider $groupField = ListboxField::create("OwnerGroups", _t("ContentReview.PAGEOWNERGROUPS", "Groups"), $groupsMap) ->setMultiple(true) - ->addExtraClass('custom-setting') + ->addExtraClass('custom-setting') ->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups")) ->setDescription(_t("ContentReview.OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews")); @@ -376,11 +376,11 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider ->setDescription(_t("ContentReview.NEXTREVIEWDATADESCRIPTION", "Leave blank for no review")); $reviewFrequency = DropdownField::create( - "ReviewPeriodDays", - _t("ContentReview.REVIEWFREQUENCY", "Review frequency"), - self::get_schedule() - ) - ->addExtraClass('custom-setting') + "ReviewPeriodDays", + _t("ContentReview.REVIEWFREQUENCY", "Review frequency"), + self::get_schedule() + ) + ->addExtraClass('custom-setting') ->setDescription(_t("ContentReview.REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published")); $notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create()); @@ -519,7 +519,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider protected function setDefaultReviewDateForCustom() { - // Don't overwrite existing value + // Don't overwrite existing value if ($this->owner->NextReviewDate) { return; } @@ -536,10 +536,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider protected function setDefaultReviewDateForInherited() { - // Don't overwrite existing value - if($this->owner->NextReviewDate) { - return; - } + // Don't overwrite existing value + if ($this->owner->NextReviewDate) { + return; + } $options = $this->getOptions(); $nextDate = null; diff --git a/code/reports/PagesDueForReviewReport.php b/code/reports/PagesDueForReviewReport.php index 96e2004..acfdaef 100644 --- a/code/reports/PagesDueForReviewReport.php +++ b/code/reports/PagesDueForReviewReport.php @@ -167,7 +167,7 @@ class PagesDueForReviewReport extends SS_Report if (!empty($params["OnlyMyPages"])) { $currentUser = Member::currentUser(); - $records = $records->filterByCallback(function($page) use ($currentUser) { + $records = $records->filterByCallback(function ($page) use ($currentUser) { $options = $page->getOptions(); foreach ($options->ContentReviewOwners() as $owner) { diff --git a/tests/ContentReviewSettingsTest.php b/tests/ContentReviewSettingsTest.php index 6d5e55c..ad10951 100644 --- a/tests/ContentReviewSettingsTest.php +++ b/tests/ContentReviewSettingsTest.php @@ -68,16 +68,16 @@ class ContentReviewSettingsTest extends SapphireTest public function testAdvanceReviewFromInheritedSettings() { - // When a parent page is advanced, the next review date of the child is not automatically advanced + // When a parent page is advanced, the next review date of the child is not automatically advanced $parentPage = $this->objFromFixture("Page", "page-1"); - $this->assertTrue($parentPage->advanceReviewDate()); - $parentPage->write(); - + $this->assertTrue($parentPage->advanceReviewDate()); + $parentPage->write(); + $page = $this->objFromFixture("Page", "page-1-1"); - $this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate); - $this->assertEquals('2011-04-12', $page->NextReviewDate); + $this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate); + $this->assertEquals('2011-04-12', $page->NextReviewDate); - // When a sub page is advanced, the next review date is advanced by the number of days in the parent + // When a sub page is advanced, the next review date is advanced by the number of days in the parent $this->assertTrue($page->advanceReviewDate()); $page->write(); $this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $page->NextReviewDate); @@ -185,7 +185,7 @@ class ContentReviewSettingsTest extends SapphireTest public function testGetNextReviewDateFromPageInheritedSetting() { - // Although page-1-1 inherits from page-1, it has an independent review date + // Although page-1-1 inherits from page-1, it has an independent review date $page = $this->objFromFixture("Page", "page-1-1"); $nextReviewDate = $page->getReviewDate(); $this->assertInstanceOf("Date", $nextReviewDate); @@ -242,7 +242,7 @@ class ContentReviewSettingsTest extends SapphireTest /** @var Page|SiteTreeContentReview $childPage */ $childPage = $this->objFromFixture("Page", "page-1-1"); - // Parent and child pages have different review dates + // Parent and child pages have different review dates $this->assertNotEquals($parentPage->NextReviewDate, $childPage->NextReviewDate); // But if we change the parent page ReviewPeriodDays to 10, the childs stays the same @@ -262,9 +262,9 @@ class ContentReviewSettingsTest extends SapphireTest $this->assertEquals('2011-04-12', $childPage->NextReviewDate); $this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $parentPage->NextReviewDate); - // Reviewing the child page should, however, advance its review by 10 days - $childPage->advanceReviewDate(); - $childPage->write(); + // Reviewing the child page should, however, advance its review by 10 days + $childPage->advanceReviewDate(); + $childPage->write(); $this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $childPage->NextReviewDate); }