Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Bähr committed Nov 23, 2023
0 parents commit a81b146
Show file tree
Hide file tree
Showing 22 changed files with 802 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Continuous Integration

on: [push]

jobs:
analyse:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up PHP environment
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'

- name: Validate composer.json
run: composer validate

- name: Install dependencies
run: composer install

- name: Run tests
run: composer test

- name: Check coding standards
run: composer cs-check

- name: Check static analysis (PHPStan)
run: composer stan

- name: Check messdetector
run: composer md-check
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# IDE
.idea/
.project/
nbproject/
.buildpath/
.settings/
*.sublime-*
src/Generated/*
src/Orm/*

# OS
.DS_Store
*.AppleDouble
*.AppleDB
*.AppleDesktop

# grunt stuff
.grunt
.sass-cache
/node_modules/

# tooling
vendor/
composer.lock
auth.json
.phpunit.result.cache

# built client resources
src/*/Zed/*/Static/Public
src/*/Zed/*/Static/Assets/sprite

# Propel classes
src/*/Zed/*/Persistence/Propel/Base/*
src/*/Zed/*/Persistence/Propel/Map/*

# tests
tests/**/_generated/
tests/_output/*
!tests/_output/.gitkeep
tests/app/*
src/Orm
src/Generated
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Cache Manager

[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.0-8892BF.svg)](https://php.net/)

# Description
Adds functionality to register new cache manager plugins to delete redis cache via backoffice gui

# Install
- `composer require valantic-spryker/cache-manager`
40 changes: 40 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
namespace: ValanticSpryker

suites:
unit:
path: .

settings:
shuffle: true
lint: true

bootstrap: _bootstrap.php

paths:
tests: tests
output: tests/_output
support: tests/_support
data: tests/_data

coverage:
enabled: true
include:
- src/ValanticSpryker/*.php

modules:
enabled:
- \FondOfCodeception\Module\Spryker
config:
\FondOfCodeception\Module\Spryker:
generate_transfer: false
generate_map_classes: false
generate_propel_classes: false

env:
standalone:
modules:
config:
\FondOfCodeception\Module\Spryker:
generate_transfer: true
generate_map_classes: true
generate_propel_classes: true
68 changes: 68 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"name": "valantic-spryker/cache-manager",
"type": "library",
"description": "Add functionality to receive store specific configurations",
"license": "proprietary",
"require": {
"php": ">=8.0",
"spryker/kernel": "^3.0.0",
"spryker/storage": "^3.0.0"
},
"autoload": {
"psr-4": {
"ValanticSpryker\\": "src/ValanticSpryker/"
}
},
"autoload-dev": {
"psr-4": {
"ValanticSprykerTest\\": "tests/ValanticSprykerTest/",
"Generated\\": "src/Generated/",
"Orm\\Zed\\": "src/Orm/Zed/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"platform": {
"php": "8.0.19"
},
"preferred-install": "dist",
"use-include-path": true,
"sort-packages": true,
"github-protocols": [
"https"
],
"process-timeout": 900,
"chromium-revision": 814168,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"authors": [
{
"name": "Valantic",
"homepage": "https://www.valantic.com"
}
],
"keywords": [
"spryker"
],
"include-path": [
"src/"
],
"require-dev": {
"fond-of-codeception/spryker": "^1.0 || ^2.0",
"spryker-sdk/phpstan-spryker": "*",
"spryker/architecture-sniffer": "*",
"spryker/code-sniffer": "*",
"spryker/development": "*",
"spryker/testify": "*"
},
"scripts": {
"cs-fix": "phpcbf --standard=phpcs.xml src",
"cs-check": "phpcs -s --standard=phpcs.xml --report=full src",
"md-check": "phpmd src/ text phpmd-ruleset.xml --minimumpriority 2",
"stan": "php -d memory_limit=3072M vendor/bin/phpstan analyze -l 4 src/ValanticSpryker/",
"test": "codecept run --env standalone --coverage-text --no-colors --coverage-html"
}
}
56 changes: 56 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0"?>
<ruleset name="SprykerProject">
<description>
Spryker Coding Standard for Project.

Extends main Spryker Coding Standard.
All sniffs in ./Sniffs will be auto loaded
</description>

<rule ref="./vendor/spryker/code-sniffer/Spryker/ruleset.xml">
<exclude name="Spryker.Commenting.FileDocBlock"/>
<exclude name="Spryker.Formatting.MethodSignatureParametersLineBreakMethod"/>
<exclude name="Spryker.PHP.SingleQuote"/>
<exclude name="Spryker.Classes.ReturnTypeHint"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="SlevomatCodingStandard.ControlStructures.DisallowNullSafeObjectOperator"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion"/>
<exclude name="SlevomatCodingStandard.Functions.DisallowNamedArguments"/>
</rule>

<rule ref="./vendor/spryker/code-sniffer/SprykerStrict/ruleset.xml">
<exclude name="SprykerStrict.TypeHints.ParameterTypeHint"/>
<exclude name="SprykerStrict.TypeHints.PropertyTypeHint"/>
<exclude name="Spryker.Commenting.FileDocBlock"/>
<exclude name="SlevomatCodingStandard.Classes.ConstantSpacing"/>
<exclude name="Spryker.Commenting.DocBlockConst"/>
</rule>

<exclude-pattern>*/src/Generated/*</exclude-pattern>
<exclude-pattern>*/src/Orm/*</exclude-pattern>
<exclude-pattern>*/tests/_support/_generated/*</exclude-pattern>
<exclude-pattern>*/tests/*/_support/_generated/*</exclude-pattern>
<exclude-pattern>*/tests/*/_support/*Tester.php</exclude-pattern>
<exclude-pattern>*/tests/_helpers/*</exclude-pattern>
<exclude-pattern>*/tests/_output/*</exclude-pattern>
<exclude-pattern>./data/DE/*</exclude-pattern>
<exclude-pattern>./data/AT/*</exclude-pattern>
<exclude-pattern>./data/SH/*</exclude-pattern>
<exclude-pattern>./data/PZ/*</exclude-pattern>
<exclude-pattern>./data/US/*</exclude-pattern>
<exclude-pattern>./public</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>

<!-- Define your own sniffs here -->

<rule ref="Spryker.Internal.SprykerDisallowFunctions">
<properties>
<!-- We want to prevent 8.0+ functions to break 7.4 compatibility -->
<property name="phpVersion" value="8.0"/>
</properties>
</rule>
<!-- specific sniffs to include -->
<rule ref="./vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/TypeHints/DeclareStrictTypesSniff.php" />

</ruleset>
35 changes: 35 additions & 0 deletions phpmd-ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<ruleset name="Spryker PHPMD Rule Set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Extends Spryker's PHP Mess Detector Rule Set
</description>

<exclude-pattern>tests/_data</exclude-pattern>
<exclude-pattern>tests/_output</exclude-pattern>
<exclude-pattern>tests/_support</exclude-pattern>
<exclude-pattern>*/Persistence/Base/*</exclude-pattern>
<exclude-pattern>*/Persistence/Map/*</exclude-pattern>
<exclude-pattern>*/Orm/Propel/*</exclude-pattern>
<exclude-pattern>*/Generated/*</exclude-pattern>
<exclude-pattern>*Zed/DataImport/*</exclude-pattern>

<rule ref="./vendor/spryker/development/resources/phpmd/ruleset.xml">
<exclude name="LongClassName"/>
</rule>

<rule ref="./vendor/spryker/architecture-sniffer/src/ruleset.xml">
<exclude name="NewPluginExtensionModuleRule"/>
<exclude name="PluginSuffixRule"/>
<exclude name="FactoryPropelQueryMethodNameRule"/>
<exclude name="ImplementsApiInheritDocRule"/>
<exclude name="FactoryMethodReturnInterfaceRule"/>
<exclude name="FactoryOnlyPublicMethodsRule"/>
<exclude name="ZedDependencyProviderPropelQueryConstantNameRule"/>
<exclude name="ZedBusinessDirectoryNoModelRule"/>
<exclude name="ZedDependencyProviderMethodNameRule"/>
</rule>
</ruleset>
38 changes: 38 additions & 0 deletions phpstan-bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use PHP_CodeSniffer\Config;

define('APPLICATION_ROOT_DIR', __DIR__);
define('APPLICATION_VENDOR_DIR', APPLICATION_ROOT_DIR . '/vendor');
define('APPLICATION_SOURCE_DIR', APPLICATION_ROOT_DIR . '/src');
define('APPLICATION', '');
define('APPLICATION_ENV', '');
define('APPLICATION_STORE', '');
define('APPLICATION_CODE_BUCKET', '');

//require_once(__DIR__ . '/src/Generated/Client/Ide/AutoCompletion.php');
//require_once(__DIR__ . '/src/Generated/Service/Ide/AutoCompletion.php');
//require_once(__DIR__ . '/src/Generated/Zed/Ide/AutoCompletion.php');

$codeceptionShimFilePath = __DIR__ . '/vendor/codeception/codeception/shim.php';
if (file_exists($codeceptionShimFilePath)) {
require_once($codeceptionShimFilePath);
}

$manualAutoload = APPLICATION_VENDOR_DIR . '/squizlabs/php_codesniffer/autoload.php';
if (!class_exists(Config::class) && file_exists($manualAutoload)) {
require $manualAutoload;
}

// Shim to not throw "Function opcache_invalidate not found" error when opcache is not enabled
if (!function_exists('opcache_invalidate')) {
/**
* @param string $script
* @param bool $force
*
* @return void
*/
function opcache_invalidate($script, $force = false): void
{
}
}
23 changes: 23 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
parameters:
level: 4
reportUnmatchedIgnoredErrors: false
scanDirectories:
- src/Orm/Zed
- src/Generated
ignoreErrors:
- '#.* on an unknown class Generated\\(Client|Glue|Service|Yves|Zed)\\.*#'
- '#.*Access to undefined constant Orm\\Zed\\.*#'
- '#.*Call to an undefined method Orm\\Zed\\.*#'
- '#Dead catch - Exception is never thrown in the try block.#'

bootstrapFiles:
- '%rootDir%/../../../phpstan-bootstrap.php'

checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

dynamicConstantNames:
- APPLICATION
- APPLICATION_ENV
- APPLICATION_STORE
- APPLICATION_CODE_BUCKET
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<transfers xmlns="spryker:transfer-01"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="spryker:transfer-01 http://static.spryker.com/transfer-01.xsd">

<transfer name="CacheManagerPlugin">
<property name="name" type="string"/>
<property name="description" type="string"/>
<property name="keyPattern" type="string"/>
</transfer>

<transfer name="CacheManagerDelete">
<property name="name" type="string"/>
<property name="success" type="bool"/>
<property name="amount" type="int"/>
</transfer>
</transfers>
Loading

0 comments on commit a81b146

Please sign in to comment.