-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #634 from barbushin/develop
Develop
- Loading branch information
Showing
33 changed files
with
589 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: PHP Static Analysis & Tests | ||
|
||
on: | ||
push: | ||
branches: [ develop, 'issue/592' ] | ||
pull_request: | ||
branches: [ develop ] | ||
|
||
jobs: | ||
static-analysis: | ||
name: Static Analysis PHP ${{ matrix.php-versions }} | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: ['ubuntu-20.04'] | ||
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
coverage: none | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache Files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
${{ steps.composer-cache.outputs.dir }} | ||
**/.php_cs.cache | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run static analysis | ||
run: composer run static-analysis | ||
|
||
phpunit: | ||
name: PHP ${{ matrix.php-versions }} Unit Tests | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: ['ubuntu-20.04'] | ||
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1'] | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
coverage: none | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache Files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
${{ steps.composer-cache.outputs.dir }} | ||
**/.php_cs.cache | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run tests | ||
run: ./vendor/bin/phpunit --testdox --stop-on-failure | ||
|
||
coverage: | ||
name: Coverage | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
matrix: | ||
operating-system: ['ubuntu-20.04'] | ||
php-versions: ['8.0'] | ||
|
||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
coverage: xdebug | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
|
||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: | | ||
echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache Files | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
${{ steps.composer-cache.outputs.dir }} | ||
**/.php_cs.cache | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-composer- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
|
||
- name: Run tests | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: "945dfb58a832d233a3caeb84e3e6d3be212e8c7abcb48117fce63b9adcb43647" | ||
with: | ||
coverageCommand: ./vendor/bin/phpunit --testdox --stop-on-failure --coverage-clover=clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
vendor/ | ||
composer.lock | ||
*.phar | ||
.php_cs.cache | ||
.php-cs-fixer.cache | ||
coverage/ | ||
psalm/cache/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/* | ||
* This document has been generated with | ||
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0.0-rc.1|configurator | ||
* you can change this configuration by importing this file. | ||
*/ | ||
return (new PhpCsFixer\Config()) | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'@PHP71Migration' => true, // @PHP72Migration does not exist | ||
'@PHP71Migration:risky' => true, // @PHP72Migration:risky does not exist | ||
'array_syntax' => ['syntax' => 'short'], | ||
'declare_strict_types' => true, | ||
'global_namespace_import' => [ | ||
'import_classes' => true, | ||
'import_constants' => true, | ||
'import_functions' => false, | ||
], | ||
'native_constant_invocation' => true, | ||
'native_function_invocation' => [ | ||
'strict' => false, | ||
'include' => ['@compiler_optimized'], | ||
], | ||
'no_superfluous_phpdoc_tags' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'php_unit_dedicate_assert' => ['target' => 'newest'], | ||
'php_unit_method_casing' => true, | ||
'php_unit_test_case_static_method_calls' => ['call_type' => 'this'], | ||
'phpdoc_to_comment' => false, | ||
'void_return' => true, | ||
]) | ||
->setFinder(PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
) | ||
; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) | ||
[![Packagist](https://img.shields.io/packagist/dt/php-imap/php-imap.svg?style=flat-square)](https://packagist.org/packages/php-imap/php-imap) | ||
[![Build Status](https://travis-ci.org/barbushin/php-imap.svg?branch=master)](https://travis-ci.org/barbushin/php-imap) | ||
[![CI](https://github.com/barbushin/php-imap/actions/workflows/php.yml/badge.svg)](https://github.com/barbushin/php-imap/actions/workflows/php.yml) | ||
[![Supported PHP Version](https://img.shields.io/packagist/php-v/php-imap/php-imap.svg)](README.md) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/02f72a4fd695cb7e2976/maintainability)](https://codeclimate.com/github/barbushin/php-imap/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/02f72a4fd695cb7e2976/test_coverage)](https://codeclimate.com/github/barbushin/php-imap/test_coverage) | ||
|
@@ -71,14 +72,18 @@ You can run all PHPUnit tests by running the following command (inside of the in | |
|
||
Below, you'll find an example code how you can use this library. For further information and other examples, you may take a look at the [wiki](https://github.com/barbushin/php-imap/wiki). | ||
|
||
By default, this library uses random filenames for attachments as identical file names from other emails would overwrite other attachments. If you want to keep the original file name, you can set the attachment filename mode to ``true``, but then you also need to ensure, that those files don't get overwritten by other emails for example. | ||
|
||
```php | ||
// Create PhpImap\Mailbox instance for all further actions | ||
$mailbox = new PhpImap\Mailbox( | ||
'{imap.gmail.com:993/imap/ssl}INBOX', // IMAP server and mailbox folder | ||
'[email protected]', // Username for the before configured mailbox | ||
'*********', // Password for the before configured username | ||
__DIR__, // Directory, where attachments will be saved (optional) | ||
'UTF-8' // Server encoding (optional) | ||
'UTF-8', // Server encoding (optional) | ||
true, // Trim leading/ending whitespaces of IMAP path (optional) | ||
false // Attachment filename mode (optional; false = random filename; true = original filename) | ||
); | ||
|
||
// set some connection arguments (if appropriate) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"symbol-whitelist" : [ | ||
"null", "true", "false", | ||
"static", "self", "parent", | ||
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", "never", | ||
"IMAP\\Connection" | ||
], | ||
"php-core-extensions" : [ | ||
"Core", | ||
"date", | ||
"pcre", | ||
"Phar", | ||
"Reflection", | ||
"SPL", | ||
"standard" | ||
], | ||
"scan-files" : [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.