Skip to content

Commit

Permalink
global refactoring for v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Theotime23 authored and AUDUL committed Nov 23, 2023
1 parent 4270d09 commit 2a8316f
Show file tree
Hide file tree
Showing 236 changed files with 3,843 additions and 4,195 deletions.
11 changes: 0 additions & 11 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/issue_template.md

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/auto-close-issue.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/auto-close-pr.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: IbexaMailing

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run test suite
run: composer run-script test
php-stan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: php-actions/composer@v6
with:
php_extensions: gd zip intl xsl
- name: PHPStan Static Analysis
uses: php-actions/phpstan@v3
with:
configuration: phpstan.neon.dist
memory_limit: 256M
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: PHP-CS-Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --diff --dry-run
phpmd:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Composer install
uses: php-actions/composer@v6
with:
php_extensions: gd zip intl xsl

- name: PHP Mess Detector
uses: php-actions/phpmd@v1
with:
path: bundle/
output: text
ruleset: phpmd.xml
exclude: '*/bundle/Entity/*'
sonar:
name: Sonar analyse
runs-on: ubuntu-latest
permissions: read-all
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/vendor/
composer.lock
.idea
.idea
.phpunit.cache/
phpunit.xml
/.php-cs-fixer.cache
55 changes: 55 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in('bundle')
->in('tests')
->files()->name('*.php');

$config = new PhpCsFixer\Config();
$config->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'@PSR12' => true,
'array_syntax' => [
'syntax' => 'short',
],
'declare_strict_types' => true,
'constant_case' => true,
'combine_consecutive_unsets' => true,
'native_function_invocation' => [
'include' => [
'@compiler_optimized',
],
],
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'extra',
'return',
'throw',
'use',
'parenthesis_brace_block',
'square_brace_block',
'curly_brace_block',
],
],
'no_superfluous_phpdoc_tags' => ['remove_inheritdoc' => false],
'operator_linebreak' => ['position' => 'beginning'],
'ordered_class_elements' => true,
'ordered_imports' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
'always_move_variable' => false,
],
])
->setRiskyAllowed(true)
->setFinder(
$finder
);

return $config;
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# Change Log

All notable changes to this project will be documented in this file.

## [2.0.0]

- Global refactoring
- Add CI
- Fix tests
- Fix bugs

## [1.1.0]

- Change send email to multi-process

## [1.0.1]

- Remove `reportEmail` as mandatory

## [1.0.0]

- Compatibiliy Ibexa 4.0
12 changes: 6 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
Copyright (c) 2020 Novactive, https://github.com/Novactive/NovaeZMailingBundle <[email protected]>
Copyright (c) 2019 Code Rhapsodie

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lint:
php -d memory_limit=512M vendor/bin/phpstan analyse -c phpstan.neon.dist
./vendor/bin/php-cs-fixer fix --dry-run --diff --config=.php-cs-fixer.dist.php
./vendor/bin/phpmd bundle text phpmd.xml --exclude '*/bundle/Entity/*'
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# Novactive eZ Mailing Bundle
# Ibexa Mailing Bundle

----

This repository is what we call a "subtree split": a read-only copy of one directory of the main repository.
It is used by Composer to allow developers to depend on specific bundles.
[![Quality Gate Status](https://sonar.code-rhapsodie.net/api/project_badges/measure?project=code-rhapsodie_IbexaMailingBundle_AYv8MwwoWE9sbcQmD12M&metric=alert_status&token=sqb_d492b0d522b202fb7514bf4977e2ba4027413d0f)](https://sonar.code-rhapsodie.net/dashboard?id=code-rhapsodie_IbexaMailingBundle_AYv8MwwoWE9sbcQmD12M)

If you want to report or contribute, you should instead open your issue on the main repository: https://github.com/Novactive/Nova-eZPlatform-Bundles
## History

Documentation is available in this repository via `.md` files but also packaged here: https://novactive.github.io/Nova-eZPlatform-Bundles/master/MailingBundle/README.md.html
This repository is a fork of https://github.com/Novactive/NovaeZMailingBundle

This repository is what we call a "subtree split": a read-only copy of one directory of the main repository.
It is used by Composer to allow developers to depend on specific bundles.
----

[![Downloads](https://img.shields.io/packagist/dt/novactive/ezmailingbundle.svg?style=flat-square)](https://packagist.org/packages/novactive/ezmailingbundle)
[![Latest version](https://img.shields.io/github/release/Novactive/NovaeZMailingBundle.svg?style=flat-square)](https://github.com/Novactive/NovaeZMailingBundle/releases)
[![License](https://img.shields.io/packagist/l/novactive/ezmailingbundle.svg?style=flat-square)](LICENSE)

Send eZ Contents by email based on the Mailing + Campaign configuration to a group of users (Mailing Lists)

Expand Down Expand Up @@ -54,7 +52,7 @@ Wording
Features
--------

Novactive eZ Mailing allows you to: **Send eZ Contents by email based on the Mailing + Campaign configuration to a group
Ibexa Mailing allows you to: **Send eZ Contents by email based on the Mailing + Campaign configuration to a group
of users (Mailing Lists)**

At a glance:
Expand Down
33 changes: 6 additions & 27 deletions bundle/Command/CleanupCommand.php
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
<?php

/**
* NovaeZMailingBundle Bundle.
*
* @package Novactive\Bundle\eZMailingBundle
*
* @author Novactive <[email protected]>
* @copyright 2018 Novactive
* @license https://github.com/Novactive/NovaeZMailingBundle/blob/master/LICENSE MIT Licence
*/

declare(strict_types=1);

namespace Novactive\Bundle\eZMailingBundle\Command;
namespace CodeRhapsodie\IbexaMailingBundle\Command;

use Novactive\Bundle\eZMailingBundle\Core\Registrar;
use CodeRhapsodie\IbexaMailingBundle\Core\Registrar;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

#[AsCommand(name: 'ibexamailing:cleanup', description: 'Clean expired items')]
class CleanupCommand extends Command
{
/**
* @var Registrar
*/
private $registrar;

public function __construct(Registrar $registrar)
public function __construct(private readonly Registrar $registrar)
{
parent::__construct();
$this->registrar = $registrar;
}

protected function configure(): void
{
$this
->setName('novaezmailing:cleanup')
->setDescription('Clean expired items');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$io->title('Remove the expired ConfirmationToken');
$io->title('Remove the expired ConfirmationTokenRepository');
$this->registrar->cleanup();
$io->success('Done.');

Expand Down
Loading

0 comments on commit 2a8316f

Please sign in to comment.