Skip to content

Commit 27d0755

Browse files
committed
Renaming etc
1 parent 79aeeb7 commit 27d0755

6 files changed

+13
-68
lines changed

Diff for: composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "triggerfish/ajax",
2+
"name": "triggerfish/rest-ajax",
33
"type": "wordpress-plugin",
44
"license": "MIT",
55
"homepage": "https://www.triggerfish.se",
@@ -15,7 +15,7 @@
1515
],
1616
"autoload": {
1717
"psr-4": {
18-
"Triggerfish\\Ajax\\": "src/"
18+
"Triggerfish\\REST_Ajax\\": "src/"
1919
}
2020
},
2121
"require": {

Diff for: phpcs.xml

+3-58
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
<?xml version="1.0"?>
2-
<ruleset name="Roots">
3-
<description>Roots Coding Standards</description>
2+
<ruleset name="Triggerfish">
3+
<description>Triggerfish Coding Standards</description>
44

55
<!-- Scan these files -->
6-
<file>resources/functions.php</file>
7-
<file>resources/index.php</file>
8-
<file>app</file>
9-
<file>resources/views</file>
6+
<file>.</file>
107

118
<!-- Show colors in console -->
129
<arg value="-colors"/>
@@ -16,56 +13,4 @@
1613

1714
<!-- Use PSR-2 as a base -->
1815
<rule ref="PSR2"/>
19-
20-
<!-- Exclusions below are for resources/views/ folder -->
21-
22-
<!-- Allow php files without any PHP in them -->
23-
<rule ref="Internal.NoCodeFound">
24-
<exclude-pattern>resources/views</exclude-pattern>
25-
</rule>
26-
27-
<!-- Allow braces on same line for named functions -->
28-
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
29-
<exclude-pattern>resources/views</exclude-pattern>
30-
</rule>
31-
32-
<!-- Allow closing braces to be on the same line -->
33-
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace">
34-
<exclude-pattern>resources/views</exclude-pattern>
35-
</rule>
36-
37-
<!-- Disable newline after opening brace -->
38-
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
39-
<exclude-pattern>resources/views</exclude-pattern>
40-
</rule>
41-
42-
<!-- Allow multiple PHP statements in the same line -->
43-
<rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
44-
<exclude-pattern>resources/views</exclude-pattern>
45-
</rule>
46-
47-
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
48-
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
49-
<exclude-pattern>resources/views</exclude-pattern>
50-
</rule>
51-
52-
<!-- Don't require a blank line after the last `use` -->
53-
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse">
54-
<exclude-pattern>resources/views</exclude-pattern>
55-
</rule>
56-
57-
<!-- Allow long lines -->
58-
<rule ref="Generic.Files.LineLength.TooLong">
59-
<exclude-pattern>resources/views</exclude-pattern>
60-
</rule>
61-
62-
<!-- Ignore indentation rules -->
63-
<rule ref="Generic.WhiteSpace.ScopeIndent">
64-
<exclude-pattern>resources/views</exclude-pattern>
65-
</rule>
66-
67-
<!-- Allow PHP closing tags -->
68-
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
69-
<exclude-pattern>resources/views</exclude-pattern>
70-
</rule>
7116
</ruleset>

Diff for: sage-ajax.php renamed to rest-ajax-plugin.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
declare(strict_types=1);
33

44
/*
5-
Plugin Name: Sage Ajax
5+
Plugin Name: REST Ajax
66
Author: Triggerfish
77
Author URI: https://www.triggerfish.se/
88
License: MIT License
99
*/
1010

11-
add_action('rest_api_init', ['Triggerfish\Ajax\Ajax', 'registerRESTRoute']);
11+
add_action('rest_api_init', ['Triggerfish\REST_Ajax\Controller', 'registerRESTRoute']);

Diff for: src/AbstractAjaxHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Triggerfish\Ajax;
4+
namespace Triggerfish\REST_Ajax;
55

66
use WP_REST_Request;
77

Diff for: src/AjaxHandlerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Triggerfish\Ajax;
4+
namespace Triggerfish\REST_Ajax;
55

66
interface AjaxHandlerInterface
77
{

Diff for: src/Ajax.php renamed to src/Controller.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
namespace Triggerfish\Ajax;
4+
namespace Triggerfish\REST_Ajax;
55

66
use WP_REST_Server;
77
use WP_REST_Request;
@@ -52,7 +52,7 @@
5252
* The data from 1 or 2 will be injected as the template will be included with the App\template function.
5353
*/
5454

55-
class Ajax
55+
class Controller
5656
{
5757
const REST_NAMESPACE = 'theme/v1';
5858
const REST_ROUTE = 'ajax';
@@ -202,9 +202,9 @@ protected static function hasClassBasedHandler(string $action): bool
202202
return false;
203203
}
204204

205-
if (! is_subclass_of(self::getActionClass($action), 'Triggerfish\Ajax\AbstractAjaxHandler')) {
205+
if (! is_subclass_of(self::getActionClass($action), 'Triggerfish\REST_Ajax\AbstractAjaxHandler')) {
206206
trigger_error(
207-
sprintf('%s must extend class Triggerfish\Ajax\AbstractAjaxHandler.', self::getActionClass($action)),
207+
sprintf('%s must extend class Triggerfish\REST_Ajax\AbstractAjaxHandler.', self::getActionClass($action)),
208208
E_USER_ERROR
209209
);
210210
}

0 commit comments

Comments
 (0)