Skip to content

Commit 8e0a063

Browse files
committed
Added Makefile and improved README. + Fixes.
1 parent e0294b7 commit 8e0a063

5 files changed

Lines changed: 60 additions & 28 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/tests/ export-ignore
77

8+
/Makefile export-ignore
89
/.editorconfig export-ignore
910
/.gitattributes export-ignore
1011
/.gitignore export-ignore

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Copyright (c) 2018, PHP Censor
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
PHP?=php7.4
2+
COMPOSER=/usr/local/bin/composer
3+
4+
php-info:
5+
@echo "Default PHP version: $(PHP) (Run with custom PHP version: make install PHP=php8.0).\n";
6+
7+
list: php-info ## List
8+
@sed -rn 's/^([a-zA-Z_-]+):.*?## (.*)$$/"\1" "\2"/p' < $(MAKEFILE_LIST) | xargs printf "%-20s%s\n"
9+
10+
install: php-info ## Install dependencies (make install PHP=php8.0)
11+
@if [ ! -d "vendor" ]; then $(PHP) $(COMPOSER) install; fi;
12+
13+
update: php-info ## Update dependencies
14+
@$(PHP) $(COMPOSER) update
15+
16+
test: php-info install ## Run PHPUnit tests with coverage report
17+
$(PHP) vendor/bin/phpunit --configuration=phpunit.xml.dist --coverage-text --coverage-html=tests/var/coverage
18+
19+
mutation-test: php-info install ## Run Infection mutation tests
20+
$(PHP) vendor/bin/infection --threads=4 --show-mutations -vvv
21+
22+
code-style-fix: php-info install ## Fix code style
23+
$(PHP) vendor/bin/php-cs-fixer fix --allow-risky=yes --diff
24+
25+
psalm: php-info install ## Run Psalm check
26+
$(PHP) vendor/bin/psalm --config=psalm.xml.dist --threads=4 --show-snippet=true --show-info=true
27+
28+
.PHONY: php-info list install update test mutation-test code-style-fix psalm
29+
.DEFAULT_GOAL := list

README.md

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
1+
[![PHP Censor Plugins](http://ci.php-censor.info/build-status/image/15?branch=master&label=PHP%20Censor%20Plugins&style=flat-square)](http://ci.php-censor.info/build-status/view/15?branch=master)
2+
[![Latest Version](https://img.shields.io/packagist/v/php-censor/plugins.svg?label=Version&style=flat-square)](https://packagist.org/packages/php-censor/plugins)
3+
[![Total downloads](https://img.shields.io/packagist/dt/php-censor/plugins.svg?label=Downloads&style=flat-square)](https://packagist.org/packages/php-censor/plugins)
4+
[![License](https://img.shields.io/packagist/l/php-censor/plugins.svg?label=License&style=flat-square)](https://packagist.org/packages/php-censor/plugins)
5+
16
PHP Censor Plugins
27
==================
38

4-
[WIP] PHP Censor common plugins (for PHP Censor v3.0+).
9+
PHP Censor internal plugins.
510

6-
Common usage
11+
Installation
712
------------
813

9-
```bash
10-
composer install
11-
```
12-
13-
Code style
14-
----------
14+
Via Composer:
1515

1616
```bash
17-
vendor/bin/php-cs-fixer fix --allow-risky=yes --diff
18-
19-
vendor/bin/psalm --config=psalm.xml.dist --threads=4 --show-snippet=true --show-info=true
17+
composer require php-censor/plugins
2018
```
2119

22-
Unit tests
23-
----------
24-
25-
Phpunit tests:
20+
Code Quality
21+
------------
2622

27-
```bash
28-
vendor/bin/phpunit --configuration=phpunit.xml.dist --coverage-text --coverage-html=tests/var/coverage
29-
```
23+
In the `Makefile` you can find commands for running unit tests, static analyzers etc.
3024

31-
Infection mutation tests:
25+
License
26+
-------
3227

33-
```bash
34-
vendor/bin/infection --threads=4 --show-mutations -vvv
35-
```
28+
Licensed under the [BSD-2-Clause license](LICENSE).

src/Notification/EmailNotify.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
use PHPCensor\Common\Build\BuildInterface;
88
use PHPCensor\Common\Exception\Exception;
99
use PHPCensor\Common\Plugin\Plugin;
10-
use PHPCensor\Common\Email;
11-
use PHPCensor\Common\EmailSenderInterface;
12-
use PHPCensor\Common\ViewFactoryInterface;
13-
use PHPCensor\Common\ViewInterface;
10+
use PHPCensor\Common\Email\Email;
11+
use PHPCensor\Common\Email\EmailSenderInterface;
12+
use PHPCensor\Common\View\ViewFactoryInterface;
13+
use PHPCensor\Common\View\ViewInterface;
1414

1515
/**
1616
* EmailNotify Plugin - Provides simple email capability.
@@ -136,14 +136,14 @@ private function sendEmail(string $toAddress, array $ccList, string $subject, st
136136
{
137137
$email = new Email();
138138

139-
$email->setEmailTo($toAddress, $toAddress);
139+
$email->setEmailTo($toAddress);
140140
$email->setSubject($subject);
141141
$email->setBody($body);
142142
$email->setIsHtml(true);
143143

144144
if ($ccList) {
145145
foreach ($ccList as $address) {
146-
$email->addCarbonCopyEmail($address, $address);
146+
$email->addCarbonCopyEmail($address);
147147
}
148148
}
149149

0 commit comments

Comments
 (0)