Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve get_resource() #32

Merged
merged 10 commits into from
Mar 6, 2023
28 changes: 2 additions & 26 deletions .env.dist.testing
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
CONVERTKIT_API_FORM_NAME="Page Form"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_FORM_FORMAT_MODAL_NAME="Modal Form"
CONVERTKIT_API_FORM_FORMAT_MODAL_ID="2780977"
CONVERTKIT_API_FORM_FORMAT_SLIDE_IN_NAME="Slide In Form"
CONVERTKIT_API_FORM_FORMAT_STICKY_BAR_NAME="Sticky Bar Form"
CONVERTKIT_API_LANDING_PAGE_NAME="Landing Page"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_NAME="Character Encoding"
CONVERTKIT_API_LEGACY_FORM_NAME="Legacy Form"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LEGACY_FORM_SHORTCODE="[convertkit form=5281783]"
CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME="Legacy Landing Page"
CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103"
CONVERTKIT_API_LEGACY_FORM_URL="https://app.convertkit.com/landing_pages/470099"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103"
CONVERTKIT_API_PRODUCT_NAME="Newsletter Subscription"
CONVERTKIT_API_PRODUCT_ID="36377"
CONVERTKIT_API_PRODUCT_URL="https://cheerful-architect-3237.ck.page/products/newsletter-subscription"
CONVERTKIT_API_SEQUENCE_ID="1030824"
CONVERTKIT_API_TAG_NAME="wordpress"
CONVERTKIT_API_TAG_ID="2744672"
CONVERTKIT_API_SUBSCRIBER_EMAIL="optin@n7studios.com"
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"
CONVERTKIT_API_SIGNED_SUBSCRIBER_ID=eyJfcmFpbHMiOnsibWVzc2FnZSI6Ik1UVTNPVEV4T0RVek1nPT0iLCJleHAiOiIyMDIzLTA0LTA5VDEzOjQwOjUyLjc4MVoiLCJwdXIiOiJzdWJzY3JpYmVyIn19--418e0d2247825e721492d2155b2adff6f6a4d43c936b60deee715c7bd2256627
CONVERTKIT_API_SIGNED_SUBSCRIBER_ID_NO_ACCESS=eyJfcmFpbHMiOnsibWVzc2FnZSI6Ik1Ua3lNVFV6TkRjMk1nPT0iLCJleHAiOiIyMDIzLTA1LTA4VDEzOjQ0OjU0LjA4MFoiLCJwdXIiOiJzdWJzY3JpYmVyIn19--b35cf133da4d8e875589e02bae179729875c5edb893df122b6905f66c63acac8
CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME="Third Party Integrations Form"
CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_ID="3003590"
CONVERTKIT_API_COMMERCE_JS_URL="https://cheerful-architect-3237.ck.page/commerce.js"
CONVERTKIT_API_BROADCAST_FIRST_URL="https://cheerful-architect-3237.ck.page/posts/paid-subscriber-broadcast"
CONVERTKIT_API_BROADCAST_FIRST_TITLE="Paid Subscriber Broadcast"
CONVERTKIT_API_BROADCAST_SECOND_URL="https://cheerful-architect-3237.ck.page/posts/broadcast-2"
CONVERTKIT_API_BROADCAST_SECOND_TITLE="Broadcast 2"
28 changes: 2 additions & 26 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,11 @@ CONVERTKIT_API_KEY_NO_DATA=
CONVERTKIT_API_SECRET_NO_DATA=
CONVERTKIT_API_KEY=
CONVERTKIT_API_SECRET=
CONVERTKIT_API_FORM_NAME="Page Form"
CONVERTKIT_API_FORM_ID="2765139"
CONVERTKIT_API_FORM_FORMAT_MODAL_NAME="Modal Form"
CONVERTKIT_API_FORM_FORMAT_MODAL_ID="2780977"
CONVERTKIT_API_FORM_FORMAT_SLIDE_IN_NAME="Slide In Form"
CONVERTKIT_API_FORM_FORMAT_STICKY_BAR_NAME="Sticky Bar Form"
CONVERTKIT_API_LANDING_PAGE_NAME="Landing Page"
CONVERTKIT_API_LANDING_PAGE_ID="2765196"
CONVERTKIT_API_LANDING_PAGE_CHARACTER_ENCODING_NAME="Character Encoding"
CONVERTKIT_API_LEGACY_FORM_NAME="Legacy Form"
CONVERTKIT_API_LEGACY_FORM_ID="470099"
CONVERTKIT_API_LEGACY_FORM_SHORTCODE="[convertkit form=5281783]"
CONVERTKIT_API_LEGACY_LANDING_PAGE_NAME="Legacy Landing Page"
CONVERTKIT_API_LEGACY_LANDING_PAGE_ID="470103"
CONVERTKIT_API_LEGACY_FORM_URL="https://app.convertkit.com/landing_pages/470099"
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103"
CONVERTKIT_API_PRODUCT_NAME="Newsletter Subscription"
CONVERTKIT_API_PRODUCT_ID="36377"
CONVERTKIT_API_PRODUCT_URL="https://cheerful-architect-3237.ck.page/products/newsletter-subscription"
CONVERTKIT_API_SEQUENCE_ID="1030824"
CONVERTKIT_API_TAG_NAME="wordpress"
CONVERTKIT_API_TAG_ID="2744672"
CONVERTKIT_API_SUBSCRIBER_EMAIL="optin@n7studios.com"
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"
CONVERTKIT_API_SIGNED_SUBSCRIBER_ID=eyJfcmFpbHMiOnsibWVzc2FnZSI6Ik1UVTNPVEV4T0RVek1nPT0iLCJleHAiOiIyMDIzLTA0LTA5VDEzOjQwOjUyLjc4MVoiLCJwdXIiOiJzdWJzY3JpYmVyIn19--418e0d2247825e721492d2155b2adff6f6a4d43c936b60deee715c7bd2256627
CONVERTKIT_API_SIGNED_SUBSCRIBER_ID_NO_ACCESS=eyJfcmFpbHMiOnsibWVzc2FnZSI6Ik1Ua3lNVFV6TkRjMk1nPT0iLCJleHAiOiIyMDIzLTA1LTA4VDEzOjQ0OjU0LjA4MFoiLCJwdXIiOiJzdWJzY3JpYmVyIn19--b35cf133da4d8e875589e02bae179729875c5edb893df122b6905f66c63acac8
CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_NAME="Third Party Integrations Form"
CONVERTKIT_API_THIRD_PARTY_INTEGRATIONS_FORM_ID="3003590"
CONVERTKIT_API_COMMERCE_JS_URL="https://cheerful-architect-3237.ck.page/commerce.js"
CONVERTKIT_API_BROADCAST_FIRST_URL="https://cheerful-architect-3237.ck.page/posts/paid-subscriber-broadcast"
CONVERTKIT_API_BROADCAST_FIRST_TITLE="Paid Subscriber Broadcast"
CONVERTKIT_API_BROADCAST_SECOND_URL="https://cheerful-architect-3237.ck.page/posts/broadcast-2"
CONVERTKIT_API_BROADCAST_SECOND_TITLE="Broadcast 2"
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ jobs:
- name: Build PHP Autoloader
run: composer dump-autoload

# Run Coding Standards.
- name: Run Coding Standards
run: php vendor/bin/phpcs --standard=phpcs.xml

# Run Coding Standards on Tests.
- name: Run Coding Standards on Tests
run: php vendor/bin/phpcs --standard=phpcs.tests.xml
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
"autoload": {
"psr-4": {
"ConvertKit_API\\": "src/"
},
"classmap": [
"src/lib/"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
58 changes: 58 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>Coding Standards</description>

<!-- Inspect files in the /src folder -->
<file>src</file>

<!-- Run in verbose mode and specify the precise rule that failed in output -->
<arg value="sv"/>
<arg name="colors"/>

<!-- Use PSR-12 -->
<rule ref="PSR12">
<!-- Exclude function not in camel caps format, to avoid breaking changes -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />

<!-- Don't require spacing after header block -->
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock" />

<!-- Permit else if over elseif -->
<exclude name="PSR2.ControlStructures.ElseIfDeclaration.NotAllowed" />
</rule>

<!-- Use Squiz -->
<rule ref="Squiz">
<!-- Exclude "Class found in ".php" file; use ".inc" extension instead" -->
<exclude name="Squiz.Files.FileExtension.ClassFound" />

<!-- Exclude PascalCase format for class name, to avoid breaking changes -->
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps" />

<!-- Exclude variable naming, to avoid breaking changes -->
<exclude name="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps" />
<exclude name="Squiz.NamingConventions.ValidVariableName.NotCamelCaps" />
<exclude name="Squiz.NamingConventions.ValidFunctionName.ScopeNotCamelCaps" />

<!-- Allow implicit true and false comparisons -->
<exclude name="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue" />
<exclude name="Squiz.Operators.ComparisonOperatorUsage.NotAllowed" />

<!-- Don't require // end comments after each function, or Author / Copyright tags -->
<exclude name="Squiz.Commenting.ClosingDeclarationComment.Missing" />
<exclude name="Squiz.Commenting.FileComment.IncorrectAuthor" />
<exclude name="Squiz.Commenting.FileComment.MissingCopyrightTag" />

<!-- Permit inline if statements -->
<exclude name="Squiz.PHP.DisallowInlineIf.Found" />

<!-- Don't require various newlines and spacing before and after functions -->
<exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.After" />
<exclude name="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose" />
<exclude name="Squiz.WhiteSpace.MemberVarSpacing.FirstIncorrect" />

<!-- Permit padding surrounding a concat operator -->
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound" />
</rule>
</ruleset>
Loading