diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..cd8eb86
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+; This file is for unifying the coding style for different editors and IDEs.
+; More information at http://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_size = 4
+indent_style = space
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.gitignore b/.gitignore
index 85c5588..2b72ba8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-/vendor
-/build
+vendor/
+build/
composer.phar
composer.lock
.DS_Store
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 0000000..aea6609
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,23 @@
+filter:
+ excluded_paths: [tests/*]
+
+checks:
+ php:
+ remove_extra_empty_lines: true
+ remove_php_closing_tag: true
+ remove_trailing_whitespace: true
+ fix_use_statements:
+ remove_unused: true
+ preserve_multiple: false
+ preserve_blanklines: true
+ order_alphabetically: true
+ fix_php_opening_tag: true
+ fix_linefeed: true
+ fix_line_ending: true
+ fix_identation_4spaces: true
+ fix_doc_comments: true
+
+tools:
+ external_code_coverage:
+ timeout: 600
+ runs: 3
diff --git a/.styleci.yml b/.styleci.yml
new file mode 100644
index 0000000..247a09c
--- /dev/null
+++ b/.styleci.yml
@@ -0,0 +1 @@
+preset: psr2
diff --git a/composer.json b/composer.json
index c260335..a757fc9 100644
--- a/composer.json
+++ b/composer.json
@@ -15,12 +15,8 @@
"tijsverkoyen/css-to-inline-styles": "~2.0"
},
"require-dev" : {
- "jakub-onderka/php-parallel-lint": "0.8.*",
- "jakub-onderka/php-console-highlighter": "0.3.*",
- "phpmd/phpmd": "~1.5",
- "phpunit/phpunit": "~4.0",
- "satooshi/php-coveralls": "~0.7@dev",
- "squizlabs/php_codesniffer": "~1.5",
+ "phpunit/phpunit": "~5.7",
+ "squizlabs/php_codesniffer": "^2.3",
"swiftmailer/swiftmailer": "~5.0"
},
"autoload": {
@@ -28,6 +24,19 @@
"Fedeisas\\LaravelMailCssInliner\\": "src/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\": "tests/"
+ }
+ },
+ "scripts": {
+ "test": "phpunit",
+ "check-style": "phpcs -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests",
+ "fix-style": "phpcbf -p --standard=PSR2 --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 src tests"
+ },
+ "config": {
+ "sort-packages": true
+ },
"extra": {
"laravel": {
"providers": [
diff --git a/phpcs.xml b/phpcs.xml
deleted file mode 100644
index 8c6d2c5..0000000
--- a/phpcs.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- Coding standard.
-
-
-
-
- 0
-
-
-
- 0
-
-
-
diff --git a/phpmd.xml b/phpmd.xml
deleted file mode 100644
index db6b0b0..0000000
--- a/phpmd.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- PHPMD ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/phpunit.xml b/phpunit.xml
index 8c61cbb..9ab6894 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -23,4 +23,11 @@
./src
+
+
+
+
+
+
+
diff --git a/src/CssInlinerPlugin.php b/src/CssInlinerPlugin.php
index 9c8f1ff..361dfd8 100644
--- a/src/CssInlinerPlugin.php
+++ b/src/CssInlinerPlugin.php
@@ -74,11 +74,11 @@ public function loadOptions($options)
/**
* Find CSS stylesheet links and load them
- *
- * Loads the body of the message and passes
+ *
+ * Loads the body of the message and passes
* any link stylesheets to $this->css
* Removes any link elements
- *
+ *
* @return string $message The message
*/
public function loadCssFilesFromLinks($message)
diff --git a/src/LaravelMailCssInlinerServiceProvider.php b/src/LaravelMailCssInlinerServiceProvider.php
index d05977f..4ee9358 100644
--- a/src/LaravelMailCssInlinerServiceProvider.php
+++ b/src/LaravelMailCssInlinerServiceProvider.php
@@ -2,6 +2,7 @@
use Illuminate\Support\ServiceProvider;
use Swift_Mailer;
+use Fedeisas\LaravelMailCssInliner\CssInlinerPlugin;
class LaravelMailCssInlinerServiceProvider extends ServiceProvider
{
@@ -13,7 +14,7 @@ class LaravelMailCssInlinerServiceProvider extends ServiceProvider
public function boot()
{
$this->publishes([
- __DIR__.'/../config/css-inliner.php' => config_path('css-inliner.php'),
+ __DIR__ . '/../config/css-inliner.php' => config_path('css-inliner.php'),
], 'config');
}
@@ -24,14 +25,14 @@ public function boot()
*/
public function register()
{
- $this->mergeConfigFrom(__DIR__.'/../config/css-inliner.php', 'css-inliner');
+ $this->mergeConfigFrom(__DIR__ . '/../config/css-inliner.php', 'css-inliner');
- $this->app->singleton('Fedeisas\LaravelMailCssInliner\CssInlinerPlugin', function ($app) {
+ $this->app->singleton(CssInlinerPlugin::class, function ($app) {
return new CssInlinerPlugin($app['config']->get('css-inliner'));
});
$this->app->extend('swift.mailer', function (Swift_Mailer $swiftMailer, $app) {
- $inlinerPlugin = $app->make('Fedeisas\LaravelMailCssInliner\CssInlinerPlugin');
+ $inlinerPlugin = $app->make(CssInlinerPlugin::class);
$swiftMailer->registerPlugin($inlinerPlugin);
return $swiftMailer;
});
diff --git a/tests/CssInlinerPluginTest.php b/tests/CssInlinerPluginTest.php
index ae9ae27..281e3ef 100644
--- a/tests/CssInlinerPluginTest.php
+++ b/tests/CssInlinerPluginTest.php
@@ -1,26 +1,43 @@
stubs[$stub] = file_get_contents(__DIR__.'/stubs/'.$stub.'.stub');
+ $this->stubs[$stub] = file_get_contents(__DIR__ . '/stubs/' . $stub . '.stub');
}
- $this->options = require(__DIR__.'/../config/css-inliner.php');
+ $this->options = require(__DIR__ . '/../config/css-inliner.php');
}
/** @test **/