| @@ -14,7 +14,7 @@ | ||
| 14 | 14 |  { | 
| 15 | 15 | public function __construct() | 
| 16 | 16 |      { | 
| 17 | -        parent::__construct('addtocampaign', _t(__CLASS__.'.ADDTOCAMPAIGN', 'Add to Campaign')); | |
| 17 | +        parent::__construct('addtocampaign', _t(__CLASS__ . '.ADDTOCAMPAIGN', 'Add to Campaign')); | |
| 18 | 18 | $this->setUseButtonTag(false); | 
| 19 | 19 |          $this->addExtraClass('add-to-campaign-action'); | 
| 20 | 20 |          $this->addExtraClass('btn'); | 
| @@ -59,7 +59,7 @@ | ||
| 59 | 59 | "url" => $oneSetAction, | 
| 60 | 60 | "method" => "DELETE" | 
| 61 | 61 | ]; | 
| 62 | - $data['data']['editFormSchemaEndpoint'] = $schemaEndpoint; | |
| 62 | + $data['data']['editFormSchemaEndpoint'] = $schemaEndpoint; | |
| 63 | 63 | |
| 64 | 64 | // Set summary columns | 
| 65 | 65 | $columns = []; | 
| @@ -168,7 +168,7 @@ discard block | ||
| 168 | 168 |          $form->addExtraClass('form--padded'); | 
| 169 | 169 | |
| 170 | 170 | // Set callback response | 
| 171 | -        $form->setValidationResponseCallback(function () use ($form) { | |
| 171 | +        $form->setValidationResponseCallback(function() use ($form) { | |
| 172 | 172 |              $schemaId = $this->Link('schema/EditForm'); | 
| 173 | 173 | return $this->getSchemaResponse($form, $schemaId); | 
| 174 | 174 | }); | 
| @@ -215,7 +215,7 @@ discard block | ||
| 215 | 215 | 'baseClass' => DataObject::getSchema()->baseDataClass($class), | 
| 216 | 216 | 'singular' => $item->i18n_singular_name(), | 
| 217 | 217 | 'plural' => $item->i18n_plural_name(), | 
| 218 | -                'noItemsText' => _t(__CLASS__.'.NOITEMSTEXT', 'Add items from the {section} section', [ | |
| 218 | +                'noItemsText' => _t(__CLASS__ . '.NOITEMSTEXT', 'Add items from the {section} section', [ | |
| 219 | 219 | 'section' => $item->i18n_plural_name(), | 
| 220 | 220 | ]), | 
| 221 | 221 | 'items' => [] | 
| @@ -283,7 +283,7 @@ discard block | ||
| 283 | 283 | 'Created' => $changeSet->Created, | 
| 284 | 284 | 'LastEdited' => $changeSet->LastEdited, | 
| 285 | 285 | 'State' => $changeSet->State, | 
| 286 | - 'StateLabel' => [ 'html' => $stateLabel ], | |
| 286 | + 'StateLabel' => ['html' => $stateLabel], | |
| 287 | 287 | 'IsInferred' => $changeSet->IsInferred, | 
| 288 | 288 | 'canEdit' => $changeSet->canEdit(), | 
| 289 | 289 | 'canPublish' => false, | 
| @@ -338,8 +338,8 @@ discard block | ||
| 338 | 338 | return []; | 
| 339 | 339 | } | 
| 340 | 340 | |
| 341 | -        $thumbnailWidth = (int)$this->config()->get('thumbnail_width'); | |
| 342 | -        $thumbnailHeight = (int)$this->config()->get('thumbnail_height'); | |
| 341 | +        $thumbnailWidth = (int) $this->config()->get('thumbnail_width'); | |
| 342 | +        $thumbnailHeight = (int) $this->config()->get('thumbnail_height'); | |
| 343 | 343 | $hal = [ | 
| 344 | 344 | '_links' => [ | 
| 345 | 345 | 'self' => [ | 
| @@ -419,7 +419,7 @@ discard block | ||
| 419 | 419 |              $changesets = $changesets->filter('IsInferred', 0); | 
| 420 | 420 | } | 
| 421 | 421 | return $changesets | 
| 422 | -            ->filterByCallback(function ($item) { | |
| 422 | +            ->filterByCallback(function($item) { | |
| 423 | 423 | /** @var ChangeSet $item */ | 
| 424 | 424 | return ($item->canView()); | 
| 425 | 425 | }); | 
| @@ -626,19 +626,19 @@ discard block | ||
| 626 | 626 | 'campaignEditForm', | 
| 627 | 627 | $fields, | 
| 628 | 628 | FieldList::create( | 
| 629 | -                FormAction::create('save', _t(__CLASS__.'SAVE', 'Save')) | |
| 629 | +                FormAction::create('save', _t(__CLASS__ . 'SAVE', 'Save')) | |
| 630 | 630 |                      ->setIcon('save') | 
| 631 | 631 | ->setSchemaState([ | 
| 632 | 632 | 'data' => [ | 
| 633 | - 'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'), | |
| 633 | + 'pristineTitle' => _t(__CLASS__ . 'SAVED', 'Saved'), | |
| 634 | 634 | 'pristineIcon' => 'tick', | 
| 635 | - 'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'), | |
| 635 | + 'dirtyTitle' => _t(__CLASS__ . 'SAVE', 'Save'), | |
| 636 | 636 | 'dirtyIcon' => 'save', | 
| 637 | 637 | 'pristineClass' => 'btn-outline-primary', | 
| 638 | 638 | 'dirtyClass' => '', | 
| 639 | 639 | ], | 
| 640 | 640 | ]), | 
| 641 | -                FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) | |
| 641 | +                FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) | |
| 642 | 642 | ->setUseButtonTag(true) | 
| 643 | 643 | ), | 
| 644 | 644 |              new RequiredFields('Name') | 
| @@ -649,12 +649,12 @@ discard block | ||
| 649 | 649 | |
| 650 | 650 | // Set form action handler with ID included | 
| 651 | 651 | $form->setRequestHandler( | 
| 652 | - LeftAndMainFormRequestHandler::create($form, [ $id ]) | |
| 652 | + LeftAndMainFormRequestHandler::create($form, [$id]) | |
| 653 | 653 | ); | 
| 654 | 654 | |
| 655 | 655 | // Configure form to respond to validation errors with form schema | 
| 656 | 656 | // if requested via react. | 
| 657 | -        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $id, $record) { | |
| 657 | +        $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $id, $record) { | |
| 658 | 658 | $schemaId = Controller::join_links( | 
| 659 | 659 |                  $this->Link('schema'), | 
| 660 | 660 | 'campaignEditForm', | 
| @@ -701,9 +701,9 @@ discard block | ||
| 701 | 701 | 'campaignCreateForm', | 
| 702 | 702 | $fields, | 
| 703 | 703 | FieldList::create( | 
| 704 | -                FormAction::create('save', _t(__CLASS__.'.CREATE', 'Create')) | |
| 704 | +                FormAction::create('save', _t(__CLASS__ . '.CREATE', 'Create')) | |
| 705 | 705 |                      ->setIcon('plus'), | 
| 706 | -                FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel')) | |
| 706 | +                FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel')) | |
| 707 | 707 | ->setUseButtonTag(true) | 
| 708 | 708 | ), | 
| 709 | 709 |              new RequiredFields('Name') | 
| @@ -716,7 +716,7 @@ discard block | ||
| 716 | 716 | |
| 717 | 717 | // Configure form to respond to validation errors with form schema | 
| 718 | 718 | // if requested via react. | 
| 719 | -        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $record) { | |
| 719 | +        $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $record) { | |
| 720 | 720 |              $schemaId = $this->Link('schema/campaignCreateForm'); | 
| 721 | 721 | return $this->getSchemaResponse($schemaId, $form, $errors); | 
| 722 | 722 | }); | 
| @@ -745,7 +745,7 @@ discard block | ||
| 745 | 745 | return Security::permissionFailure($this); | 
| 746 | 746 | } | 
| 747 | 747 |              if (!$record || !$record->ID) { | 
| 748 | - $this->httpError(404, "Bad record ID #" . (int)$id); | |
| 748 | + $this->httpError(404, "Bad record ID #" . (int) $id); | |
| 749 | 749 | } | 
| 750 | 750 |          } else { | 
| 751 | 751 |              if (!ChangeSet::singleton()->canCreate()) { | 
| @@ -764,13 +764,13 @@ discard block | ||
| 764 | 764 | $form->saveInto($record, true); | 
| 765 | 765 | $record->write(); | 
| 766 | 766 |              $this->extend('onAfterSave', $record); | 
| 767 | - $message = _t(__CLASS__.'.SAVEDUP', 'Saved.'); | |
| 767 | + $message = _t(__CLASS__ . '.SAVEDUP', 'Saved.'); | |
| 768 | 768 | $form->setMessage($message, ValidationResult::TYPE_GOOD); | 
| 769 | 769 |          } else { | 
| 770 | -            $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', [ 'Name' => $data['Name']]); | |
| 770 | +            $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', ['Name' => $data['Name']]); | |
| 771 | 771 | $errors = new ValidationResult(); | 
| 772 | 772 |              $errors->addFieldMessage('Name', $nameDuplicateMsg); | 
| 773 | - $message = _t(__CLASS__.'.SAVEDERROR', 'Error.'); | |
| 773 | + $message = _t(__CLASS__ . '.SAVEDERROR', 'Error.'); | |
| 774 | 774 | // Need to set the form message or the field message won't show up at all | 
| 775 | 775 | $form->setMessage($message, ValidationResult::TYPE_ERROR); | 
| 776 | 776 | } | 
| @@ -828,7 +828,7 @@ discard block | ||
| 828 | 828 | ), | 
| 829 | 829 |                  'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access'), | 
| 830 | 830 | 'help' => _t( | 
| 831 | - __CLASS__.'.ACCESS_HELP', | |
| 831 | + __CLASS__ . '.ACCESS_HELP', | |
| 832 | 832 | 'Allow viewing of the campaign publishing section.' | 
| 833 | 833 | ) | 
| 834 | 834 | ) | 
| @@ -120,7 +120,7 @@ discard block | ||
| 120 | 120 | 'State' => ChangeSet::STATE_OPEN, | 
| 121 | 121 | 'IsInferred' => 0 | 
| 122 | 122 | ]) | 
| 123 | -            ->filterByCallback(function ($item) { | |
| 123 | +            ->filterByCallback(function($item) { | |
| 124 | 124 | /** @var ChangeSet $item */ | 
| 125 | 125 | return $item->canView(); | 
| 126 | 126 | }); | 
| @@ -158,7 +158,7 @@ discard block | ||
| 158 | 158 | */ | 
| 159 | 159 | protected function getObject($id, $class) | 
| 160 | 160 |      { | 
| 161 | - $id = (int)$id; | |
| 161 | + $id = (int) $id; | |
| 162 | 162 | $class = ClassInfo::class_name($class); | 
| 163 | 163 | |
| 164 | 164 | if (!$class | 
| @@ -456,7 +456,7 @@ discard block | ||
| 456 | 456 |          if (is_array($data) && !empty($data['Campaign'])) { | 
| 457 | 457 | $campaignID = $data['Campaign']; | 
| 458 | 458 |          } elseif (is_numeric($data)) { | 
| 459 | - $campaignID = (int)$data; | |
| 459 | + $campaignID = (int) $data; | |
| 460 | 460 | } | 
| 461 | 461 |          if (empty($campaignID)) { | 
| 462 | 462 | throw $this->validationResult(_t(__CLASS__ . '.NONE_SELECTED', 'No campaign selected')); | 
| @@ -94,7 +94,7 @@ discard block | ||
| 94 | 94 | $results = $this->callProtectedMethod($admin, 'getListItems'); | 
| 95 | 95 | $this->assertDOSEquals( | 
| 96 | 96 | [ | 
| 97 | - [ 'Name' => 'changeset 1' ], | |
| 97 | + ['Name' => 'changeset 1'], | |
| 98 | 98 | ], | 
| 99 | 99 | $results | 
| 100 | 100 | ); | 
| @@ -104,8 +104,8 @@ discard block | ||
| 104 | 104 | $results = $this->callProtectedMethod($admin, 'getListItems'); | 
| 105 | 105 | $this->assertDOSEquals( | 
| 106 | 106 | [ | 
| 107 | - [ 'Name' => 'changeset 1' ], | |
| 108 | - [ 'Name' => 'changeset 2' ], | |
| 107 | + ['Name' => 'changeset 1'], | |
| 108 | + ['Name' => 'changeset 2'], | |
| 109 | 109 | ], | 
| 110 | 110 | $results | 
| 111 | 111 | ); | 
| @@ -115,10 +115,10 @@ discard block | ||
| 115 | 115 | $results = $this->callProtectedMethod($admin, 'getListItems'); | 
| 116 | 116 | $this->assertDOSEquals( | 
| 117 | 117 | [ | 
| 118 | - [ 'Name' => 'changeset 1' ], | |
| 119 | - [ 'Name' => 'changeset 2' ], | |
| 120 | - [ 'Name' => 'changeset 3' ], | |
| 121 | - [ 'Name' => 'changeset 4' ], | |
| 118 | + ['Name' => 'changeset 1'], | |
| 119 | + ['Name' => 'changeset 2'], | |
| 120 | + ['Name' => 'changeset 3'], | |
| 121 | + ['Name' => 'changeset 4'], | |
| 122 | 122 | ], | 
| 123 | 123 | $results | 
| 124 | 124 | ); | 
| @@ -128,8 +128,8 @@ discard block | ||
| 128 | 128 | $results = $this->callProtectedMethod($admin, 'getListItems'); | 
| 129 | 129 | $this->assertDOSEquals( | 
| 130 | 130 | [ | 
| 131 | - [ 'Name' => 'changeset 1' ], | |
| 132 | - [ 'Name' => 'changeset 3' ], | |
| 131 | + ['Name' => 'changeset 1'], | |
| 132 | + ['Name' => 'changeset 3'], | |
| 133 | 133 | ], | 
| 134 | 134 | $results | 
| 135 | 135 | ); | 
| @@ -177,7 +177,7 @@ discard block | ||
| 177 | 177 | $user = $this->objFromFixture(Member::class, 'mock_user'); | 
| 178 | 178 | $this->logInAs($user); | 
| 179 | 179 | |
| 180 | - $request->setRouteParams([ 'ID' => '1', 'Name' => 'show']); | |
| 180 | + $request->setRouteParams(['ID' => '1', 'Name' => 'show']); | |
| 181 | 181 | $response = $campaignAdmin->readCampaign($request); | 
| 182 | 182 | $status = $response->getStatusCode(); | 
| 183 | 183 | |