1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2025-02-01 12:31:38 +01:00

Add vendor files to dist

This commit is contained in:
FreeScout 2018-09-26 03:28:05 -07:00
parent 3f275ce126
commit 84344abf47
23 changed files with 2353 additions and 6 deletions

2
.gitbranch Normal file
View File

@ -0,0 +1,2 @@
* dist
master

1
.gitcommit Normal file
View File

@ -0,0 +1 @@
00c24562867995f07ee834f403844bbdccbeb00d

5
vendor/chumper/zipper/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
/vendor
composer.phar
composer.lock
.DS_Store
/.idea

34
vendor/chumper/zipper/.php_cs vendored Normal file
View File

@ -0,0 +1,34 @@
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(array(
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHP56Migration' => true,
'array_syntax' => array('syntax' => 'short'),
'combine_consecutive_unsets' => true,
// one should use PHPUnit methods to set up expected exception instead of annotations
'general_phpdoc_annotation_remove' => array('expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'),
'heredoc_to_nowdoc' => false,
'no_extra_consecutive_blank_lines' => array('break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'),
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_order' => true,
'psr4' => true,
'strict_comparison' => true,
'strict_param' => true,
'no_php4_constructor' => true,
'no_short_echo_tag' => true,
'phpdoc_summary' => false,
))
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
)
;

1
vendor/chumper/zipper/.php_cs.cache vendored Normal file
View File

@ -0,0 +1 @@
{"php":"7.0.15","version":"2.0.0:v2.0.0#f3baf72eb2f58bf275b372540f5b47d25aed910f","rules":{"encoding":true,"full_opening_tag":true,"blank_line_after_namespace":true,"braces":true,"class_definition":{"singleLine":true},"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_constants":true,"lowercase_keywords":true,"method_argument_space":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"binary_operator_spaces":{"align_double_arrow":false,"align_equals":false},"blank_line_after_opening_tag":true,"blank_line_before_return":true,"cast_spaces":true,"concat_space":{"spacing":"none"},"declare_equal_normalize":true,"function_typehint_space":true,"hash_to_slash_comment":true,"include":true,"lowercase_cast":true,"method_separation":true,"native_function_casing":true,"new_with_braces":true,"no_alias_functions":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_consecutive_blank_lines":["break","continue","extra","return","throw","use","parenthesis_brace_block","square_brace_block","curly_brace_block"],"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"no_multiline_whitespace_around_double_arrow":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_trailing_comma_in_list_call":true,"no_trailing_comma_in_singleline_array":true,"no_unneeded_control_parentheses":true,"no_unreachable_default_argument_value":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"no_whitespace_in_blank_line":true,"normalize_index_brace":true,"object_operator_without_whitespace":true,"php_unit_fqcn_annotation":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_empty_return":true,"phpdoc_no_package":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_types":true,"phpdoc_var_without_name":true,"pre_increment":true,"return_type_declaration":true,"self_accessor":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_quote":true,"space_after_semicolon":true,"standardize_not_equals":true,"ternary_operator_spaces":true,"trailing_comma_in_multiline_array":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"php_unit_construct":true,"php_unit_dedicate_assert":true,"silenced_deprecation_error":true,"pow_to_exponentiation":true,"array_syntax":{"syntax":"short"},"combine_consecutive_unsets":true,"general_phpdoc_annotation_remove":["expectedException","expectedExceptionMessage","expectedExceptionMessageRegExp"],"no_useless_else":true,"no_useless_return":true,"ordered_class_elements":true,"ordered_imports":true,"php_unit_strict":true,"phpdoc_add_missing_param_annotation":true,"phpdoc_order":true,"psr4":true,"strict_comparison":true,"strict_param":true,"no_php4_constructor":true,"no_short_echo_tag":true},"hashes":{"src\/Chumper\/Zipper\/Facades\/Zipper.php":3336360490,"src\/Chumper\/Zipper\/Repositories\/RepositoryInterface.php":146020446,"src\/Chumper\/Zipper\/Repositories\/ZipRepository.php":1787403374,"src\/Chumper\/Zipper\/Zipper.php":3154847016,"src\/Chumper\/Zipper\/ZipperServiceProvider.php":3002562041,"tests\/ArrayArchive.php":1688992765,"tests\/Repositories\/ZipRepositoryTest.php":973823218,"tests\/ZipperTest.php":2774399588}}

32
vendor/chumper/zipper/.travis.yml vendored Normal file
View File

@ -0,0 +1,32 @@
language: php
sudo: false
php:
- 5.6
- 7.0
- 7.1
env:
global:
- setup=basic
matrix:
fast_finish: true
include:
- php: 5.6
env: setup=lowest
- php: 5.6
env: setup=stable
before_install:
- composer self-update
- composer clear-cache
install:
- if [[ $setup = 'basic' ]]; then travis_retry composer update --no-interaction --prefer-dist --no-suggest; fi
- if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --no-suggest; fi
- if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-lowest --prefer-stable --no-suggest; fi
script: vendor/bin/phpunit

191
vendor/chumper/zipper/LICENSE vendored Normal file
View File

@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

203
vendor/chumper/zipper/README.md vendored Normal file
View File

@ -0,0 +1,203 @@
# Zipper
[![Build Status](https://travis-ci.org/Chumper/Zipper.png)](https://travis-ci.org/Chumper/Zipper)
This is a simple Wrapper around the ZipArchive methods with some handy functions.
## Installation
1. Add this package to the list of required packages, inside `composer.json`
* for Laravel 5: `"chumper/zipper": "1.0.x"`
* ~~for Laravel 4: `"chumper/zipper": "0.5.x"`~~
2. Run `composer update`
3. Go to `app/config/app.php`
* add to providers `'Chumper\Zipper\ZipperServiceProvider'`
* add to aliases `'Zipper' => 'Chumper\Zipper\Zipper'`
You can now access Zipper with the `Zipper` alias.
## Simple example
```php
$files = glob('public/files/*');
Zipper::make('public/test.zip')->add($files)->close();
```
- by default the package will create the `test.zip` in the project route folder but in the example above we changed it to `project_route/public/`.
## Another example
```php
$zipper = new \Chumper\Zipper\Zipper;
$zipper->make('test.zip')->folder('test')->add('composer.json');
$zipper->zip('test.zip')->folder('test')->add('composer.json','test');
$zipper->remove('composer.lock');
$zipper->folder('mySuperPackage')->add(
array(
'vendor',
'composer.json'
),
);
$zipper->getFileContent('mySuperPackage/composer.json');
$zipper->make('test.zip')->extractTo('',array('mySuperPackage/composer.json'),Zipper::WHITELIST);
$zipper->close();
```
Note: Please be aware that you need to call `->close()` at the end to write the zip file to disk.
You can easily chain most functions, except `getFileContent`, `getStatus`, `close` and `extractTo` which must come at the end of the chain.
The main reason I wrote this little package is the `extractTo` method since it allows you to be very flexible when extracting zips. So you can for example implement an update method which will just override the changed files.
# Functions
## make($pathToFile)
`Create` or `Open` a zip archive; if the file does not exists it will create a new one.
It will return the Zipper instance so you can chain easily.
## add($files/folder)
You can add and array of Files, or a Folder which all the files in that folder will then be added, so from the first example we could instead do something like `$files = 'public/files/';`.
## addString($filename, $content)
add a single file to the zip by specifying a name and content as strings.
## remove($file/s)
removes a single file or an array of files from the zip.
## folder($folder)
Specify a folder to 'add files to' or 'remove files from' from the zip, example
Zipper::make('test.zip')->folder('test')->add('composer.json');
Zipper::make('test.zip')->folder('test')->remove('composer.json');
## listFiles($regexFilter = null)
Lists all files within archive (if no filter pattern is provided). Use `$regexFilter` parameter to filter files. See [Pattern Syntax](http://php.net/manual/en/reference.pcre.pattern.syntax.php) for regular expression syntax
> NB: `listFiles` ignores folder set with `folder` function
Example: Return all files/folders ending/not ending with '.log' pattern (case insensitive). This will return matches in sub folders and their sub folders also
```php
$logFiles = Zipper::make('test.zip')->listFiles('/\.log$/i');
$notLogFiles = Zipper::make('test.zip')->listFiles('/^(?!.*\.log).*$/i');
```
## home()
Resets the folder pointer.
## zip($fileName)
Uses the ZipRepository for file handling.
## getFileContent($filePath)
get the content of a file in the zip. This will return the content or false.
## getStatus()
get the opening status of the zip as integer.
## close()
closes the zip and writes all changes.
## extractTo($path)
Extracts the content of the zip archive to the specified location, for example
Zipper::make('test.zip')->folder('test')->extractTo('foo');
This will go into the folder `test` in the zip file and extract the content of that folder only to the folder `foo`, this is equal to using the `Zipper::WHITELIST`.
This command is really nice to get just a part of the zip file, you can also pass a 2nd & 3rd param to specify a single or an array of files that will be
> NB: Php ZipArchive uses internally '/' as directory separator for files/folders in zip. So Windows users should not set
> whitelist/blacklist patterns with '\' as it will not match anything
white listed
>**Zipper::WHITELIST**
```php
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::WHITELIST);
```
Which will extract the `test.zip` into the `public` folder but **only** files/folders starting with `vendor` prefix inside the zip will be extracted.
or black listed
>**Zipper::BLACKLIST**
Which will extract the `test.zip` into the `public` folder except files/folders starting with `vendor` prefix inside the zip will not be extracted.
```php
Zipper::make('test.zip')->extractTo('public', array('vendor'), Zipper::BLACKLIST);
```
>**Zipper::EXACT_MATCH**
```php
Zipper::make('test.zip')
->folder('vendor')
->extractTo('public', array('composer', 'bin/phpunit'), Zipper::WHITELIST | Zipper::EXACT_MATCH);
```
Which will extract the `test.zip` into the `public` folder but **only** files/folders **exact matching names**. So this will:
* extract file or folder named `composer` in folder named `vendor` inside zip to `public` resulting `public/composer`
* extract file or folder named `bin/phpunit` in `vendor/bin/phpunit` folder inside zip to `public` resulting `public/bin/phpunit`
> **NB:** extracting files/folder from zip without setting Zipper::EXACT_MATCH
> When zip has similar structure as below and only `test.bat` is given as whitelist/blacklist argument then `extractTo` would extract all those files and folders as they all start with given string
```
test.zip
|- test.bat
|- test.bat.~
|- test.bat.dir/
|- fileInSubFolder.log
```
## extractMatchingRegex($path, $regex)
Extracts the content of the zip archive matching regular expression to the specified location. See [Pattern Syntax](http://php.net/manual/en/reference.pcre.pattern.syntax.php) for regular expression syntax.
Example: extract all files ending with `.php` from `src` folder and its sub folders.
```php
Zipper::make('test.zip')->folder->('src')->extractMatchingRegex($path, '/\.php$/i');
```
Example: extract all files **except** those ending with `test.php` from `src` folder and its sub folders.
```php
Zipper::make('test.zip')->folder->('src')->extractMatchingRegex($path, '/^(?!.*test\.php).*$/i');
```
# Development
Maybe it is a good idea to add other compression functions like rar, phar or bzip2 etc...
Everything is setup for that, if you want just fork and develop further.
If you need other functions or got errors, please leave an issue on github.

50
vendor/chumper/zipper/composer.json vendored Normal file
View File

@ -0,0 +1,50 @@
{
"name": "chumper/zipper",
"type": "library",
"description": "This is a little neat helper for the ZipArchive methods with handy functions",
"keywords": ["laravel", "ZIP", "Archive"],
"homepage": "http://github.com/Chumper/zipper",
"license": "Apache2",
"authors": [
{
"name": "Nils Plaschke",
"email": "github@nilsplaschke.de",
"homepage": "http://nilsplaschke.de",
"role": "Developer"
}
],
"require": {
"php": ">=5.6.0",
"illuminate/support": "^5.0",
"illuminate/filesystem": "^5.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"mockery/mockery": "^0.9.4"
},
"autoload": {
"psr-4": {
"Chumper\\Zipper\\": "src/Chumper/Zipper"
}
},
"autoload-dev": {
"psr-4": {
"Chumper\\Zipper\\": "tests/"
}
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Chumper\\Zipper\\ZipperServiceProvider"
],
"aliases": {
"Zipper": "Chumper\\Zipper\\Zipper"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

18
vendor/chumper/zipper/phpunit.xml vendored Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>

View File

@ -0,0 +1,13 @@
<?php
namespace Chumper\Zipper\Facades;
use Illuminate\Support\Facades\Facade;
class Zipper extends Facade
{
protected static function getFacadeAccessor()
{
return 'zipper';
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Chumper\Zipper\Repositories;
/**
* RepositoryInterface that needs to be implemented by every Repository
*
* Class RepositoryInterface
*/
interface RepositoryInterface
{
/**
* Construct with a given path
*
* @param $filePath
* @param bool $new
* @param $archiveImplementation
*/
public function __construct($filePath, $new = false, $archiveImplementation = null);
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
*/
public function addFile($pathToFile, $pathInArchive);
/**
* Add a file to the opened Archive using its contents
*
* @param $name
* @param $content
*/
public function addFromString($name, $content);
/**
* Add an empty directory
*
* @param $dirName
*/
public function addEmptyDir($dirName);
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
*/
public function removeFile($pathInArchive);
/**
* Get the content of a file
*
* @param $pathInArchive
*
* @return string
*/
public function getFileContent($pathInArchive);
/**
* Get the stream of a file
*
* @param $pathInArchive
*
* @return mixed
*/
public function getFileStream($pathInArchive);
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
*/
public function each($callback);
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
*
* @return bool
*/
public function fileExists($fileInArchive);
/**
* Sets the password to be used for decompressing
*
* @param $password
*
* @return bool
*/
public function usePassword($password);
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus();
/**
* Closes the archive and saves it
*/
public function close();
}

View File

@ -0,0 +1,189 @@
<?php
namespace Chumper\Zipper\Repositories;
use Exception;
use ZipArchive;
class ZipRepository implements RepositoryInterface
{
private $archive;
/**
* Construct with a given path
*
* @param $filePath
* @param bool $create
* @param $archive
*
* @throws \Exception
*
* @return ZipRepository
*/
public function __construct($filePath, $create = false, $archive = null)
{
//Check if ZipArchive is available
if (!class_exists('ZipArchive')) {
throw new Exception('Error: Your PHP version is not compiled with zip support');
}
$this->archive = $archive ? $archive : new ZipArchive();
$res = $this->archive->open($filePath, ($create ? ZipArchive::CREATE : null));
if ($res !== true) {
throw new Exception("Error: Failed to open $filePath! Error: ".$this->getErrorMessage($res));
}
}
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
*/
public function addFile($pathToFile, $pathInArchive)
{
$this->archive->addFile($pathToFile, $pathInArchive);
}
/**
* Add an empty directory
*
* @param $dirName
*/
public function addEmptyDir($dirName)
{
$this->archive->addEmptyDir($dirName);
}
/**
* Add a file to the opened Archive using its contents
*
* @param $name
* @param $content
*/
public function addFromString($name, $content)
{
$this->archive->addFromString($name, $content);
}
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
*/
public function removeFile($pathInArchive)
{
$this->archive->deleteName($pathInArchive);
}
/**
* Get the content of a file
*
* @param $pathInArchive
*
* @return string
*/
public function getFileContent($pathInArchive)
{
return $this->archive->getFromName($pathInArchive);
}
/**
* Get the stream of a file
*
* @param $pathInArchive
*
* @return mixed
*/
public function getFileStream($pathInArchive)
{
return $this->archive->getStream($pathInArchive);
}
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
*/
public function each($callback)
{
for ($i = 0; $i < $this->archive->numFiles; ++$i) {
//skip if folder
$stats = $this->archive->statIndex($i);
if ($stats['size'] === 0 && $stats['crc'] === 0) {
continue;
}
call_user_func_array($callback, [
'file' => $this->archive->getNameIndex($i),
]);
}
}
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
*
* @return bool
*/
public function fileExists($fileInArchive)
{
return $this->archive->locateName($fileInArchive) !== false;
}
/**
* Sets the password to be used for decompressing
* function named usePassword for clarity
*
* @param $password
*
* @return bool
*/
public function usePassword($password)
{
return $this->archive->setPassword($password);
}
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus()
{
return $this->archive->getStatusString();
}
/**
* Closes the archive and saves it
*/
public function close()
{
@$this->archive->close();
}
private function getErrorMessage($resultCode)
{
switch ($resultCode) {
case ZipArchive::ER_EXISTS:
return 'ZipArchive::ER_EXISTS - File already exists.';
case ZipArchive::ER_INCONS:
return 'ZipArchive::ER_INCONS - Zip archive inconsistent.';
case ZipArchive::ER_MEMORY:
return 'ZipArchive::ER_MEMORY - Malloc failure.';
case ZipArchive::ER_NOENT:
return 'ZipArchive::ER_NOENT - No such file.';
case ZipArchive::ER_NOZIP:
return 'ZipArchive::ER_NOZIP - Not a zip archive.';
case ZipArchive::ER_OPEN:
return 'ZipArchive::ER_OPEN - Can\'t open file.';
case ZipArchive::ER_READ:
return 'ZipArchive::ER_READ - Read error.';
case ZipArchive::ER_SEEK:
return 'ZipArchive::ER_SEEK - Seek error.';
default:
return "An unknown error [$resultCode] has occurred.";
}
}
}

View File

@ -0,0 +1,622 @@
<?php
namespace Chumper\Zipper;
use Chumper\Zipper\Repositories\RepositoryInterface;
use Exception;
use Illuminate\Filesystem\Filesystem;
/**
* This Zipper class is a wrapper around the ZipArchive methods with some handy functions
*
* Class Zipper
*/
class Zipper
{
/**
* Constant for extracting
*/
const WHITELIST = 1;
/**
* Constant for extracting
*/
const BLACKLIST = 2;
/**
* Constant for matching only strictly equal file names
*/
const EXACT_MATCH = 4;
/**
* @var string Represents the current location in the archive
*/
private $currentFolder = '';
/**
* @var Filesystem Handler to the file system
*/
private $file;
/**
* @var RepositoryInterface Handler to the archive
*/
private $repository;
/**
* @var string The path to the current zip file
*/
private $filePath;
/**
* Constructor
*
* @param Filesystem $fs
*/
public function __construct(Filesystem $fs = null)
{
$this->file = $fs ? $fs : new Filesystem();
}
/**
* Destructor
*/
public function __destruct()
{
if (null !== $this->repository) {
$this->repository->close();
}
}
/**
* Create a new zip Archive if the file does not exists
* opens a zip archive if the file exists
*
* @param $pathToFile string The file to open
* @param RepositoryInterface|string $type The type of the archive, defaults to zip, possible are zip, phar
*
* @throws \RuntimeException
* @throws \Exception
* @throws \InvalidArgumentException
*
* @return $this Zipper instance
*/
public function make($pathToFile, $type = 'zip')
{
$new = $this->createArchiveFile($pathToFile);
$this->filePath = $pathToFile;
$objectOrName = $type;
if (is_string($type)) {
$objectOrName = 'Chumper\Zipper\Repositories\\'.ucwords($type).'Repository';
}
if (!is_subclass_of($objectOrName, 'Chumper\Zipper\Repositories\RepositoryInterface')) {
throw new \InvalidArgumentException("Class for '{$objectOrName}' must implement RepositoryInterface interface");
}
$this->repository = $type;
if (is_string($objectOrName)) {
$this->repository = new $objectOrName($pathToFile, $new);
}
return $this;
}
/**
* Create a new zip archive or open an existing one
*
* @param $pathToFile
*
* @throws \Exception
*
* @return $this
*/
public function zip($pathToFile)
{
$this->make($pathToFile);
return $this;
}
/**
* Create a new phar file or open one
*
* @param $pathToFile
*
* @throws \Exception
*
* @return $this
*/
public function phar($pathToFile)
{
$this->make($pathToFile, 'phar');
return $this;
}
/**
* Create a new rar file or open one
*
* @param $pathToFile
*
* @throws \Exception
*
* @return $this
*/
public function rar($pathToFile)
{
$this->make($pathToFile, 'rar');
return $this;
}
/**
* Extracts the opened zip archive to the specified location <br/>
* you can provide an array of files and folders and define if they should be a white list
* or a black list to extract. By default this method compares file names using "string starts with" logic
*
* @param $path string The path to extract to
* @param array $files An array of files
* @param int $methodFlags The Method the files should be treated
*
* @throws \Exception
*/
public function extractTo($path, array $files = [], $methodFlags = self::BLACKLIST)
{
if (!$this->file->exists($path) && !$this->file->makeDirectory($path, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
}
if ($methodFlags & self::EXACT_MATCH) {
$matchingMethod = function ($haystack) use ($files) {
return in_array($haystack, $files, true);
};
} else {
$matchingMethod = function ($haystack) use ($files) {
return starts_with($haystack, $files);
};
}
if ($methodFlags & self::WHITELIST) {
$this->extractFilesInternal($path, $matchingMethod);
} else {
// blacklist - extract files that do not match with $matchingMethod
$this->extractFilesInternal($path, function ($filename) use ($matchingMethod) {
return !$matchingMethod($filename);
});
}
}
/**
* Extracts matching files/folders from the opened zip archive to the specified location.
*
* @param string $extractToPath The path to extract to
* @param string $regex regular expression used to match files. See @link http://php.net/manual/en/reference.pcre.pattern.syntax.php
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
public function extractMatchingRegex($extractToPath, $regex)
{
if (empty($regex)) {
throw new \InvalidArgumentException('Missing pass valid regex parameter');
}
$this->extractFilesInternal($extractToPath, function ($filename) use ($regex) {
$match = preg_match($regex, $filename);
if ($match === 1) {
return true;
} elseif ($match === false) {
//invalid pattern for preg_match raises E_WARNING and returns FALSE
//so if you have custom error_handler set to catch and throw E_WARNINGs you never end up here
//but if you have not - this will throw exception
throw new \RuntimeException("regular expression match on '$filename' failed with error. Please check if pattern is valid regular expression.");
}
return false;
});
}
/**
* Gets the content of a single file if available
*
* @param $filePath string The full path (including all folders) of the file in the zip
*
* @throws \Exception
*
* @return mixed returns the content or throws an exception
*/
public function getFileContent($filePath)
{
if ($this->repository->fileExists($filePath) === false) {
throw new Exception(sprintf('The file "%s" cannot be found', $filePath));
}
return $this->repository->getFileContent($filePath);
}
/**
* Add one or multiple files to the zip.
*
* @param $pathToAdd array|string An array or string of files and folders to add
* @param null|mixed $fileName
*
* @return $this Zipper instance
*/
public function add($pathToAdd, $fileName = null)
{
if (is_array($pathToAdd)) {
foreach ($pathToAdd as $key=>$dir) {
if (!is_int($key)) {
$this->add($dir, $key); }
else {
$this->add($dir);
}
}
} elseif ($this->file->isFile($pathToAdd)) {
if ($fileName) {
$this->addFile($pathToAdd, $fileName);
} else {
$this->addFile($pathToAdd);
}
} else {
$this->addDir($pathToAdd);
}
return $this;
}
/**
* Add an empty directory
*
* @param $dirName
*
* @return Zipper
*/
public function addEmptyDir($dirName)
{
$this->repository->addEmptyDir($dirName);
return $this;
}
/**
* Add a file to the zip using its contents
*
* @param $filename string The name of the file to create
* @param $content string The file contents
*
* @return $this Zipper instance
*/
public function addString($filename, $content)
{
$this->addFromString($filename, $content);
return $this;
}
/**
* Gets the status of the zip.
*
* @return int The status of the internal zip file
*/
public function getStatus()
{
return $this->repository->getStatus();
}
/**
* Remove a file or array of files and folders from the zip archive
*
* @param $fileToRemove array|string The path/array to the files in the zip
*
* @return $this Zipper instance
*/
public function remove($fileToRemove)
{
if (is_array($fileToRemove)) {
$self = $this;
$this->repository->each(function ($file) use ($fileToRemove, $self) {
if (starts_with($file, $fileToRemove)) {
$self->getRepository()->removeFile($file);
}
});
} else {
$this->repository->removeFile($fileToRemove);
}
return $this;
}
/**
* Returns the path of the current zip file if there is one.
*
* @return string The path to the file
*/
public function getFilePath()
{
return $this->filePath;
}
/**
* Sets the password to be used for decompressing
*
* @param $password
*
* @return bool
*/
public function usePassword($password)
{
return $this->repository->usePassword($password);
}
/**
* Closes the zip file and frees all handles
*/
public function close()
{
if (null !== $this->repository) {
$this->repository->close();
}
$this->filePath = '';
}
/**
* Sets the internal folder to the given path.<br/>
* Useful for extracting only a segment of a zip file.
*
* @param $path
*
* @return $this
*/
public function folder($path)
{
$this->currentFolder = $path;
return $this;
}
/**
* Resets the internal folder to the root of the zip file.
*
* @return $this
*/
public function home()
{
$this->currentFolder = '';
return $this;
}
/**
* Deletes the archive file
*/
public function delete()
{
if (null !== $this->repository) {
$this->repository->close();
}
$this->file->delete($this->filePath);
$this->filePath = '';
}
/**
* Get the type of the Archive
*
* @return string
*/
public function getArchiveType()
{
return get_class($this->repository);
}
/**
* Get the current internal folder pointer
*
* @return string
*/
public function getCurrentFolderPath()
{
return $this->currentFolder;
}
/**
* Checks if a file is present in the archive
*
* @param $fileInArchive
*
* @return bool
*/
public function contains($fileInArchive)
{
return $this->repository->fileExists($fileInArchive);
}
/**
* @return RepositoryInterface
*/
public function getRepository()
{
return $this->repository;
}
/**
* @return Filesystem
*/
public function getFileHandler()
{
return $this->file;
}
/**
* Gets the path to the internal folder
*
* @return string
*/
public function getInternalPath()
{
return empty($this->currentFolder) ? '' : $this->currentFolder.'/';
}
/**
* List all files that are within the archive
*
* @param string|null $regexFilter regular expression to filter returned files/folders. See @link http://php.net/manual/en/reference.pcre.pattern.syntax.php
*
* @throws \RuntimeException
*
* @return array
*/
public function listFiles($regexFilter = null)
{
$filesList = [];
if ($regexFilter) {
$filter = function ($file) use (&$filesList, $regexFilter) {
// push/pop an error handler here to to make sure no error/exception thrown if $expected is not a regex
set_error_handler(function () {
});
$match = preg_match($regexFilter, $file);
restore_error_handler();
if ($match === 1) {
$filesList[] = $file;
} elseif ($match === false) {
throw new \RuntimeException("regular expression match on '$file' failed with error. Please check if pattern is valid regular expression.");
}
};
} else {
$filter = function ($file) use (&$filesList) {
$filesList[] = $file;
};
}
$this->repository->each($filter);
return $filesList;
}
private function getCurrentFolderWithTrailingSlash()
{
if (empty($this->currentFolder)) {
return '';
}
$lastChar = mb_substr($this->currentFolder, -1);
if ($lastChar !== '/' || $lastChar !== '\\') {
return $this->currentFolder.'/';
}
return $this->currentFolder;
}
//---------------------PRIVATE FUNCTIONS-------------
/**
* @param $pathToZip
*
* @throws \Exception
*
* @return bool
*/
private function createArchiveFile($pathToZip)
{
if (!$this->file->exists($pathToZip)) {
$dirname = dirname($pathToZip);
if (!$this->file->exists($dirname) && !$this->file->makeDirectory($dirname, 0755, true)) {
throw new \RuntimeException('Failed to create folder');
} elseif (!$this->file->isWritable($dirname)) {
throw new Exception(sprintf('The path "%s" is not writeable', $pathToZip));
}
return true;
}
return false;
}
/**
* @param $pathToDir
*/
private function addDir($pathToDir)
{
// First go over the files in this directory and add them to the repository.
foreach ($this->file->files($pathToDir) as $file) {
$this->addFile($pathToDir.'/'.basename($file));
}
// Now let's visit the subdirectories and add them, too.
foreach ($this->file->directories($pathToDir) as $dir) {
$old_folder = $this->currentFolder;
$this->currentFolder = empty($this->currentFolder) ? basename($dir) : $this->currentFolder.'/'.basename($dir);
$this->addDir($pathToDir.'/'.basename($dir));
$this->currentFolder = $old_folder;
}
}
/**
* Add the file to the zip
*
* @param string $pathToAdd
* @param string $fileName
*/
private function addFile($pathToAdd, $fileName = null)
{
$info = pathinfo($pathToAdd);
if (!$fileName) {
$fileName = isset($info['extension']) ?
$info['filename'].'.'.$info['extension'] :
$info['filename'];
}
$this->repository->addFile($pathToAdd, $this->getInternalPath().$fileName);
}
/**
* Add the file to the zip from content
*
* @param $filename
* @param $content
*/
private function addFromString($filename, $content)
{
$this->repository->addFromString($this->getInternalPath().$filename, $content);
}
private function extractFilesInternal($path, callable $matchingMethod)
{
$self = $this;
$this->repository->each(function ($fileName) use ($path, $matchingMethod, $self) {
$currentPath = $self->getCurrentFolderWithTrailingSlash();
if (!empty($currentPath) && !starts_with($fileName, $currentPath)) {
return;
}
$filename = str_replace($self->getInternalPath(), '', $fileName);
if ($matchingMethod($filename)) {
$self->extractOneFileInternal($fileName, $path);
}
});
}
/**
* @param $fileName
* @param $path
*
* @throws \RuntimeException
*/
private function extractOneFileInternal($fileName, $path)
{
$tmpPath = str_replace($this->getInternalPath(), '', $fileName);
// We need to create the directory first in case it doesn't exist
$dir = pathinfo($path.DIRECTORY_SEPARATOR.$tmpPath, PATHINFO_DIRNAME);
if (!$this->file->exists($dir) && !$this->file->makeDirectory($dir, 0755, true, true)) {
throw new \RuntimeException('Failed to create folders');
}
$toPath = $path.DIRECTORY_SEPARATOR.$tmpPath;
$fileStream = $this->getRepository()->getFileStream($fileName);
$this->getFileHandler()->put($toPath, $fileStream);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace Chumper\Zipper;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider;
class ZipperServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*/
public function boot()
{
}
/**
* Register the service provider.
*/
public function register()
{
$this->app->singleton('zipper', function ($app) {
$return = $app->make('Chumper\Zipper\Zipper');
return $return;
});
$this->app->booting(function () {
$loader = AliasLoader::getInstance();
$loader->alias('Zipper', 'Chumper\Zipper\Facades\Zipper');
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['zipper'];
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace Chumper\Zipper;
use Chumper\Zipper\Repositories\RepositoryInterface;
class ArrayArchive implements RepositoryInterface
{
private $entries = [];
/**
* Construct with a given path
*
* @param $filePath
* @param bool $new
* @param $archiveImplementation
*/
public function __construct($filePath, $new = false, $archiveImplementation = null)
{
}
/**
* Add a file to the opened Archive
*
* @param $pathToFile
* @param $pathInArchive
*/
public function addFile($pathToFile, $pathInArchive)
{
$this->entries[$pathInArchive] = $pathInArchive;
}
/**
* Add a file to the opened Archive using its contents
*
* @param $name
* @param $content
*/
public function addFromString($name, $content)
{
$this->entries[$name] = $name;
}
/**
* Remove a file permanently from the Archive
*
* @param $pathInArchive
*/
public function removeFile($pathInArchive)
{
unset($this->entries[$pathInArchive]);
}
/**
* Get the content of a file
*
* @param $pathInArchive
*
* @return string
*/
public function getFileContent($pathInArchive)
{
return $this->entries[$pathInArchive];
}
/**
* Get the stream of a file
*
* @param $pathInArchive
*
* @return mixed
*/
public function getFileStream($pathInArchive)
{
return $this->entries[$pathInArchive];
}
/**
* Will loop over every item in the archive and will execute the callback on them
* Will provide the filename for every item
*
* @param $callback
*/
public function each($callback)
{
foreach ($this->entries as $entry) {
call_user_func_array($callback, [
'file' => $entry,
]);
}
}
/**
* Checks whether the file is in the archive
*
* @param $fileInArchive
*
* @return bool
*/
public function fileExists($fileInArchive)
{
return array_key_exists($fileInArchive, $this->entries);
}
/**
* Returns the status of the archive as a string
*
* @return string
*/
public function getStatus()
{
return 'OK';
}
/**
* Closes the archive and saves it
*/
public function close()
{
}
/**
* Add an empty directory
*
* @param $dirName
*/
public function addEmptyDir($dirName)
{
// CODE...
}
/**
* Sets the password to be used for decompressing
*
* @param $password
*/
public function usePassword($password)
{
// CODE...
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace Chumper\Zipper\Repositories;
use Exception;
use Mockery;
use ZipArchive;
/**
* Created by JetBrains PhpStorm.
* User: Nils
* Date: 28.08.13
* Time: 20:57
* To change this template use File | Settings | File Templates.
*/
class ZipRepositoryTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ZipRepository
*/
public $zip;
/**
* @var \Mockery\Mock
*/
public $mock;
public function setUp()
{
$this->mock = Mockery::mock(new ZipArchive());
$this->zip = new ZipRepository('foo', true, $this->mock);
}
protected function tearDown()
{
Mockery::close();
}
public function testMake()
{
$zip = new ZipRepository('foo.zip', true);
$this->assertFalse($zip->fileExists('foo'));
}
public function testOpenNonExistentZipThrowsException()
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('Error: Failed to open idonotexist.zip! Error: ZipArchive::ER_');
new ZipRepository('idonotexist.zip', false);
}
public function testOpenNonZipThrowsException()
{
$this->expectException(Exception::class);
$this->expectExceptionMessageRegExp('/Error: Failed to open (.*)ZipRepositoryTest.php! Error: ZipArchive::ER_NOZIP - Not a zip archive./');
new ZipRepository(__DIR__.DIRECTORY_SEPARATOR.'ZipRepositoryTest.php', false);
}
public function testAddFile()
{
$this->mock->shouldReceive('addFile')->once()->with('bar', 'bar');
$this->mock->shouldReceive('addFile')->once()->with('bar', 'foo/bar');
$this->mock->shouldReceive('addFile')->once()->with('foo/bar', 'bar');
$this->zip->addFile('bar', 'bar');
$this->zip->addFile('bar', 'foo/bar');
$this->zip->addFile('foo/bar', 'bar');
}
public function testRemoveFile()
{
$this->mock->shouldReceive('deleteName')->once()->with('bar');
$this->mock->shouldReceive('deleteName')->once()->with('foo/bar');
$this->zip->removeFile('bar');
$this->zip->removeFile('foo/bar');
}
public function testGetFileContent()
{
$this->mock->shouldReceive('getFromName')->once()
->with('bar')->andReturn('foo');
$this->mock->shouldReceive('getFromName')->once()
->with('foo/bar')->andReturn('baz');
$this->assertSame('foo', $this->zip->getFileContent('bar'));
$this->assertSame('baz', $this->zip->getFileContent('foo/bar'));
}
public function testGetFileStream()
{
$this->mock->shouldReceive('getStream')->once()
->with('bar')->andReturn('foo');
$this->mock->shouldReceive('getStream')->once()
->with('foo/bar')->andReturn('baz');
$this->assertSame('foo', $this->zip->getFileStream('bar'));
$this->assertSame('baz', $this->zip->getFileStream('foo/bar'));
}
public function testFileExists()
{
$this->mock->shouldReceive('locateName')->once()
->with('bar')->andReturn(true);
$this->mock->shouldReceive('locateName')->once()
->with('foo/bar')->andReturn(false);
$this->assertTrue($this->zip->fileExists('bar'));
$this->assertFalse($this->zip->fileExists('foo/bar'));
}
public function testClose()
{
$this->zip->close();
}
}

View File

@ -0,0 +1,488 @@
<?php
namespace Chumper\Zipper;
use Exception;
use Illuminate\Filesystem\Filesystem;
use InvalidArgumentException;
use Mockery;
use RuntimeException;
class ZipperTest extends \PHPUnit_Framework_TestCase
{
/**
* @var \Chumper\Zipper\Zipper
*/
public $archive;
/**
* @var \Mockery\Mock
*/
public $file;
protected function setUp()
{
$this->file = Mockery::mock(new Filesystem());
$this->archive = new Zipper($this->file);
$this->archive->make('foo', new ArrayArchive('foo', true));
}
protected function tearDown()
{
Mockery::close();
}
public function testMake()
{
$this->assertSame('Chumper\\Zipper\\ArrayArchive', $this->archive->getArchiveType());
$this->assertSame('foo', $this->archive->getFilePath());
}
public function testMakeThrowsExceptionWhenCouldNotCreateDirectory()
{
$path = getcwd().time();
$this->file->shouldReceive('makeDirectory')
->with($path, 0755, true)
->andReturn(false);
$zip = new Zipper($this->file);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Failed to create folder');
$zip->make($path.DIRECTORY_SEPARATOR.'createMe.zip');
}
public function testAddAndGet()
{
$this->file->shouldReceive('isFile')->with('foo.bar')
->times(1)->andReturn(true);
$this->file->shouldReceive('isFile')->with('foo')
->times(1)->andReturn(true);
$this->archive->add('foo.bar');
$this->archive->add('foo');
$this->assertSame('foo', $this->archive->getFileContent('foo'));
$this->assertSame('foo.bar', $this->archive->getFileContent('foo.bar'));
}
public function testAddAndGetWithArray()
{
$this->file->shouldReceive('isFile')->with('foo.bar')
->times(1)->andReturn(true);
$this->file->shouldReceive('isFile')->with('foo')
->times(1)->andReturn(true);
/**Array**/
$this->archive->add([
'foo.bar',
'foo',
]);
$this->assertSame('foo', $this->archive->getFileContent('foo'));
$this->assertSame('foo.bar', $this->archive->getFileContent('foo.bar'));
}
public function testAddAndGetWithCustomFilenameArray()
{
$this->file->shouldReceive('isFile')->with('foo.bar')
->times(1)->andReturn(true);
$this->file->shouldReceive('isFile')->with('foo')
->times(1)->andReturn(true);
/**Array**/
$this->archive->add([
'custom.bar' => 'foo.bar',
'custom' => 'foo',
]);
$this->assertSame('custom', $this->archive->getFileContent('custom'));
$this->assertSame('custom.bar', $this->archive->getFileContent('custom.bar'));
}
public function testAddAndGetWithSubFolder()
{
/*
* Add the local folder /path/to/fooDir as folder fooDir to the repository
* and make sure the folder structure within the repository is there.
*/
$this->file->shouldReceive('isFile')->with('/path/to/fooDir')
->once()->andReturn(false);
$this->file->shouldReceive('files')->with('/path/to/fooDir')
->once()->andReturn(['fileInFooDir.bar', 'fileInFooDir.foo']);
$this->file->shouldReceive('directories')->with('/path/to/fooDir')
->once()->andReturn(['fooSubdir']);
$this->file->shouldReceive('files')->with('/path/to/fooDir/fooSubdir')
->once()->andReturn(['fileInFooDir.bar']);
$this->file->shouldReceive('directories')->with('/path/to/fooDir/fooSubdir')
->once()->andReturn([]);
$this->archive->folder('fooDir')
->add('/path/to/fooDir');
$this->assertSame('fooDir/fileInFooDir.bar', $this->archive->getFileContent('fooDir/fileInFooDir.bar'));
$this->assertSame('fooDir/fileInFooDir.foo', $this->archive->getFileContent('fooDir/fileInFooDir.foo'));
$this->assertSame('fooDir/fooSubdir/fileInFooDir.bar', $this->archive->getFileContent('fooDir/fooSubdir/fileInFooDir.bar'));
}
public function testGetFileContent()
{
$this->expectException(Exception::class);
$this->expectExceptionMessage('The file "baz" cannot be found');
$this->archive->getFileContent('baz');
}
public function testRemove()
{
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->assertTrue($this->archive->contains('foo'));
$this->archive->remove('foo');
$this->assertFalse($this->archive->contains('foo'));
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->file->shouldReceive('isFile')->with('fooBar')
->andReturn(true);
$this->archive->add(['foo', 'fooBar']);
$this->assertTrue($this->archive->contains('foo'));
$this->assertTrue($this->archive->contains('fooBar'));
$this->archive->remove(['foo', 'fooBar']);
$this->assertFalse($this->archive->contains('foo'));
$this->assertFalse($this->archive->contains('fooBar'));
}
public function testExtractWhiteList()
{
$this->file
->shouldReceive('isFile')
->with('foo')
->andReturn(true);
$this->file
->shouldReceive('isFile')
->with('foo.log')
->andReturn(true);
$this->archive
->add('foo')
->add('foo.log');
$this->file
->shouldReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'foo', 'foo');
$this->file
->shouldReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'foo.log', 'foo.log');
$this->archive
->extractTo(getcwd(), ['foo'], Zipper::WHITELIST);
}
public function testExtractToThrowsExceptionWhenCouldNotCreateDirectory()
{
$path = getcwd().time();
$this->file
->shouldReceive('isFile')
->with('foo.log')
->andReturn(true);
$this->file->shouldReceive('makeDirectory')
->with($path, 0755, true)
->andReturn(false);
$this->archive->add('foo.log');
$this->file->shouldNotReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'foo.log', 'foo.log');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Failed to create folder');
$this->archive
->extractTo($path, ['foo'], Zipper::WHITELIST);
}
public function testExtractWhiteListFromSubDirectory()
{
$this->file->shouldReceive('isFile')->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive
->folder('foo/bar')
->add('baz')
->add('baz.log');
$this->file
->shouldReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'baz', 'foo/bar/baz');
$this->file
->shouldReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'baz.log', 'foo/bar/baz.log');
$this->archive
->extractTo(getcwd(), ['baz'], Zipper::WHITELIST);
}
public function testExtractWhiteListWithExactMatching()
{
$this->file->shouldReceive('isFile')->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive
->folder('foo/bar')
->add('baz')
->add('baz.log');
$this->file
->shouldReceive('put')
->with(realpath(null).DIRECTORY_SEPARATOR.'baz', 'foo/bar/baz');
$this->archive
->extractTo(getcwd(), ['baz'], Zipper::WHITELIST | Zipper::EXACT_MATCH);
}
public function testExtractWhiteListWithExactMatchingFromSubDirectory()
{
$this->file->shouldReceive('isFile')->andReturn(true);
$this->file->shouldReceive('exists')->andReturn(false);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive->folder('foo/bar/subDirectory')
->add('bazInSubDirectory')
->add('bazInSubDirectory.log');
$this->archive->folder('foo/bar')
->add('baz')
->add('baz.log');
$subDirectoryPath = realpath(null).DIRECTORY_SEPARATOR.'subDirectory';
$subDirectoryFilePath = $subDirectoryPath.'/bazInSubDirectory';
$this->file->shouldReceive('put')
->with($subDirectoryFilePath, 'foo/bar/subDirectory/bazInSubDirectory');
$this->archive
->extractTo(getcwd(), ['subDirectory/bazInSubDirectory'], Zipper::WHITELIST | Zipper::EXACT_MATCH);
$this->file->shouldHaveReceived('makeDirectory')->with($subDirectoryPath, 0755, true, true);
}
public function testExtractToIgnoresBlackListFile()
{
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->file->shouldReceive('isFile')->with('bar')
->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive->add('foo')
->add('bar');
$this->file->shouldReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'foo', 'foo');
$this->file->shouldNotReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'bar', 'bar');
$this->archive->extractTo(getcwd(), ['bar'], Zipper::BLACKLIST);
}
public function testExtractBlackListFromSubDirectory()
{
$currentDir = getcwd();
$this->file->shouldReceive('isFile')->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive->add('rootLevelFile');
$this->archive->folder('foo/bar/sub')
->add('fileInSubSubDir');
$this->archive->folder('foo/bar')
->add('fileInSubDir')
->add('fileBlackListedInSubDir');
$this->file->shouldReceive('put')->with($currentDir.DIRECTORY_SEPARATOR.'fileInSubDir', 'foo/bar/fileInSubDir');
$this->file->shouldReceive('put')->with($currentDir.DIRECTORY_SEPARATOR.'sub/fileInSubSubDir', 'foo/bar/sub/fileInSubSubDir');
$this->file->shouldNotReceive('put')->with($currentDir.DIRECTORY_SEPARATOR.'fileBlackListedInSubDir', 'fileBlackListedInSubDir');
$this->file->shouldNotReceive('put')->with($currentDir.DIRECTORY_SEPARATOR.'rootLevelFile', 'rootLevelFile');
$this->archive->extractTo($currentDir, ['fileBlackListedInSubDir'], Zipper::BLACKLIST);
}
public function testExtractBlackListFromSubDirectoryWithExactMatching()
{
$this->file->shouldReceive('isFile')->with('baz')
->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->file->shouldReceive('isFile')->with('baz.log')
->andReturn(true);
$this->archive->folder('foo/bar')
->add('baz')
->add('baz.log');
$this->file->shouldReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'baz.log', 'foo/bar/baz.log');
$this->archive->extractTo(getcwd(), ['baz'], Zipper::BLACKLIST | Zipper::EXACT_MATCH);
}
public function testExtractMatchingRegexFromSubFolder()
{
$this->file->shouldReceive('isFile')->with('baz')->andReturn(true);
$this->file->shouldReceive('isFile')->with('baz.log')->andReturn(true);
$this->file->shouldReceive('isFile')->with('subFolderFileToIgnore')->andReturn(true);
$this->file->shouldReceive('isFile')->with('subFolderFileToExtract.log')->andReturn(true);
$this->file->shouldReceive('isFile')->with('rootLevelMustBeIgnored.log')->andReturn(true);
$this->file->shouldReceive('makeDirectory')->andReturn(true);
$this->archive->add('rootLevelMustBeIgnored.log');
$this->archive->folder('foo/bar/subFolder')
->add('subFolderFileToIgnore')
->add('subFolderFileToExtract.log');
$this->archive->folder('foo/bar')
->add('baz')
->add('baz.log');
$this->file->shouldReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'baz.log', 'foo/bar/baz.log');
$this->file->shouldReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'subFolder/subFolderFileToExtract.log', 'foo/bar/subFolder/subFolderFileToExtract.log');
$this->file->shouldNotReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'rootLevelMustBeIgnored.log', 'rootLevelMustBeIgnored.log');
$this->file->shouldNotReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'baz', 'foo/bar/baz');
$this->file->shouldNotReceive('put')->with(realpath(null).DIRECTORY_SEPARATOR.'subFolder/subFolderFileToIgnore', 'foo/bar/subFolder/subFolderFileToIgnore');
$this->archive->extractMatchingRegex(getcwd(), '/\.log$/i');
}
public function testExtractMatchingRegexThrowsExceptionWhenRegexIsEmpty()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Missing pass valid regex parameter');
$this->archive->extractMatchingRegex(getcwd(), '');
}
public function testNavigationFolderAndHome()
{
$this->archive->folder('foo/bar');
$this->assertSame('foo/bar', $this->archive->getCurrentFolderPath());
//----
$this->file->shouldReceive('isFile')->with('foo')
->andReturn(true);
$this->archive->add('foo');
$this->assertSame('foo/bar/foo', $this->archive->getFileContent('foo/bar/foo'));
//----
$this->file->shouldReceive('isFile')->with('bar')
->andReturn(true);
$this->archive->home()->add('bar');
$this->assertSame('bar', $this->archive->getFileContent('bar'));
//----
$this->file->shouldReceive('isFile')->with('baz/bar/bing')
->andReturn(true);
$this->archive->folder('test')->add('baz/bar/bing');
$this->assertSame('test/bing', $this->archive->getFileContent('test/bing'));
}
public function testListFiles()
{
// testing empty file
$this->file->shouldReceive('isFile')->with('foo.file')->andReturn(true);
$this->file->shouldReceive('isFile')->with('bar.file')->andReturn(true);
$this->assertSame([], $this->archive->listFiles());
// testing not empty file
$this->archive->add('foo.file');
$this->archive->add('bar.file');
$this->assertSame(['foo.file', 'bar.file'], $this->archive->listFiles());
// testing with a empty sub dir
$this->file->shouldReceive('isFile')->with('/path/to/subDirEmpty')->andReturn(false);
$this->file->shouldReceive('files')->with('/path/to/subDirEmpty')->andReturn([]);
$this->file->shouldReceive('directories')->with('/path/to/subDirEmpty')->andReturn([]);
$this->archive->folder('subDirEmpty')->add('/path/to/subDirEmpty');
$this->assertSame(['foo.file', 'bar.file'], $this->archive->listFiles());
// testing with a not empty sub dir
$this->file->shouldReceive('isFile')->with('/path/to/subDir')->andReturn(false);
$this->file->shouldReceive('isFile')->with('sub.file')->andReturn(true);
$this->file->shouldReceive('files')->with('/path/to/subDir')->andReturn(['sub.file']);
$this->file->shouldReceive('directories')->with('/path/to/subDir')->andReturn([]);
$this->archive->folder('subDir')->add('/path/to/subDir');
$this->assertSame(['foo.file', 'bar.file', 'subDir/sub.file'], $this->archive->listFiles());
}
public function testListFilesWithRegexFilter()
{
// add 2 files to root level in zip
$this->file->shouldReceive('isFile')->with('foo.file')->andReturn(true);
$this->file->shouldReceive('isFile')->with('bar.log')->andReturn(true);
$this->archive
->add('foo.file')
->add('bar.log');
// add sub directory with 2 files inside
$this->file->shouldReceive('isFile')->with('/path/to/subDir')->andReturn(false);
$this->file->shouldReceive('isFile')->with('sub.file')->andReturn(true);
$this->file->shouldReceive('isFile')->with('anotherSub.log')->andReturn(true);
$this->file->shouldReceive('files')->with('/path/to/subDir')->andReturn(['sub.file', 'anotherSub.log']);
$this->file->shouldReceive('directories')->with('/path/to/subDir')->andReturn([]);
$this->archive->folder('subDir')->add('/path/to/subDir');
$this->assertSame(
['foo.file', 'subDir/sub.file'],
$this->archive->listFiles('/\.file$/i') // filter out files ending with ".file" pattern
);
}
public function testListFilesThrowsExceptionWithInvalidRegexFilter()
{
$this->file->shouldReceive('isFile')->with('foo.file')->andReturn(true);
$this->archive->add('foo.file');
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('regular expression match on \'foo.file\' failed with error. Please check if pattern is valid regular expression.');
$invalidPattern = 'asdasd';
$this->archive->listFiles($invalidPattern);
}
}

View File

@ -49,6 +49,7 @@ return array(
'App\\Http\\Controllers\\PublicController' => $baseDir . '/app/Http/Controllers/PublicController.php',
'App\\Http\\Controllers\\SecureController' => $baseDir . '/app/Http/Controllers/SecureController.php',
'App\\Http\\Controllers\\SettingsController' => $baseDir . '/app/Http/Controllers/SettingsController.php',
'App\\Http\\Controllers\\TranslateController' => $baseDir . '/app/Http/Controllers/TranslateController.php',
'App\\Http\\Controllers\\UsersController' => $baseDir . '/app/Http/Controllers/UsersController.php',
'App\\Http\\Kernel' => $baseDir . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\CheckRole' => $baseDir . '/app/Http/Middleware/CheckRole.php',
@ -170,6 +171,11 @@ return array(
'Carbon\\Exceptions\\InvalidDateException' => $vendorDir . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
'Carbon\\Laravel\\ServiceProvider' => $vendorDir . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php',
'Carbon\\Translator' => $vendorDir . '/nesbot/carbon/src/Carbon/Translator.php',
'Chumper\\Zipper\\Facades\\Zipper' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Facades/Zipper.php',
'Chumper\\Zipper\\Repositories\\RepositoryInterface' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Repositories/RepositoryInterface.php',
'Chumper\\Zipper\\Repositories\\ZipRepository' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Repositories/ZipRepository.php',
'Chumper\\Zipper\\Zipper' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/Zipper.php',
'Chumper\\Zipper\\ZipperServiceProvider' => $vendorDir . '/chumper/zipper/src/Chumper/Zipper/ZipperServiceProvider.php',
'Cron\\AbstractField' => $vendorDir . '/mtdowling/cron-expression/src/Cron/AbstractField.php',
'Cron\\CronExpression' => $vendorDir . '/mtdowling/cron-expression/src/Cron/CronExpression.php',
'Cron\\DayOfMonthField' => $vendorDir . '/mtdowling/cron-expression/src/Cron/DayOfMonthField.php',

View File

@ -58,6 +58,7 @@ return array(
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'DebugBar\\' => array($vendorDir . '/maximebf/debugbar/src/DebugBar'),
'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'),
'Chumper\\Zipper\\' => array($vendorDir . '/chumper/zipper/src/Chumper/Zipper'),
'Barryvdh\\TranslationManager\\' => array($vendorDir . '/barryvdh/laravel-translation-manager/src'),
'Barryvdh\\Debugbar\\' => array($vendorDir . '/barryvdh/laravel-debugbar/src'),
'Axn\\Laroute\\Routes\\' => array($baseDir . '/overrides/Axn/Laroute/Routes'),

View File

@ -127,6 +127,7 @@ class ComposerStaticInit9382ab4a444ef313492b08539c8c268d
'C' =>
array (
'Cron\\' => 5,
'Chumper\\Zipper\\' => 15,
),
'B' =>
array (
@ -354,6 +355,10 @@ class ComposerStaticInit9382ab4a444ef313492b08539c8c268d
array (
0 => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron',
),
'Chumper\\Zipper\\' =>
array (
0 => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper',
),
'Barryvdh\\TranslationManager\\' =>
array (
0 => __DIR__ . '/..' . '/barryvdh/laravel-translation-manager/src',
@ -474,6 +479,7 @@ class ComposerStaticInit9382ab4a444ef313492b08539c8c268d
'App\\Http\\Controllers\\PublicController' => __DIR__ . '/../..' . '/app/Http/Controllers/PublicController.php',
'App\\Http\\Controllers\\SecureController' => __DIR__ . '/../..' . '/app/Http/Controllers/SecureController.php',
'App\\Http\\Controllers\\SettingsController' => __DIR__ . '/../..' . '/app/Http/Controllers/SettingsController.php',
'App\\Http\\Controllers\\TranslateController' => __DIR__ . '/../..' . '/app/Http/Controllers/TranslateController.php',
'App\\Http\\Controllers\\UsersController' => __DIR__ . '/../..' . '/app/Http/Controllers/UsersController.php',
'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\CheckRole' => __DIR__ . '/../..' . '/app/Http/Middleware/CheckRole.php',
@ -595,6 +601,11 @@ class ComposerStaticInit9382ab4a444ef313492b08539c8c268d
'Carbon\\Exceptions\\InvalidDateException' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Exceptions/InvalidDateException.php',
'Carbon\\Laravel\\ServiceProvider' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php',
'Carbon\\Translator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Translator.php',
'Chumper\\Zipper\\Facades\\Zipper' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Facades/Zipper.php',
'Chumper\\Zipper\\Repositories\\RepositoryInterface' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Repositories/RepositoryInterface.php',
'Chumper\\Zipper\\Repositories\\ZipRepository' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Repositories/ZipRepository.php',
'Chumper\\Zipper\\Zipper' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/Zipper.php',
'Chumper\\Zipper\\ZipperServiceProvider' => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper/ZipperServiceProvider.php',
'Cron\\AbstractField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/AbstractField.php',
'Cron\\CronExpression' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/CronExpression.php',
'Cron\\DayOfMonthField' => __DIR__ . '/..' . '/mtdowling/cron-expression/src/Cron/DayOfMonthField.php',

View File

@ -205,6 +205,68 @@
"translator"
]
},
{
"name": "chumper/zipper",
"version": "v1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/Chumper/Zipper.git",
"reference": "6a1733c34d67c3952b8439afb36ad4ea5c3ceacb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Chumper/Zipper/zipball/6a1733c34d67c3952b8439afb36ad4ea5c3ceacb",
"reference": "6a1733c34d67c3952b8439afb36ad4ea5c3ceacb",
"shasum": ""
},
"require": {
"illuminate/filesystem": "^5.0",
"illuminate/support": "^5.0",
"php": ">=5.6.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.7"
},
"time": "2017-07-17T08:05:10+00:00",
"type": "library",
"extra": {
"laravel": {
"providers": [
"Chumper\\Zipper\\ZipperServiceProvider"
],
"aliases": {
"Zipper": "Chumper\\Zipper\\Zipper"
}
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Chumper\\Zipper\\": "src/Chumper/Zipper"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache2"
],
"authors": [
{
"name": "Nils Plaschke",
"email": "github@nilsplaschke.de",
"homepage": "http://nilsplaschke.de",
"role": "Developer"
}
],
"description": "This is a little neat helper for the ZipArchive methods with handy functions",
"homepage": "http://github.com/Chumper/zipper",
"keywords": [
"archive",
"laravel",
"zip"
]
},
{
"name": "devfactory/minify",
"version": "1.0.7",
@ -473,17 +535,17 @@
},
{
"name": "egulias/email-validator",
"version": "2.1.5",
"version_normalized": "2.1.5.0",
"version": "2.1.6",
"version_normalized": "2.1.6.0",
"source": {
"type": "git",
"url": "https://github.com/egulias/EmailValidator.git",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3"
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/54859fabea8b3beecbb1a282888d5c990036b9e3",
"reference": "54859fabea8b3beecbb1a282888d5c990036b9e3",
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
"reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
"shasum": ""
},
"require": {
@ -498,7 +560,7 @@
"suggest": {
"ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
},
"time": "2018-08-16T20:49:45+00:00",
"time": "2018-09-25T20:47:26+00:00",
"type": "library",
"extra": {
"branch-alias": {

View File

@ -35,5 +35,10 @@
"psr-4": {
"Egulias\\EmailValidator\\": "EmailValidator"
}
},
"autoload-dev": {
"psr-4": {
"Egulias\\Tests\\": "test"
}
}
}