Skip to content

Commit 2d317ea

Browse files
authored
Merge pull request #58 from ConvertKit/1.0-beta
1.0
2 parents 7dd82ea + ac00175 commit 2d317ea

33 files changed

+5324
-2989
lines changed

.env.dist.testing

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CONVERTKIT_API_BROADCAST_ID="8697158"
2+
CONVERTKIT_API_FORM_ID="2765139"
3+
CONVERTKIT_API_LEGACY_FORM_URL="https://app.convertkit.com/landing_pages/470099"
4+
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
5+
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103"
6+
CONVERTKIT_API_SEQUENCE_ID="1030824"
7+
CONVERTKIT_API_TAG_NAME="wordpress"
8+
CONVERTKIT_API_TAG_ID="2744672"
9+
CONVERTKIT_API_SUBSCRIBER_EMAIL="[email protected]"
10+
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"

.env.example

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CONVERTKIT_API_KEY_NO_DATA=
2+
CONVERTKIT_API_SECRET_NO_DATA=
3+
CONVERTKIT_API_KEY=
4+
CONVERTKIT_API_SECRET=
5+
CONVERTKIT_API_BROADCAST_ID="8697158"
6+
CONVERTKIT_API_FORM_ID="2765139"
7+
CONVERTKIT_API_LEGACY_FORM_URL="https://app.convertkit.com/landing_pages/470099"
8+
CONVERTKIT_API_LANDING_PAGE_URL="https://cheerful-architect-3237.ck.page/cc5eb21744"
9+
CONVERTKIT_API_LEGACY_LANDING_PAGE_URL="https://app.convertkit.com/landing_pages/470103"
10+
CONVERTKIT_API_SEQUENCE_ID="1030824"
11+
CONVERTKIT_API_TAG_NAME="wordpress"
12+
CONVERTKIT_API_TAG_ID="2744672"
13+
CONVERTKIT_API_SUBSCRIBER_EMAIL="[email protected]"
14+
CONVERTKIT_API_SUBSCRIBER_ID="1579118532"

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Bug report
2+
description: Create a report to help us improve
3+
labels: ["bug"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this bug report!
9+
- type: textarea
10+
id: what-happened
11+
attributes:
12+
label: Describe the bug
13+
description: A clear and concise description of what the bug is.
14+
placeholder: Tell us what you see!
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: repro-steps
19+
attributes:
20+
label: To Reproduce
21+
description: Steps to reproduce the behavior
22+
placeholder: |
23+
1. Fetch a '...'
24+
2. Update the '....'
25+
3. See error
26+
validations:
27+
required: true
28+
- type: textarea
29+
id: expected-behavior
30+
attributes:
31+
label: Expected behavior
32+
description: A clear and concise description of what you expected to happen.
33+
validations:
34+
required: true
35+
- type: textarea
36+
id: code-snippets
37+
attributes:
38+
label: Code snippets
39+
description: If applicable, add code snippets to help explain your problem.
40+
render: PHP
41+
validations:
42+
required: false
43+
- type: input
44+
id: os
45+
attributes:
46+
label: OS
47+
placeholder: macOS
48+
validations:
49+
required: true
50+
- type: input
51+
id: language-version
52+
attributes:
53+
label: PHP version
54+
placeholder: PHP 8.1
55+
validations:
56+
required: true
57+
- type: input
58+
id: lib-version
59+
attributes:
60+
label: Library version
61+
placeholder: v1.0.0
62+
validations:
63+
required: true
64+
- type: textarea
65+
id: additional-context
66+
attributes:
67+
label: Additional context
68+
description: Add any other context about the problem here.
69+
validations:
70+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: ConvertKit support
4+
url: https://convertkit.com/support/
5+
about: |
6+
Please only file issues here that you believe represent actual bugs or feature requests for the ConvertKit PHP SDK.
7+
8+
If you're having general trouble with your ConvertKit integration, please reach out to support.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Feature request
2+
description: Suggest an idea for this PHP SDK
3+
labels: ["feature-request"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
Thanks for taking the time to fill out this feature request!
9+
- type: textarea
10+
id: problem
11+
attributes:
12+
label: Is your feature request related to a problem? Please describe.
13+
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
14+
- type: textarea
15+
id: solution
16+
attributes:
17+
label: Describe the solution you'd like
18+
description: A clear and concise description of what you want to happen.
19+
- type: textarea
20+
id: alternatives
21+
attributes:
22+
label: Describe alternatives you've considered
23+
description: A clear and concise description of any alternative solutions or features you've considered.
24+
- type: textarea
25+
id: context
26+
attributes:
27+
label: Additional context
28+
description: Add any other context about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Summary
2+
3+
A brief description of what this PR adds, changes or fixes.
4+
5+
If it is adding functionality, a use case of why this is needed helps determine its suitability.
6+
7+
## Testing
8+
9+
Not sure how to perform testing, or perhaps didn't include a test in this PR? Walk through the following in order for a beginner-friendly guide:
10+
- [Setup](SETUP.md) - setting up your local environment for development and testing
11+
- [Development](DEVELOPMENT.md) - best practices for development
12+
- [Testing](TESTING.md) - how to write and run tests
13+
14+
## Checklist
15+
16+
* [ ] I have [written a test](TESTING.md#writing-a-test) and included it in this PR
17+
* [ ] I have [run all tests](TESTING.md#run-tests) and they pass
18+
* [ ] The code passes when [running the PHP CodeSniffer](TESTING.md#run-php-codesniffer)
19+
* [ ] The code passes when [running PHPStan](TESTING.md#run-phpstan)
20+
* [ ] I have assigned a reviewer or two to review this PR (if you're not sure who to assign, we can do this step for you)

.github/docs/coding-standards.png

108 KB
Loading

.github/docs/new-release.png

180 KB
Loading

.github/docs/phpstan.png

99.4 KB
Loading

.github/phpdoc-template/class.md.twig

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{% block content %}
2+
# {{ node.name }}
3+
4+
{% if node.summary %}{{ node.summary|raw }}{% endif %}
5+
{% if node.description %}{{ node.description|raw }}{% endif %}
6+
7+
* Full name: `{{ node.FullyQualifiedStructuralElementName }}`
8+
{% if node.parent and node.parent is not empty %}* Parent class: {{ macros.mdClassLink(node.parent, macros.mdClassPath(node), node.parent.FullyQualifiedStructuralElementName) }}
9+
{% endif %}
10+
{% if node.final %}* This class is marked as **final** and can't be subclassed
11+
{% endif %}
12+
{% if node.deprecated %}* **Warning:** this class is **deprecated**. This means that this class will likely be removed in a future version.
13+
{% endif %}
14+
{% if node.interfaces is not empty %}
15+
* This class implements:
16+
{% for interface in node.interfaces %}
17+
{% if loop.index0 > 0 %}{{ ', ' }}{% endif %}{{ macros.mdClassLink(interface, macros.mdClassPath(node), interface) }}{% endfor %}
18+
19+
{% endif %}
20+
{% if node.abstract %}* This class is an **Abstract class**
21+
{% endif %}
22+
{% if node.final %}* This class is a **Final class**
23+
{% endif %}
24+
25+
{% if node.tags.see is not empty or node.tags.link is not empty %}
26+
**See Also:**
27+
28+
{% for see in node.tags.see %}
29+
* {{ see.reference }} {% if see.description %}- {{ see.description|raw }}{% endif %}
30+
31+
{% endfor %}
32+
{% for link in node.tags.link %}
33+
* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description|raw }}{% endif %}
34+
35+
{% endfor %}
36+
37+
{% endif %}{# node.tags.see || node.tags.link #}
38+
{% if node.constants | length > 0 %}
39+
## Constants
40+
41+
| Constant | Visibility | Type | Value |
42+
|:---------|:-----------|:-----|:------|
43+
{% for constant in node.constants %}
44+
|`{{constant.name}}`|{{ constant.visibility | default('*default*') }}|{{constant.type | default(' ')}}|{{constant.value}}|
45+
{% endfor %}
46+
{% endif %}
47+
{% if node.properties | length > 0 %}
48+
## Properties
49+
50+
{% for property in node.properties %}
51+
{% include 'property.md.twig' %}
52+
{% endfor %}
53+
{% endif %}
54+
{% if node.methods|length > 0 %}
55+
## Methods
56+
57+
{% for method in node.methods %}
58+
{% include 'method.md.twig' %}
59+
{% endfor %}
60+
{% endif %}{# if methods #}
61+
62+
{% if node.InheritedMethods|length > 0 %}
63+
## Inherited methods
64+
65+
{% for method in node.InheritedMethods %}
66+
{% include 'method.md.twig' %}
67+
{% endfor %}
68+
69+
{% endif %}{# if InheritedMethods #}
70+
71+
{% endblock %}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
### {{ method.name }}
2+
3+
{{ method.summary | raw }}
4+
5+
{# Method signature #}
6+
```php
7+
{% if method.final %}{{ 'final' ~ ' ' }}{% endif %}{{ method.visibility ~ ' ' }}{%if method.static%}{{ 'static' ~ ' ' }}{% endif %}{{ method.name }}({% for argument in method.arguments %}
8+
{{- argument.type | raw }}
9+
{{- argument.byReference ? '&' }} $
10+
{{- argument.name | raw }}{% if argument.default %} = {{ argument.default | raw }}{% endif %}
11+
{%- if not loop.last %}, {% endif %}
12+
{%- endfor %}): {{ method.response.type | raw }}
13+
```
14+
{% if method.description %}{{ method.description | raw }}{% endif %}
15+
{% if method.static %}* This method is **static**.{% endif %}
16+
{% if method.abstract %}* This method is **abstract**.{% endif %}
17+
{% if method.final %}* This method is **final**.{% endif %}
18+
{% if method.deprecated %}* **Warning:** this method is **deprecated**. This means that this method will likely be removed in a future version.
19+
{% endif %}
20+
21+
{% if method.arguments is not empty %}
22+
23+
**Parameters:**
24+
25+
| Parameter | Type | Description |
26+
|-----------|------|-------------|
27+
{% for argument in method.arguments %}
28+
| `{{ '$' ~ argument.name }}` | **{{ argument.type ? argument.type | default(' ') | replace({'|': '\\|'}) | raw }}** | {{ argument.description | replace({'|': '\\|'}) | nl2br | replace({"\n": "", "\r": "", "\t": ""}) | raw }} |
29+
{% endfor %}
30+
{% endif %}{# method.arguments is not empty #}
31+
{% if method.response.description and method.response.description is not empty %}
32+
33+
**Return Value:**
34+
35+
{{ method.response.description | raw }}
36+
{% endif %}
37+
38+
{% if method.tags.see is not empty or method.tags.link is not empty %}
39+
**See Also:**
40+
41+
{% for see in method.tags.see %}
42+
* {{ see.reference }} {% if see.description is not empty %}- {{ see.description | raw }}{% endif %}
43+
{% endfor %}
44+
{% for link in method.tags.link %}
45+
* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %}
46+
{% endfor %}
47+
48+
{% endif %}{# method.tags.see || method.tags.link #}
49+
50+
---
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### {{ property.name }}
2+
3+
{{ property.summary | raw }}
4+
5+
```php
6+
{{ property.visibility ~ ' ' }}{% if property.static %}{{ 'static' ~ ' ' }}{% endif %}{% if property.type and property.type is not empty %}{{ property.type ~ ' ' }}{% endif %}{{ '$' ~ property.name }}
7+
```
8+
9+
{% if property.description %}{{ property.description | raw }}{% endif %}
10+
{% if property.static %}* This property is **static**.{% endif %}
11+
{% if property.deprecated %}* **Warning:** this property is **deprecated**. This means that this property will likely be removed in a future version.{% endif %}
12+
{% if property.tags.see is not empty or property.tags.link is not empty %}
13+
{% for see in property.tags.see %}
14+
* {{ see.reference }} {% if see.description %}- {{ see.description | raw }}{% endif %}
15+
{% endfor %}
16+
{% for link in property.tags.link %}
17+
* {{ link.link }} {% if link.description and link.description != link.link %}- {{ link.description | raw }}{% endif %}
18+
{% endfor %}
19+
{% endif %}

.github/phpdoc-template/template.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<template>
3+
<name>markdown</name>
4+
<author>Sakri Koskimies</author>
5+
<email>[email protected]</email>
6+
<version>0.0.2</version>
7+
<transformations>
8+
<transformation writer="twig" query="indexes.classes" source="class.md.twig"
9+
artifact="classes/{{FullyQualifiedStructuralElementName}}.md"/>
10+
</transformations>
11+
<parameters>
12+
<parameter key="twig-debug">true</parameter>
13+
</parameters>
14+
</template>

.github/workflows/tests.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Run Tests
2+
3+
# When to run tests.
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
tests:
15+
# Name.
16+
name: PHP ${{ matrix.php-versions }}
17+
18+
# Virtual Environment to use.
19+
# @see: https://github.com/actions/virtual-environments
20+
runs-on: ubuntu-latest
21+
22+
# Defines PHP Versions matrix to run tests on
23+
strategy:
24+
matrix:
25+
php-versions: [ '7.4', '8.0', '8.1', '8.2' ]
26+
27+
# Steps to install, configure and run tests
28+
steps:
29+
# Checkout (copy) this repository's Plugin to this VM.
30+
- name: Checkout Code
31+
uses: actions/checkout@v3
32+
33+
# Install PHP version
34+
- name: Install PHP
35+
uses: shivammathur/setup-php@v2
36+
with:
37+
php-version: ${{ matrix.php-versions }}
38+
coverage: none
39+
40+
# Write any secrets, such as API keys, to the .env.dist.testing file now.
41+
# Make sure your committed .env.dist.testing file ends with a newline.
42+
# The formatting of the contents to include a blank newline is deliberate.
43+
- name: Define GitHub Secrets in .env.dist.testing
44+
uses: DamianReeves/[email protected]
45+
with:
46+
path: .env.dist.testing
47+
contents: |
48+
49+
CONVERTKIT_API_KEY=${{ secrets.CONVERTKIT_API_KEY }}
50+
CONVERTKIT_API_SECRET=${{ secrets.CONVERTKIT_API_SECRET }}
51+
CONVERTKIT_API_KEY_NO_DATA=${{ secrets.CONVERTKIT_API_KEY_NO_DATA }}
52+
CONVERTKIT_API_SECRET_NO_DATA=${{ secrets.CONVERTKIT_API_SECRET_NO_DATA }}
53+
write-mode: append
54+
55+
# Rename .env.dist.testing to .env, so PHPUnit reads it for tests.
56+
- name: Rename .env.dist.testing to .env
57+
run: mv .env.dist.testing .env
58+
59+
# Installs PHPUnit, PHP CodeSniffer and anything else needed to run tests.
60+
- name: Run Composer
61+
run: composer update
62+
63+
# Generate autoloader
64+
- name: Build PHP Autoloader
65+
run: composer dump-autoload
66+
67+
# Run Coding Standards.
68+
- name: Run Coding Standards
69+
run: php vendor/bin/phpcs --standard=phpcs.xml
70+
71+
# Run Coding Standards on Tests.
72+
- name: Run Coding Standards on Tests
73+
run: php vendor/bin/phpcs --standard=phpcs.tests.xml
74+
75+
# Run PHPUnit Tests.
76+
- name: Run PHPUnit Tests
77+
run: vendor/bin/phpunit --verbose --stop-on-failure

0 commit comments

Comments
 (0)