Skip to content

Commit

Permalink
Merge pull request #7 from cnizzardini/cakephp-5
Browse files Browse the repository at this point in the history
Cakephp 5 support
  • Loading branch information
cnizzardini authored Jan 7, 2024
2 parents 8f04d83 + 61f9bee commit 95ba7ac
Show file tree
Hide file tree
Showing 25 changed files with 573 additions and 104 deletions.
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Attachments**
If applicable, add screenshots or swagger.json

**Version and Platform (please complete the following information):**
- OS/Platform: [e.g. Linux]
- CakePHP: [e.g. 4.0.4]
- SwaggerBake Version:

**Additional context**
Add any other context about the problem here.
42 changes: 42 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Merge Master

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1']

name: Upload coverage report
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, xdebug
tools: composer:v2
coverage: xdebug

- name: Composer Check
run: composer validate

- name: Install
run: |
composer install --prefer-dist --no-interaction --no-progress
cp config/.env.example config/.env
cp config/app_local.example.php config/app_local.php
- name: Coverage Report
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=clover.xml
php-coveralls --coverage_clover=clover.xml -v
95 changes: 95 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Pull Request

on:
pull_request:

jobs:
analyze:
name: PHP 8.1 Test / Analysis / Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, xdebug, sqlite3

- name: PHP Version
run: php -v

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer self-update
composer validate
composer install --prefer-dist --no-progress
- name: Static Analysis
run: composer analyze
- name: Coverage Report
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
export CODECOVERAGE=1 && vendor/bin/phpunit --coverage-clover=clover.xml
php-coveralls --coverage_clover=clover.xml -v
test:
name: PHP 8.3 Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, intl, xdebug, sqlite3

- name: PHP Version
run: php -v

- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: |
composer self-update
composer validate
composer install --prefer-dist --no-progress
- name: Test Suite
run: |
composer test
#
# CakePHP version compatability
#
cakephp_version_compatibility:
name: CakePHP ${{ matrix.version }} Test
runs-on: ubuntu-latest
strategy:
matrix:
version: ['~5.0']
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, sqlite3

- name: PHP Version
run: php -v

- name: CakePHP ${{matrix.version}} Compatability
run: |
composer self-update
rm -rf composer.lock
composer require cakephp/cakephp:${{matrix.version}} --no-update
composer install --prefer-dist --no-progress
composer test
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
# MixerAPI Core

[![Latest Version on Packagist](https://img.shields.io/packagist/v/mixerapi/core.svg?style=flat-square)](https://packagist.org/packages/mixerapi/core)
[![Build](https://github.com/mixerapi/mixerapi-dev/workflows/Build/badge.svg?branch=master)](https://github.com/mixerapi/mixerapi-dev/actions?query=workflow%3ABuild)
[![Coverage Status](https://coveralls.io/repos/github/mixerapi/mixerapi-dev/badge.svg?branch=master)](https://coveralls.io/github/mixerapi/mixerapi-dev?branch=master)
[![Build](https://github.com/mixerapi/core/workflows/Build/badge.svg?branch=master)](https://github.com/mixerapi/core/actions?query=workflow%3ABuild)
[![Coverage Status](https://coveralls.io/repos/github/mixerapi/core/badge.svg?branch=master)](https://coveralls.io/github/mixerapi/core?branch=master)
[![MixerApi](https://img.shields.io/badge/mixer-api-red?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAFyHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarVdpsjMnDPzPKXIEkBDLcVircoMcP81qe977tlQ89sCwiFa3EGPV/vm7q7/wIR20suKDi85pfGy0kRIqQa9PnHej7bzvB30qH+1Kt91BaGKUvB592uMT2uU14axh8me7CruHwjZkruH54bHyqNd3kGin1W7sNhQ3IheDf4eat6GyB04o+2cvrFWMZ/XR4MFSFSzERI0Na9yJNwJev4RfmHfCOMMWdWJWKIQPEhDy4d5lVr8T9EHyqakn+4f7J/mU9gh+cOmOau77DiOPdr7r0/vCfBHRZ0eLx9RXknuvofe2vEvWgVG3I2qSbY4ZDMygnOc0h8vjJ6j7eUVcQSddIHnVRWdcxURDUKUrY001yXTTZllMAURLjTxKokI82wJ7ilR46YTLdPIcuUJB4kJNMaOZLhYz141zvWICVq4GQ8nAmMGUH17qZ51/cqney6DIDDLb4gq4aMQ1YAzlxh2jIIjpWzeZBJ9ry6/fAguhCgVl0hzgYNJ5mchiXrHFU2fGOEG5tpBRvm4DoAhrC8AYhgLaGRbjjPZE3hjwGCBQAnJiSxkKGBGqAEmW2ZHyFGisjTnezLEk5Gg0IzdBCGHHHtpEThDLWkH8eBsQQ0lYrIg48RKUREmOnXXinPNuJLnk2Vsv3nnvg48+BQ42SHDBhxBiSJEi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GlRDY9+fgAgCxCN5MiGwBBraAAIAThPTo19xN4y7weA66YoBjIQzkdOPbtYvZnLXKIUBeftno67TWB0OwzzlwfIxfP+IdPlJAsXwhkAp0L534Ol18S7w8drzLnFF+Dc+q22qud9ZcU9Sqle3/V0R/xIMAwAxvJy15uy0kVKaY5hGEttrS1RlgYYC0s+wrkTAOyKoiuKMijLcqzv9MlmRXEeiMVWfAX7K8PuZLJfkqRVm83W/rDzkV/IjCKykuyq3LRarbDZbFNtrS0RtztfAgCHwwFFUWYkSfKoqrqiaVptBmAkNirStRSd+GqaJgDsTlmlFosl3V7Tdd1x/lzTFwDIAChjoUw9u+BVVbWXc57X/fiJX9M0iGLmuBYJIcMAQCl1UwAY9NbWGIZ+VUi9qSBZd2p1gRtL8XijLMtuQkiFLMtgjEUBaITg1tH6Y3aAiAwAksRsBM/+iTNY5yruuBOIN18Lz8/PdxcWFoJSCgAJznmk8eyZaGqaGTbg9Retm8blXPInLZUUw15QgLV8903vwOu+sVAQHLiUCiSqOnuGttzBqz2+aVkQioTsSfxXzJUHui3nu2WXJ7Sv8/44APwG3yPg36V3p7wAAAAASUVORK5CYII=)](http://mixerapi.com)
[![CakePHP](https://img.shields.io/badge/cakephp-^4.2-red?logo=cakephp)](https://book.cakephp.org/4/en/index.html)
[![Minimum PHP Version](https://img.shields.io/badge/php-^8.0-8892BF.svg?logo=php)](https://php.net/)
[![CakePHP](https://img.shields.io/badge/cakephp-^5.0-red?logo=cakephp)](https://book.cakephp.org/4/en/index.html)
[![Minimum PHP Version](https://img.shields.io/badge/php-^8.1-8892BF.svg?logo=php)](https://php.net/)

Core library for easily sharing commonly used classes and utilities across MixerAPI plugins.
Core library for easily sharing commonly used classes and utilities across MixerAPI plugins. There is likely
minimal value installing this package without the full mixerapi plugin.

This branch is for CakePHP 5.x only. Supported versions:

| Version | Branch | Cake Version | PHP Version |
|---------|------------------------------------------------|--------------|-------------|
| 2.* | master | ^5.0 | ^8.1 |
| 1.* | [v1](https://github.com/mixerapi/core/tree/v1) | ^4.2 | ^8.0 |

## Installation

```console
composer require mixerapi/core
```

See the CakePHP documentation for [loading plugins](https://book.cakephp.org/5/en/plugins.html).

### Event Listener Loader

The Event Listener Loader will automatically load all listeners which implement `Cake\Event\EventListenerInterface`
Expand Down
42 changes: 36 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
{
"name": "mixerapi/core",
"description": "MixerAPI Core libraries",
"type": "library",
"type": "cakephp-plugin",
"license": "MIT",
"keywords": ["mixerapi","cakephp"],
"require": {
"php": "^8.0",
"cakephp/cakephp": "^4.2",
"thecodingmachine/class-explorer": "^1.1"
"php": "^8.1",
"cakephp/cakephp": "^5.0",
"kcs/class-finder": "^0.3"
},
"require-dev": {
"cakephp/cakephp-codesniffer": "^5.0",
"phpmd/phpmd": "^2.10",
"phpstan/phpstan": "^1.8.5",
"phpunit/phpunit": "^10"
},
"autoload": {
"psr-4": {
"MixerApi\\Core\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MixerApi\\Core\\Test\\": "tests/",
"MixerApi\\Core\\Test\\App\\": "tests/test_app/src/"
}
},
"support": {
"issues": "https://github.com/mixerapi/mixerapi-dev/issues",
"issues": "https://github.com/mixerapi/core/issues",
"source": "https://github.com/mixerapi/core"
},
"authors": [
{
"name": "MixerApi",
"role": "Organization"
}
]
],
"scripts": {
"analyze": [
"@phpcs",
"@phpstan",
"@phpmd"
],
"phpcs": "phpcs --colors -p --standard=phpcs.xml src/",
"phpcbf": "phpcbf --colors --standard=phpcs.xml src/",
"phpstan": "phpstan analyse src/",
"test": "phpunit --colors=always",
"phpmd": "phpmd src/ ansi phpmd.xml",
"coverage": "phpunit --coverage-html coverage-reports/"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
5 changes: 5 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0"?>
<ruleset name="App">
<config name="installed_paths" value="../../cakephp/cakephp-codesniffer" />
<rule ref="CakePHP"/>
</ruleset>
91 changes: 91 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0"?>
<ruleset>

<description>SwaggerBake Ruleset</description>
<!-- Warnings may be suppressed using the @SuppressWarning(PHPMD) annotation -->
<!-- Rues are imported individually to allow for easy configuration -->
<!-- Property names and values can be found here: http://phpmd.org/rules/index.html -->

<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<properties>
<property name="ignore-whitespace" value="true" />
<property name="minimum" value="100" />
</properties>
</rule>

<rule ref="rulesets/controversial.xml/Superglobals" />

<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<properties>
<property name="maximum" value="25" />
</properties>
</rule>
<rule ref="rulesets/design.xml/DepthOfInheritance" />
<rule ref="rulesets/design.xml/EvalExpression" />
<rule ref="rulesets/design.xml/ExitExpression" />
<rule ref="rulesets/design.xml/GotoStatement" />
<rule ref="rulesets/design.xml/NumberOfChildren" />

<rule ref="rulesets/naming.xml/BooleanGetMethodName">
<properties>
<property name="checkParameterizedMethods" value="true" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ConstantNamingConventions" />
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<property name="maximum" value="64" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
<rule ref="rulesets/controversial.xml/CamelCaseParameterName" />
<rule ref="rulesets/controversial.xml/CamelCaseMethodName" />
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="12" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" /> <!-- phpmd default is max: 50 -->
<rule ref="rulesets/codesize.xml/ExcessiveClassLength">
<properties>
<property name="minimum" value="500" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods" />
<rule ref="rulesets/codesize.xml/NPathComplexity" />
<rule ref="rulesets/controversial.xml/CamelCaseClassName" />
<rule ref="rulesets/controversial.xml/CamelCasePropertyName" />
<rule ref="rulesets/controversial.xml/CamelCaseVariableName" />

<rule ref="rulesets/codesize.xml/ExcessiveParameterList" />
<rule ref="rulesets/codesize.xml/ExcessivePublicCount" />
<rule ref="rulesets/codesize.xml/TooManyFields" />

<!--
Removed for CakePHPs sake:
-->
<!-- Causes issues where arguments must be accepted, such as in Command classes -->
<!--<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />-->
<!-- Causes issues where arguments must be accepted, such as in Command classes -->
<!--<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable" />-->

<!--
Suppressed:
-->
<!-- <rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" /> -->
<!-- <rule ref="rulesets/cleancode.xml/ElseExpression" /> -->
<!--
<rule ref="rulesets/naming.xml/ShortVariable" >
<properties>
<property name="minimum" value="2" />
<property name="exceptions" value="e" />
</properties>
</rule>
-->
<!-- <rule ref="rulesets/cleancode.xml/StaticAccess" /> -->
<!-- <rule ref="rulesets/codesize.xml/TooManyFields" /> -->

</ruleset>
Loading

0 comments on commit 95ba7ac

Please sign in to comment.