Passed
Pull Request — 1 (#228)
by
unknown
03:38
created
src/AddToCampaignHandler_FormAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/CampaignAdminList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
src/AddToCampaignHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'));
Please login to merge, or discard this patch.
tests/php/CampaignAdminTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/CampaignAdmin.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         $form->addExtraClass('form--padded');
168 168
 
169 169
         // Set callback response
170
-        $form->setValidationResponseCallback(function () use ($form) {
170
+        $form->setValidationResponseCallback(function() use ($form) {
171 171
             $schemaId = $this->Link('schema/EditForm');
172 172
             return $this->getSchemaResponse($form, $schemaId);
173 173
         });
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 'baseClass' => DataObject::getSchema()->baseDataClass($class),
215 215
                 'singular' => $item->i18n_singular_name(),
216 216
                 'plural' => $item->i18n_plural_name(),
217
-                'noItemsText' => _t(__CLASS__.'.NOITEMSTEXT', 'Add items from the {section} section', [
217
+                'noItemsText' => _t(__CLASS__ . '.NOITEMSTEXT', 'Add items from the {section} section', [
218 218
                     'section' => $item->i18n_plural_name(),
219 219
                 ]),
220 220
                 'items' => []
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             'Created' => $changeSet->Created,
283 283
             'LastEdited' => $changeSet->LastEdited,
284 284
             'State' => $changeSet->State,
285
-            'StateLabel' => [ 'html' => $stateLabel ],
285
+            'StateLabel' => ['html' => $stateLabel],
286 286
             'IsInferred' => $changeSet->IsInferred,
287 287
             'canEdit' => $changeSet->canEdit(),
288 288
             'canPublish' => false,
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
             return [];
341 341
         }
342 342
 
343
-        $thumbnailWidth = (int)$this->config()->get('thumbnail_width');
344
-        $thumbnailHeight = (int)$this->config()->get('thumbnail_height');
343
+        $thumbnailWidth = (int) $this->config()->get('thumbnail_width');
344
+        $thumbnailHeight = (int) $this->config()->get('thumbnail_height');
345 345
         $hal = [
346 346
             '_links' => [
347 347
                 'self' => [
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             $changesets = $changesets->filter('IsInferred', 0);
422 422
         }
423 423
         return $changesets
424
-            ->filterByCallback(function ($item) {
424
+            ->filterByCallback(function($item) {
425 425
                 /** @var ChangeSet $item */
426 426
                 return ($item->canView());
427 427
             });
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
             /** @var ChangeSet $changeSet */
451 451
             $changeSet = ChangeSet::get()->filter('IsInferred', 0)->byID($request->param('ID'));
452 452
 
453
-            var_dump($request->param('ID'), " =====",  $changeSet);
453
+            var_dump($request->param('ID'), " =====", $changeSet);
454 454
 
455 455
             if (!$changeSet) {
456 456
                 return (new HTTPResponse(null, 404));
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
             'campaignEditForm',
632 632
             $fields,
633 633
             FieldList::create(
634
-                FormAction::create('save', _t(__CLASS__.'SAVE', 'Save'))
634
+                FormAction::create('save', _t(__CLASS__ . 'SAVE', 'Save'))
635 635
                     ->setIcon('save')
636 636
                     ->setSchemaState([
637 637
                         'data' => [
638
-                            'pristineTitle' => _t(__CLASS__.'SAVED', 'Saved'),
638
+                            'pristineTitle' => _t(__CLASS__ . 'SAVED', 'Saved'),
639 639
                             'pristineIcon' => 'tick',
640
-                            'dirtyTitle' => _t(__CLASS__.'SAVE', 'Save'),
640
+                            'dirtyTitle' => _t(__CLASS__ . 'SAVE', 'Save'),
641 641
                             'dirtyIcon' => 'save',
642 642
                             'pristineClass' => 'btn-outline-primary',
643 643
                             'dirtyClass' => '',
644 644
                         ],
645 645
                     ]),
646
-                FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel'))
646
+                FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel'))
647 647
                     ->setUseButtonTag(true)
648 648
             ),
649 649
             new RequiredFields('Name')
@@ -654,12 +654,12 @@  discard block
 block discarded – undo
654 654
 
655 655
         // Set form action handler with ID included
656 656
         $form->setRequestHandler(
657
-            LeftAndMainFormRequestHandler::create($form, [ $id ])
657
+            LeftAndMainFormRequestHandler::create($form, [$id])
658 658
         );
659 659
 
660 660
         // Configure form to respond to validation errors with form schema
661 661
         // if requested via react.
662
-        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $id, $record) {
662
+        $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $id, $record) {
663 663
             $schemaId = Controller::join_links(
664 664
                 $this->Link('schema'),
665 665
                 'campaignEditForm',
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
             'campaignCreateForm',
707 707
             $fields,
708 708
             FieldList::create(
709
-                FormAction::create('save', _t(__CLASS__.'.CREATE', 'Create'))
709
+                FormAction::create('save', _t(__CLASS__ . '.CREATE', 'Create'))
710 710
                     ->setIcon('plus'),
711
-                FormAction::create('cancel', _t(__CLASS__.'.CANCEL', 'Cancel'))
711
+                FormAction::create('cancel', _t(__CLASS__ . '.CANCEL', 'Cancel'))
712 712
                     ->setUseButtonTag(true)
713 713
             ),
714 714
             new RequiredFields('Name')
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 
722 722
         // Configure form to respond to validation errors with form schema
723 723
         // if requested via react.
724
-        $form->setValidationResponseCallback(function (ValidationResult $errors) use ($form, $record) {
724
+        $form->setValidationResponseCallback(function(ValidationResult $errors) use ($form, $record) {
725 725
             $schemaId = $this->Link('schema/campaignCreateForm');
726 726
             return $this->getSchemaResponse($schemaId, $form, $errors);
727 727
         });
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
                 return Security::permissionFailure($this);
751 751
             }
752 752
             if (!$record || !$record->ID) {
753
-                $this->httpError(404, "Bad record ID #" . (int)$id);
753
+                $this->httpError(404, "Bad record ID #" . (int) $id);
754 754
             }
755 755
         } else {
756 756
             if (!ChangeSet::singleton()->canCreate()) {
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
             $form->saveInto($record, true);
770 770
             $record->write();
771 771
             $this->extend('onAfterSave', $record);
772
-            $message = _t(__CLASS__.'.SAVEDUP', 'Saved.');
772
+            $message = _t(__CLASS__ . '.SAVEDUP', 'Saved.');
773 773
             $form->setMessage($message, ValidationResult::TYPE_GOOD);
774 774
         } else {
775
-            $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', [ 'Name' => $data['Name']]);
775
+            $nameDuplicateMsg = _t(__CLASS__ . '.ERROR_DUPLICATE_NAME', 'Name "{Name}" already exists', '', ['Name' => $data['Name']]);
776 776
             $errors = new ValidationResult();
777 777
             $errors->addFieldMessage('Name', $nameDuplicateMsg);
778
-            $message = _t(__CLASS__.'.SAVEDERROR', 'Error.');
778
+            $message = _t(__CLASS__ . '.SAVEDERROR', 'Error.');
779 779
             // Need to set the form message or the field message won't show up at all
780 780
             $form->setMessage($message, ValidationResult::TYPE_ERROR);
781 781
         }
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
                 ),
834 834
                 'category' => _t('SilverStripe\\Security\\Permission.CMS_ACCESS_CATEGORY', 'CMS Access'),
835 835
                 'help' => _t(
836
-                    __CLASS__.'.ACCESS_HELP',
836
+                    __CLASS__ . '.ACCESS_HELP',
837 837
                     'Allow viewing of the campaign publishing section.'
838 838
                 )
839 839
             )
Please login to merge, or discard this patch.