From 2db38259401a325ecdefaf1b6c1acf42772fadbd Mon Sep 17 00:00:00 2001 From: Miguel Dantas Date: Wed, 24 Jul 2019 07:31:42 +0100 Subject: [PATCH] [CORE][COMPOSER] Added intervention/image --- composer.json | 1 + composer.lock | 233 ++++- vendor/composer/autoload_classmap.php | 156 +++ vendor/composer/autoload_files.php | 2 + vendor/composer/autoload_psr4.php | 3 + vendor/composer/autoload_static.php | 179 ++++ vendor/composer/installed.json | 239 +++++ vendor/guzzlehttp/psr7/CHANGELOG.md | 246 +++++ vendor/guzzlehttp/psr7/LICENSE | 19 + vendor/guzzlehttp/psr7/README.md | 745 +++++++++++++++ vendor/guzzlehttp/psr7/composer.json | 49 + vendor/guzzlehttp/psr7/src/AppendStream.php | 241 +++++ vendor/guzzlehttp/psr7/src/BufferStream.php | 137 +++ vendor/guzzlehttp/psr7/src/CachingStream.php | 138 +++ vendor/guzzlehttp/psr7/src/DroppingStream.php | 42 + vendor/guzzlehttp/psr7/src/FnStream.php | 158 +++ vendor/guzzlehttp/psr7/src/InflateStream.php | 52 + vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 39 + vendor/guzzlehttp/psr7/src/LimitStream.php | 155 +++ vendor/guzzlehttp/psr7/src/MessageTrait.php | 213 +++++ .../guzzlehttp/psr7/src/MultipartStream.php | 153 +++ vendor/guzzlehttp/psr7/src/NoSeekStream.php | 22 + vendor/guzzlehttp/psr7/src/PumpStream.php | 165 ++++ vendor/guzzlehttp/psr7/src/Request.php | 151 +++ vendor/guzzlehttp/psr7/src/Response.php | 154 +++ vendor/guzzlehttp/psr7/src/Rfc7230.php | 18 + vendor/guzzlehttp/psr7/src/ServerRequest.php | 376 ++++++++ vendor/guzzlehttp/psr7/src/Stream.php | 267 ++++++ .../psr7/src/StreamDecoratorTrait.php | 149 +++ vendor/guzzlehttp/psr7/src/StreamWrapper.php | 161 ++++ vendor/guzzlehttp/psr7/src/UploadedFile.php | 316 ++++++ vendor/guzzlehttp/psr7/src/Uri.php | 760 +++++++++++++++ vendor/guzzlehttp/psr7/src/UriNormalizer.php | 216 +++++ vendor/guzzlehttp/psr7/src/UriResolver.php | 219 +++++ vendor/guzzlehttp/psr7/src/functions.php | 899 ++++++++++++++++++ .../guzzlehttp/psr7/src/functions_include.php | 6 + vendor/intervention/image/LICENSE | 9 + vendor/intervention/image/composer.json | 47 + vendor/intervention/image/provides.json | 11 + .../src/Intervention/Image/AbstractColor.php | 229 +++++ .../Intervention/Image/AbstractDecoder.php | 359 +++++++ .../src/Intervention/Image/AbstractDriver.php | 136 +++ .../Intervention/Image/AbstractEncoder.php | 244 +++++ .../src/Intervention/Image/AbstractFont.php | 267 ++++++ .../src/Intervention/Image/AbstractShape.php | 71 ++ .../Image/Commands/AbstractCommand.php | 81 ++ .../Intervention/Image/Commands/Argument.php | 225 +++++ .../Image/Commands/ChecksumCommand.php | 29 + .../Image/Commands/CircleCommand.php | 35 + .../Image/Commands/EllipseCommand.php | 36 + .../Image/Commands/ExifCommand.php | 51 + .../Image/Commands/IptcCommand.php | 66 ++ .../Image/Commands/LineCommand.php | 36 + .../Image/Commands/OrientateCommand.php | 48 + .../Image/Commands/PolygonCommand.php | 49 + .../Image/Commands/PsrResponseCommand.php | 45 + .../Image/Commands/RectangleCommand.php | 36 + .../Image/Commands/ResponseCommand.php | 26 + .../Image/Commands/StreamCommand.php | 25 + .../Image/Commands/TextCommand.php | 34 + .../src/Intervention/Image/Constraint.php | 92 ++ .../Image/Exception/ImageException.php | 8 + .../Exception/InvalidArgumentException.php | 8 + .../Exception/MissingDependencyException.php | 8 + .../Image/Exception/NotFoundException.php | 8 + .../Image/Exception/NotReadableException.php | 8 + .../Image/Exception/NotSupportedException.php | 8 + .../Image/Exception/NotWritableException.php | 8 + .../Image/Exception/RuntimeException.php | 8 + .../src/Intervention/Image/Facades/Image.php | 19 + .../image/src/Intervention/Image/File.php | 92 ++ .../Intervention/Image/Filters/DemoFilter.php | 44 + .../Image/Filters/FilterInterface.php | 16 + .../image/src/Intervention/Image/Gd/Color.php | 227 +++++ .../Image/Gd/Commands/BackupCommand.php | 25 + .../Image/Gd/Commands/BlurCommand.php | 25 + .../Image/Gd/Commands/BrightnessCommand.php | 21 + .../Image/Gd/Commands/ColorizeCommand.php | 29 + .../Image/Gd/Commands/ContrastCommand.php | 21 + .../Image/Gd/Commands/CropCommand.php | 40 + .../Image/Gd/Commands/DestroyCommand.php | 27 + .../Image/Gd/Commands/FillCommand.php | 69 ++ .../Image/Gd/Commands/FitCommand.php | 32 + .../Image/Gd/Commands/FlipCommand.php | 37 + .../Image/Gd/Commands/GammaCommand.php | 21 + .../Image/Gd/Commands/GetSizeCommand.php | 25 + .../Image/Gd/Commands/GreyscaleCommand.php | 19 + .../Image/Gd/Commands/HeightenCommand.php | 28 + .../Image/Gd/Commands/InsertCommand.php | 34 + .../Image/Gd/Commands/InterlaceCommand.php | 23 + .../Image/Gd/Commands/InvertCommand.php | 19 + .../Image/Gd/Commands/LimitColorsCommand.php | 53 ++ .../Image/Gd/Commands/MaskCommand.php | 83 ++ .../Image/Gd/Commands/OpacityCommand.php | 31 + .../Image/Gd/Commands/PickColorCommand.php | 37 + .../Image/Gd/Commands/PixelCommand.php | 25 + .../Image/Gd/Commands/PixelateCommand.php | 21 + .../Image/Gd/Commands/ResetCommand.php | 38 + .../Image/Gd/Commands/ResizeCanvasCommand.php | 83 ++ .../Image/Gd/Commands/ResizeCommand.php | 84 ++ .../Image/Gd/Commands/RotateCommand.php | 30 + .../Image/Gd/Commands/SharpenCommand.php | 34 + .../Image/Gd/Commands/TrimCommand.php | 176 ++++ .../Image/Gd/Commands/WidenCommand.php | 28 + .../src/Intervention/Image/Gd/Decoder.php | 155 +++ .../src/Intervention/Image/Gd/Driver.php | 89 ++ .../src/Intervention/Image/Gd/Encoder.php | 124 +++ .../image/src/Intervention/Image/Gd/Font.php | 256 +++++ .../Image/Gd/Shapes/CircleShape.php | 40 + .../Image/Gd/Shapes/EllipseShape.php | 65 ++ .../Image/Gd/Shapes/LineShape.php | 90 ++ .../Image/Gd/Shapes/PolygonShape.php | 49 + .../Image/Gd/Shapes/RectangleShape.php | 76 ++ .../image/src/Intervention/Image/Image.php | 370 +++++++ .../src/Intervention/Image/ImageManager.php | 142 +++ .../Intervention/Image/ImageManagerStatic.php | 88 ++ .../Image/ImageServiceProvider.php | 87 ++ .../Image/ImageServiceProviderLaravel4.php | 112 +++ .../Image/ImageServiceProviderLaravel5.php | 89 ++ .../Image/ImageServiceProviderLeague.php | 42 + .../Image/ImageServiceProviderLumen.php | 34 + .../src/Intervention/Image/Imagick/Color.php | 279 ++++++ .../Image/Imagick/Commands/BackupCommand.php | 25 + .../Image/Imagick/Commands/BlurCommand.php | 21 + .../Imagick/Commands/BrightnessCommand.php | 21 + .../Imagick/Commands/ColorizeCommand.php | 44 + .../Imagick/Commands/ContrastCommand.php | 21 + .../Image/Imagick/Commands/CropCommand.php | 45 + .../Image/Imagick/Commands/DestroyCommand.php | 27 + .../Image/Imagick/Commands/ExifCommand.php | 63 ++ .../Image/Imagick/Commands/FillCommand.php | 105 ++ .../Image/Imagick/Commands/FitCommand.php | 42 + .../Image/Imagick/Commands/FlipCommand.php | 27 + .../Image/Imagick/Commands/GammaCommand.php | 21 + .../Image/Imagick/Commands/GetSizeCommand.php | 28 + .../Imagick/Commands/GreyscaleCommand.php | 19 + .../Imagick/Commands/HeightenCommand.php | 28 + .../Image/Imagick/Commands/InsertCommand.php | 33 + .../Imagick/Commands/InterlaceCommand.php | 29 + .../Image/Imagick/Commands/InvertCommand.php | 19 + .../Imagick/Commands/LimitColorsCommand.php | 59 ++ .../Image/Imagick/Commands/MaskCommand.php | 60 ++ .../Image/Imagick/Commands/OpacityCommand.php | 23 + .../Imagick/Commands/PickColorCommand.php | 30 + .../Image/Imagick/Commands/PixelCommand.php | 31 + .../Imagick/Commands/PixelateCommand.php | 27 + .../Image/Imagick/Commands/ResetCommand.php | 40 + .../Imagick/Commands/ResizeCanvasCommand.php | 91 ++ .../Image/Imagick/Commands/ResizeCommand.php | 29 + .../Image/Imagick/Commands/RotateCommand.php | 30 + .../Image/Imagick/Commands/SharpenCommand.php | 21 + .../Image/Imagick/Commands/TrimCommand.php | 121 +++ .../Image/Imagick/Commands/WidenCommand.php | 28 + .../Intervention/Image/Imagick/Decoder.php | 124 +++ .../src/Intervention/Image/Imagick/Driver.php | 74 ++ .../Intervention/Image/Imagick/Encoder.php | 173 ++++ .../src/Intervention/Image/Imagick/Font.php | 121 +++ .../Image/Imagick/Shapes/CircleShape.php | 40 + .../Image/Imagick/Shapes/EllipseShape.php | 66 ++ .../Image/Imagick/Shapes/LineShape.php | 94 ++ .../Image/Imagick/Shapes/PolygonShape.php | 81 ++ .../Image/Imagick/Shapes/RectangleShape.php | 84 ++ .../image/src/Intervention/Image/Point.php | 64 ++ .../image/src/Intervention/Image/Response.php | 78 ++ .../image/src/Intervention/Image/Size.php | 374 ++++++++ .../intervention/image/src/config/config.php | 20 + vendor/psr/http-message/CHANGELOG.md | 36 + vendor/psr/http-message/LICENSE | 19 + vendor/psr/http-message/README.md | 13 + vendor/psr/http-message/composer.json | 26 + .../psr/http-message/src/MessageInterface.php | 187 ++++ .../psr/http-message/src/RequestInterface.php | 129 +++ .../http-message/src/ResponseInterface.php | 68 ++ .../src/ServerRequestInterface.php | 261 +++++ .../psr/http-message/src/StreamInterface.php | 158 +++ .../src/UploadedFileInterface.php | 123 +++ vendor/psr/http-message/src/UriInterface.php | 323 +++++++ vendor/ralouphie/getallheaders/LICENSE | 21 + vendor/ralouphie/getallheaders/README.md | 27 + vendor/ralouphie/getallheaders/composer.json | 26 + .../getallheaders/src/getallheaders.php | 46 + 181 files changed, 17296 insertions(+), 1 deletion(-) create mode 100644 vendor/guzzlehttp/psr7/CHANGELOG.md create mode 100644 vendor/guzzlehttp/psr7/LICENSE create mode 100644 vendor/guzzlehttp/psr7/README.md create mode 100644 vendor/guzzlehttp/psr7/composer.json create mode 100644 vendor/guzzlehttp/psr7/src/AppendStream.php create mode 100644 vendor/guzzlehttp/psr7/src/BufferStream.php create mode 100644 vendor/guzzlehttp/psr7/src/CachingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/DroppingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/FnStream.php create mode 100644 vendor/guzzlehttp/psr7/src/InflateStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LazyOpenStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LimitStream.php create mode 100644 vendor/guzzlehttp/psr7/src/MessageTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/MultipartStream.php create mode 100644 vendor/guzzlehttp/psr7/src/NoSeekStream.php create mode 100644 vendor/guzzlehttp/psr7/src/PumpStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Request.php create mode 100644 vendor/guzzlehttp/psr7/src/Response.php create mode 100644 vendor/guzzlehttp/psr7/src/Rfc7230.php create mode 100644 vendor/guzzlehttp/psr7/src/ServerRequest.php create mode 100644 vendor/guzzlehttp/psr7/src/Stream.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamWrapper.php create mode 100644 vendor/guzzlehttp/psr7/src/UploadedFile.php create mode 100644 vendor/guzzlehttp/psr7/src/Uri.php create mode 100644 vendor/guzzlehttp/psr7/src/UriNormalizer.php create mode 100644 vendor/guzzlehttp/psr7/src/UriResolver.php create mode 100644 vendor/guzzlehttp/psr7/src/functions.php create mode 100644 vendor/guzzlehttp/psr7/src/functions_include.php create mode 100644 vendor/intervention/image/LICENSE create mode 100644 vendor/intervention/image/composer.json create mode 100644 vendor/intervention/image/provides.json create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractColor.php create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractDriver.php create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractFont.php create mode 100644 vendor/intervention/image/src/Intervention/Image/AbstractShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/Argument.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Constraint.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/InvalidArgumentException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/MissingDependencyException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/NotFoundException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/NotReadableException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/NotSupportedException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/NotWritableException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Exception/RuntimeException.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Facades/Image.php create mode 100644 vendor/intervention/image/src/Intervention/Image/File.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Color.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Driver.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Font.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Image.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageManager.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php create mode 100755 vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php create mode 100644 vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Color.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Font.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Point.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Response.php create mode 100644 vendor/intervention/image/src/Intervention/Image/Size.php create mode 100644 vendor/intervention/image/src/config/config.php create mode 100644 vendor/psr/http-message/CHANGELOG.md create mode 100644 vendor/psr/http-message/LICENSE create mode 100644 vendor/psr/http-message/README.md create mode 100644 vendor/psr/http-message/composer.json create mode 100644 vendor/psr/http-message/src/MessageInterface.php create mode 100644 vendor/psr/http-message/src/RequestInterface.php create mode 100644 vendor/psr/http-message/src/ResponseInterface.php create mode 100644 vendor/psr/http-message/src/ServerRequestInterface.php create mode 100644 vendor/psr/http-message/src/StreamInterface.php create mode 100644 vendor/psr/http-message/src/UploadedFileInterface.php create mode 100644 vendor/psr/http-message/src/UriInterface.php create mode 100644 vendor/ralouphie/getallheaders/LICENSE create mode 100644 vendor/ralouphie/getallheaders/README.md create mode 100644 vendor/ralouphie/getallheaders/composer.json create mode 100644 vendor/ralouphie/getallheaders/src/getallheaders.php diff --git a/composer.json b/composer.json index f74aa12d56..d4d2c60cdc 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "embed/embed": "^3.4", "ezyang/htmlpurifier": "^4.10", "hoa/consistency": "^1.17.05.02", + "intervention/image": "^2.5", "masterminds/html5": "^2.6", "mf2/mf2": "^0.4.6", "michelf/php-markdown": "^1.8.0", diff --git a/composer.lock b/composer.lock index b3f7239365..2f74deec1b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b3c53a8219c21ce4513bbbfa1297c5bb", + "content-hash": "4e6cb6938aa6af5b33db71e5793f1b54", "packages": [ { "name": "apereo/phpcas", @@ -288,6 +288,77 @@ ], "time": "2019-07-14T18:58:38+00:00" }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, { "name": "hoa/consistency", "version": "1.17.05.02", @@ -461,6 +532,76 @@ ], "time": "2017-01-16T07:53:27+00:00" }, + { + "name": "intervention/image", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "39eaef720d082ecc54c64bf54541c55f10db546d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/39eaef720d082ecc54c64bf54541c55f10db546d", + "reference": "39eaef720d082ecc54c64bf54541c55f10db546d", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "time": "2019-06-24T14:06:31+00:00" + }, { "name": "masterminds/html5", "version": "2.6.0", @@ -932,6 +1073,96 @@ ], "time": "2019-06-23T16:33:59+00:00" }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, { "name": "stomp-php/stomp-php", "version": "4.5.1", diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 444b94df79..477c0793f2 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -236,6 +236,29 @@ return array( 'Embed\\Providers\\Sailthru' => $vendorDir . '/embed/embed/src/Providers/Sailthru.php', 'Embed\\Providers\\TwitterCards' => $vendorDir . '/embed/embed/src/Providers/TwitterCards.php', 'Embed\\Utils' => $vendorDir . '/embed/embed/src/Utils.php', + 'GuzzleHttp\\Psr7\\AppendStream' => $vendorDir . '/guzzlehttp/psr7/src/AppendStream.php', + 'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php', + 'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php', + 'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php', + 'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php', + 'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php', + 'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php', + 'GuzzleHttp\\Psr7\\MessageTrait' => $vendorDir . '/guzzlehttp/psr7/src/MessageTrait.php', + 'GuzzleHttp\\Psr7\\MultipartStream' => $vendorDir . '/guzzlehttp/psr7/src/MultipartStream.php', + 'GuzzleHttp\\Psr7\\NoSeekStream' => $vendorDir . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php', + 'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php', + 'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => $vendorDir . '/guzzlehttp/psr7/src/Rfc7230.php', + 'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php', + 'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php', + 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'GuzzleHttp\\Psr7\\StreamWrapper' => $vendorDir . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'GuzzleHttp\\Psr7\\UploadedFile' => $vendorDir . '/guzzlehttp/psr7/src/UploadedFile.php', + 'GuzzleHttp\\Psr7\\Uri' => $vendorDir . '/guzzlehttp/psr7/src/Uri.php', + 'GuzzleHttp\\Psr7\\UriNormalizer' => $vendorDir . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'GuzzleHttp\\Psr7\\UriResolver' => $vendorDir . '/guzzlehttp/psr7/src/UriResolver.php', 'HTMLPurifier' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.php', 'HTMLPurifier_Arborize' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php', 'HTMLPurifier_AttrCollections' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier/AttrCollections.php', @@ -501,6 +524,132 @@ return array( 'Hoa\\Exception\\Test\\Unit\\Exception' => $vendorDir . '/hoa/exception/Test/Unit/Exception.php', 'Hoa\\Exception\\Test\\Unit\\Group' => $vendorDir . '/hoa/exception/Test/Unit/Group.php', 'Hoa\\Exception\\Test\\Unit\\Idle' => $vendorDir . '/hoa/exception/Test/Unit/Idle.php', + 'Intervention\\Image\\AbstractColor' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractColor.php', + 'Intervention\\Image\\AbstractDecoder' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractDecoder.php', + 'Intervention\\Image\\AbstractDriver' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractDriver.php', + 'Intervention\\Image\\AbstractEncoder' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractEncoder.php', + 'Intervention\\Image\\AbstractFont' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractFont.php', + 'Intervention\\Image\\AbstractShape' => $vendorDir . '/intervention/image/src/Intervention/Image/AbstractShape.php', + 'Intervention\\Image\\Commands\\AbstractCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php', + 'Intervention\\Image\\Commands\\Argument' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/Argument.php', + 'Intervention\\Image\\Commands\\ChecksumCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php', + 'Intervention\\Image\\Commands\\CircleCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/CircleCommand.php', + 'Intervention\\Image\\Commands\\EllipseCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php', + 'Intervention\\Image\\Commands\\ExifCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/ExifCommand.php', + 'Intervention\\Image\\Commands\\IptcCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/IptcCommand.php', + 'Intervention\\Image\\Commands\\LineCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/LineCommand.php', + 'Intervention\\Image\\Commands\\OrientateCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php', + 'Intervention\\Image\\Commands\\PolygonCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php', + 'Intervention\\Image\\Commands\\PsrResponseCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php', + 'Intervention\\Image\\Commands\\RectangleCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php', + 'Intervention\\Image\\Commands\\ResponseCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php', + 'Intervention\\Image\\Commands\\StreamCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/StreamCommand.php', + 'Intervention\\Image\\Commands\\TextCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Commands/TextCommand.php', + 'Intervention\\Image\\Constraint' => $vendorDir . '/intervention/image/src/Intervention/Image/Constraint.php', + 'Intervention\\Image\\Exception\\ImageException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/ImageException.php', + 'Intervention\\Image\\Exception\\InvalidArgumentException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/InvalidArgumentException.php', + 'Intervention\\Image\\Exception\\MissingDependencyException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/MissingDependencyException.php', + 'Intervention\\Image\\Exception\\NotFoundException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/NotFoundException.php', + 'Intervention\\Image\\Exception\\NotReadableException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/NotReadableException.php', + 'Intervention\\Image\\Exception\\NotSupportedException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/NotSupportedException.php', + 'Intervention\\Image\\Exception\\NotWritableException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/NotWritableException.php', + 'Intervention\\Image\\Exception\\RuntimeException' => $vendorDir . '/intervention/image/src/Intervention/Image/Exception/RuntimeException.php', + 'Intervention\\Image\\Facades\\Image' => $vendorDir . '/intervention/image/src/Intervention/Image/Facades/Image.php', + 'Intervention\\Image\\File' => $vendorDir . '/intervention/image/src/Intervention/Image/File.php', + 'Intervention\\Image\\Filters\\DemoFilter' => $vendorDir . '/intervention/image/src/Intervention/Image/Filters/DemoFilter.php', + 'Intervention\\Image\\Filters\\FilterInterface' => $vendorDir . '/intervention/image/src/Intervention/Image/Filters/FilterInterface.php', + 'Intervention\\Image\\Gd\\Color' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Color.php', + 'Intervention\\Image\\Gd\\Commands\\BackupCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php', + 'Intervention\\Image\\Gd\\Commands\\BlurCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php', + 'Intervention\\Image\\Gd\\Commands\\BrightnessCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ColorizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ContrastCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php', + 'Intervention\\Image\\Gd\\Commands\\CropCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php', + 'Intervention\\Image\\Gd\\Commands\\DestroyCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FillCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FitCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FlipCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GammaCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GetSizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GreyscaleCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php', + 'Intervention\\Image\\Gd\\Commands\\HeightenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InsertCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InterlaceCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InvertCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php', + 'Intervention\\Image\\Gd\\Commands\\LimitColorsCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php', + 'Intervention\\Image\\Gd\\Commands\\MaskCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php', + 'Intervention\\Image\\Gd\\Commands\\OpacityCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PickColorCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PixelCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PixelateCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResetCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResizeCanvasCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\RotateCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php', + 'Intervention\\Image\\Gd\\Commands\\SharpenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php', + 'Intervention\\Image\\Gd\\Commands\\TrimCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php', + 'Intervention\\Image\\Gd\\Commands\\WidenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php', + 'Intervention\\Image\\Gd\\Decoder' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Decoder.php', + 'Intervention\\Image\\Gd\\Driver' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Driver.php', + 'Intervention\\Image\\Gd\\Encoder' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Encoder.php', + 'Intervention\\Image\\Gd\\Font' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Font.php', + 'Intervention\\Image\\Gd\\Shapes\\CircleShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php', + 'Intervention\\Image\\Gd\\Shapes\\EllipseShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php', + 'Intervention\\Image\\Gd\\Shapes\\LineShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php', + 'Intervention\\Image\\Gd\\Shapes\\PolygonShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php', + 'Intervention\\Image\\Gd\\Shapes\\RectangleShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php', + 'Intervention\\Image\\Image' => $vendorDir . '/intervention/image/src/Intervention/Image/Image.php', + 'Intervention\\Image\\ImageManager' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageManager.php', + 'Intervention\\Image\\ImageManagerStatic' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageManagerStatic.php', + 'Intervention\\Image\\ImageServiceProvider' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageServiceProvider.php', + 'Intervention\\Image\\ImageServiceProviderLaravel4' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php', + 'Intervention\\Image\\ImageServiceProviderLaravel5' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php', + 'Intervention\\Image\\ImageServiceProviderLeague' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php', + 'Intervention\\Image\\ImageServiceProviderLumen' => $vendorDir . '/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php', + 'Intervention\\Image\\Imagick\\Color' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Color.php', + 'Intervention\\Image\\Imagick\\Commands\\BackupCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\BlurCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\BrightnessCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ColorizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ContrastCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\CropCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\DestroyCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ExifCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FillCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FitCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FlipCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GammaCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GetSizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GreyscaleCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\HeightenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InsertCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InterlaceCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InvertCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\LimitColorsCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\MaskCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\OpacityCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PickColorCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PixelCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PixelateCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResetCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResizeCanvasCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResizeCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\RotateCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\SharpenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\TrimCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\WidenCommand' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php', + 'Intervention\\Image\\Imagick\\Decoder' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Decoder.php', + 'Intervention\\Image\\Imagick\\Driver' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Driver.php', + 'Intervention\\Image\\Imagick\\Encoder' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Encoder.php', + 'Intervention\\Image\\Imagick\\Font' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Font.php', + 'Intervention\\Image\\Imagick\\Shapes\\CircleShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\EllipseShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\LineShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\PolygonShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\RectangleShape' => $vendorDir . '/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php', + 'Intervention\\Image\\Point' => $vendorDir . '/intervention/image/src/Intervention/Image/Point.php', + 'Intervention\\Image\\Response' => $vendorDir . '/intervention/image/src/Intervention/Image/Response.php', + 'Intervention\\Image\\Size' => $vendorDir . '/intervention/image/src/Intervention/Image/Size.php', 'Masterminds\\HTML5' => $vendorDir . '/masterminds/html5/src/HTML5.php', 'Masterminds\\HTML5\\Elements' => $vendorDir . '/masterminds/html5/src/HTML5/Elements.php', 'Masterminds\\HTML5\\Entities' => $vendorDir . '/masterminds/html5/src/HTML5/Entities.php', @@ -535,6 +684,13 @@ return array( 'ParagonIE\\ConstantTime\\Encoding' => $vendorDir . '/paragonie/constant_time_encoding/src/Encoding.php', 'ParagonIE\\ConstantTime\\Hex' => $vendorDir . '/paragonie/constant_time_encoding/src/Hex.php', 'ParagonIE\\ConstantTime\\RFC4648' => $vendorDir . '/paragonie/constant_time_encoding/src/RFC4648.php', + 'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php', + 'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php', + 'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php', + 'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php', + 'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php', + 'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php', + 'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php', 'Stomp\\Broker\\ActiveMq\\ActiveMq' => $vendorDir . '/stomp-php/stomp-php/src/Broker/ActiveMq/ActiveMq.php', 'Stomp\\Broker\\ActiveMq\\Mode\\ActiveMqMode' => $vendorDir . '/stomp-php/stomp-php/src/Broker/ActiveMq/Mode/ActiveMqMode.php', 'Stomp\\Broker\\ActiveMq\\Mode\\DurableSubscription' => $vendorDir . '/stomp-php/stomp-php/src/Broker/ActiveMq/Mode/DurableSubscription.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index d7eeeb8bbc..dc13f99af1 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -8,6 +8,8 @@ $baseDir = dirname($vendorDir); return array( 'e88992873b7765f9b5710cab95ba5dd7' => $vendorDir . '/hoa/consistency/Prelude.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', '2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '757772e28a0943a9afe83def8db95bdf' => $vendorDir . '/mf2/mf2/Mf2/Parser.php', 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 2bffc42832..f74f9832c0 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -9,12 +9,15 @@ return array( 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'XMPPHP\\' => array($vendorDir . '/diogocomposer/xmpphp/XMPPHP'), 'Stomp\\' => array($vendorDir . '/stomp-php/stomp-php/src'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), 'Michelf\\' => array($vendorDir . '/michelf/php-markdown/Michelf'), 'Masterminds\\' => array($vendorDir . '/masterminds/html5/src'), + 'Intervention\\Image\\' => array($vendorDir . '/intervention/image/src/Intervention/Image'), 'Hoa\\Exception\\' => array($vendorDir . '/hoa/exception'), 'Hoa\\Event\\' => array($vendorDir . '/hoa/event'), 'Hoa\\Consistency\\' => array($vendorDir . '/hoa/consistency'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'Embed\\' => array($vendorDir . '/embed/embed/src'), 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 8627ad9d0c..3240887e5d 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -9,6 +9,8 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 public static $files = array ( 'e88992873b7765f9b5710cab95ba5dd7' => __DIR__ . '/..' . '/hoa/consistency/Prelude.php', '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', '2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php', '757772e28a0943a9afe83def8db95bdf' => __DIR__ . '/..' . '/mf2/mf2/Mf2/Parser.php', 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', @@ -29,6 +31,7 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 ), 'P' => array ( + 'Psr\\Http\\Message\\' => 17, 'ParagonIE\\ConstantTime\\' => 23, ), 'M' => @@ -36,12 +39,20 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 'Michelf\\' => 8, 'Masterminds\\' => 12, ), + 'I' => + array ( + 'Intervention\\Image\\' => 19, + ), 'H' => array ( 'Hoa\\Exception\\' => 14, 'Hoa\\Event\\' => 10, 'Hoa\\Consistency\\' => 16, ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + ), 'E' => array ( 'Embed\\' => 6, @@ -65,6 +76,10 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 array ( 0 => __DIR__ . '/..' . '/stomp-php/stomp-php/src', ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + ), 'ParagonIE\\ConstantTime\\' => array ( 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', @@ -77,6 +92,10 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 array ( 0 => __DIR__ . '/..' . '/masterminds/html5/src', ), + 'Intervention\\Image\\' => + array ( + 0 => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image', + ), 'Hoa\\Exception\\' => array ( 0 => __DIR__ . '/..' . '/hoa/exception', @@ -89,6 +108,10 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 array ( 0 => __DIR__ . '/..' . '/hoa/consistency', ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), 'Embed\\' => array ( 0 => __DIR__ . '/..' . '/embed/embed/src', @@ -347,6 +370,29 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 'Embed\\Providers\\Sailthru' => __DIR__ . '/..' . '/embed/embed/src/Providers/Sailthru.php', 'Embed\\Providers\\TwitterCards' => __DIR__ . '/..' . '/embed/embed/src/Providers/TwitterCards.php', 'Embed\\Utils' => __DIR__ . '/..' . '/embed/embed/src/Utils.php', + 'GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/AppendStream.php', + 'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php', + 'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php', + 'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php', + 'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php', + 'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php', + 'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php', + 'GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MessageTrait.php', + 'GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MultipartStream.php', + 'GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php', + 'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php', + 'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Rfc7230.php', + 'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php', + 'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php', + 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UploadedFile.php', + 'GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Uri.php', + 'GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriResolver.php', 'HTMLPurifier' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.php', 'HTMLPurifier_Arborize' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/Arborize.php', 'HTMLPurifier_AttrCollections' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier/AttrCollections.php', @@ -612,6 +658,132 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 'Hoa\\Exception\\Test\\Unit\\Exception' => __DIR__ . '/..' . '/hoa/exception/Test/Unit/Exception.php', 'Hoa\\Exception\\Test\\Unit\\Group' => __DIR__ . '/..' . '/hoa/exception/Test/Unit/Group.php', 'Hoa\\Exception\\Test\\Unit\\Idle' => __DIR__ . '/..' . '/hoa/exception/Test/Unit/Idle.php', + 'Intervention\\Image\\AbstractColor' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractColor.php', + 'Intervention\\Image\\AbstractDecoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractDecoder.php', + 'Intervention\\Image\\AbstractDriver' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractDriver.php', + 'Intervention\\Image\\AbstractEncoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractEncoder.php', + 'Intervention\\Image\\AbstractFont' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractFont.php', + 'Intervention\\Image\\AbstractShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/AbstractShape.php', + 'Intervention\\Image\\Commands\\AbstractCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php', + 'Intervention\\Image\\Commands\\Argument' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/Argument.php', + 'Intervention\\Image\\Commands\\ChecksumCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php', + 'Intervention\\Image\\Commands\\CircleCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/CircleCommand.php', + 'Intervention\\Image\\Commands\\EllipseCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php', + 'Intervention\\Image\\Commands\\ExifCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/ExifCommand.php', + 'Intervention\\Image\\Commands\\IptcCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/IptcCommand.php', + 'Intervention\\Image\\Commands\\LineCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/LineCommand.php', + 'Intervention\\Image\\Commands\\OrientateCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php', + 'Intervention\\Image\\Commands\\PolygonCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php', + 'Intervention\\Image\\Commands\\PsrResponseCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php', + 'Intervention\\Image\\Commands\\RectangleCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php', + 'Intervention\\Image\\Commands\\ResponseCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php', + 'Intervention\\Image\\Commands\\StreamCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/StreamCommand.php', + 'Intervention\\Image\\Commands\\TextCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Commands/TextCommand.php', + 'Intervention\\Image\\Constraint' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Constraint.php', + 'Intervention\\Image\\Exception\\ImageException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/ImageException.php', + 'Intervention\\Image\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/InvalidArgumentException.php', + 'Intervention\\Image\\Exception\\MissingDependencyException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/MissingDependencyException.php', + 'Intervention\\Image\\Exception\\NotFoundException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/NotFoundException.php', + 'Intervention\\Image\\Exception\\NotReadableException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/NotReadableException.php', + 'Intervention\\Image\\Exception\\NotSupportedException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/NotSupportedException.php', + 'Intervention\\Image\\Exception\\NotWritableException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/NotWritableException.php', + 'Intervention\\Image\\Exception\\RuntimeException' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Exception/RuntimeException.php', + 'Intervention\\Image\\Facades\\Image' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Facades/Image.php', + 'Intervention\\Image\\File' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/File.php', + 'Intervention\\Image\\Filters\\DemoFilter' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Filters/DemoFilter.php', + 'Intervention\\Image\\Filters\\FilterInterface' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Filters/FilterInterface.php', + 'Intervention\\Image\\Gd\\Color' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Color.php', + 'Intervention\\Image\\Gd\\Commands\\BackupCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php', + 'Intervention\\Image\\Gd\\Commands\\BlurCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php', + 'Intervention\\Image\\Gd\\Commands\\BrightnessCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ColorizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ContrastCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php', + 'Intervention\\Image\\Gd\\Commands\\CropCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php', + 'Intervention\\Image\\Gd\\Commands\\DestroyCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FillCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FitCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php', + 'Intervention\\Image\\Gd\\Commands\\FlipCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GammaCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GetSizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\GreyscaleCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php', + 'Intervention\\Image\\Gd\\Commands\\HeightenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InsertCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InterlaceCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php', + 'Intervention\\Image\\Gd\\Commands\\InvertCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php', + 'Intervention\\Image\\Gd\\Commands\\LimitColorsCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php', + 'Intervention\\Image\\Gd\\Commands\\MaskCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php', + 'Intervention\\Image\\Gd\\Commands\\OpacityCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PickColorCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PixelCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php', + 'Intervention\\Image\\Gd\\Commands\\PixelateCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResetCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResizeCanvasCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php', + 'Intervention\\Image\\Gd\\Commands\\ResizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php', + 'Intervention\\Image\\Gd\\Commands\\RotateCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php', + 'Intervention\\Image\\Gd\\Commands\\SharpenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php', + 'Intervention\\Image\\Gd\\Commands\\TrimCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php', + 'Intervention\\Image\\Gd\\Commands\\WidenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php', + 'Intervention\\Image\\Gd\\Decoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Decoder.php', + 'Intervention\\Image\\Gd\\Driver' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Driver.php', + 'Intervention\\Image\\Gd\\Encoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Encoder.php', + 'Intervention\\Image\\Gd\\Font' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Font.php', + 'Intervention\\Image\\Gd\\Shapes\\CircleShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php', + 'Intervention\\Image\\Gd\\Shapes\\EllipseShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php', + 'Intervention\\Image\\Gd\\Shapes\\LineShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php', + 'Intervention\\Image\\Gd\\Shapes\\PolygonShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php', + 'Intervention\\Image\\Gd\\Shapes\\RectangleShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php', + 'Intervention\\Image\\Image' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Image.php', + 'Intervention\\Image\\ImageManager' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageManager.php', + 'Intervention\\Image\\ImageManagerStatic' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageManagerStatic.php', + 'Intervention\\Image\\ImageServiceProvider' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageServiceProvider.php', + 'Intervention\\Image\\ImageServiceProviderLaravel4' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php', + 'Intervention\\Image\\ImageServiceProviderLaravel5' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php', + 'Intervention\\Image\\ImageServiceProviderLeague' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php', + 'Intervention\\Image\\ImageServiceProviderLumen' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php', + 'Intervention\\Image\\Imagick\\Color' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Color.php', + 'Intervention\\Image\\Imagick\\Commands\\BackupCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\BlurCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\BrightnessCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ColorizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ContrastCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\CropCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\DestroyCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ExifCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FillCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FitCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\FlipCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GammaCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GetSizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\GreyscaleCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\HeightenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InsertCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InterlaceCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\InvertCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\LimitColorsCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\MaskCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\OpacityCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PickColorCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PixelCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\PixelateCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResetCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResizeCanvasCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\ResizeCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\RotateCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\SharpenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\TrimCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php', + 'Intervention\\Image\\Imagick\\Commands\\WidenCommand' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php', + 'Intervention\\Image\\Imagick\\Decoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Decoder.php', + 'Intervention\\Image\\Imagick\\Driver' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Driver.php', + 'Intervention\\Image\\Imagick\\Encoder' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Encoder.php', + 'Intervention\\Image\\Imagick\\Font' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Font.php', + 'Intervention\\Image\\Imagick\\Shapes\\CircleShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\EllipseShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\LineShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\PolygonShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php', + 'Intervention\\Image\\Imagick\\Shapes\\RectangleShape' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php', + 'Intervention\\Image\\Point' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Point.php', + 'Intervention\\Image\\Response' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Response.php', + 'Intervention\\Image\\Size' => __DIR__ . '/..' . '/intervention/image/src/Intervention/Image/Size.php', 'Masterminds\\HTML5' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5.php', 'Masterminds\\HTML5\\Elements' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Elements.php', 'Masterminds\\HTML5\\Entities' => __DIR__ . '/..' . '/masterminds/html5/src/HTML5/Entities.php', @@ -646,6 +818,13 @@ class ComposerStaticInit444c3f31864f68a3f466e2c19837e185 'ParagonIE\\ConstantTime\\Encoding' => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src/Encoding.php', 'ParagonIE\\ConstantTime\\Hex' => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src/Hex.php', 'ParagonIE\\ConstantTime\\RFC4648' => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src/RFC4648.php', + 'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php', + 'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php', + 'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php', + 'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php', + 'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php', + 'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php', + 'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php', 'Stomp\\Broker\\ActiveMq\\ActiveMq' => __DIR__ . '/..' . '/stomp-php/stomp-php/src/Broker/ActiveMq/ActiveMq.php', 'Stomp\\Broker\\ActiveMq\\Mode\\ActiveMqMode' => __DIR__ . '/..' . '/stomp-php/stomp-php/src/Broker/ActiveMq/Mode/ActiveMqMode.php', 'Stomp\\Broker\\ActiveMq\\Mode\\DurableSubscription' => __DIR__ . '/..' . '/stomp-php/stomp-php/src/Broker/ActiveMq/Mode/DurableSubscription.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 2caa8f63f5..4f798a3a23 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -291,6 +291,79 @@ "html" ] }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "version_normalized": "1.6.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2019-07-01T23:21:34+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ] + }, { "name": "hoa/consistency", "version": "1.17.05.02", @@ -470,6 +543,78 @@ "library" ] }, + { + "name": "intervention/image", + "version": "2.5.0", + "version_normalized": "2.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "39eaef720d082ecc54c64bf54541c55f10db546d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/39eaef720d082ecc54c64bf54541c55f10db546d", + "reference": "39eaef720d082ecc54c64bf54541c55f10db546d", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "time": "2019-06-24T14:06:31+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ] + }, { "name": "masterminds/html5", "version": "2.6.0", @@ -957,6 +1102,100 @@ "x509" ] }, + { + "name": "psr/http-message", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T14:39:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ] + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders." + }, { "name": "stomp-php/stomp-php", "version": "4.5.1", diff --git a/vendor/guzzlehttp/psr7/CHANGELOG.md b/vendor/guzzlehttp/psr7/CHANGELOG.md new file mode 100644 index 0000000000..8a3743dba5 --- /dev/null +++ b/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -0,0 +1,246 @@ +# Change Log + + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + + +## [Unreleased] + + +## [1.6.0] + +### Added + +- Allowed version `^3.0` of `ralouphie/getallheaders` dependency (#244) +- Added MIME type for WEBP image format (#246) +- Added more validation of values according to PSR-7 and RFC standards, e.g. status code range (#250, #272) + +### Changed + +- Tests don't pass with HHVM 4.0, so HHVM support got dropped. Other libraries like composer have done the same. (#262) +- Accept port number 0 to be valid (#270) + +### Fixed + +- Fixed subsequent reads from `php://input` in ServerRequest (#247) +- Fixed readable/writable detection for certain stream modes (#248) +- Fixed encoding of special characters in the `userInfo` component of an URI (#253) + + +## [1.5.2] - 2018-12-04 + +### Fixed + +- Check body size when getting the message summary + + +## [1.5.1] - 2018-12-04 + +### Fixed + +- Get the summary of a body only if it is readable + + +## [1.5.0] - 2018-12-03 + +### Added + +- Response first-line to response string exception (fixes #145) +- A test for #129 behavior +- `get_message_body_summary` function in order to get the message summary +- `3gp` and `mkv` mime types + +### Changed + +- Clarify exception message when stream is detached + +### Deprecated + +- Deprecated parsing folded header lines as per RFC 7230 + +### Fixed + +- Fix `AppendStream::detach` to not close streams +- `InflateStream` preserves `isSeekable` attribute of the underlying stream +- `ServerRequest::getUriFromGlobals` to support URLs in query parameters + + +Several other fixes and improvements. + + +## [1.4.2] - 2017-03-20 + +### Fixed + +- Reverted BC break to `Uri::resolve` and `Uri::removeDotSegments` by removing + calls to `trigger_error` when deprecated methods are invoked. + + +## [1.4.1] - 2017-02-27 + +### Added + +- Rriggering of silenced deprecation warnings. + +### Fixed + +- Reverted BC break by reintroducing behavior to automagically fix a URI with a + relative path and an authority by adding a leading slash to the path. It's only + deprecated now. + + +## [1.4.0] - 2017-02-21 + +### Added + +- Added common URI utility methods based on RFC 3986 (see documentation in the readme): + - `Uri::isDefaultPort` + - `Uri::isAbsolute` + - `Uri::isNetworkPathReference` + - `Uri::isAbsolutePathReference` + - `Uri::isRelativePathReference` + - `Uri::isSameDocumentReference` + - `Uri::composeComponents` + - `UriNormalizer::normalize` + - `UriNormalizer::isEquivalent` + - `UriResolver::relativize` + +### Changed + +- Ensure `ServerRequest::getUriFromGlobals` returns a URI in absolute form. +- Allow `parse_response` to parse a response without delimiting space and reason. +- Ensure each URI modification results in a valid URI according to PSR-7 discussions. + Invalid modifications will throw an exception instead of returning a wrong URI or + doing some magic. + - `(new Uri)->withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE new file mode 100644 index 0000000000..581d95f920 --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md new file mode 100644 index 0000000000..c60a6a38d3 --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,745 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + + +[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) + + +# Stream implementation + +This package comes with a number of stream implementations and stream +decorators. + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\stream_for('abc, '); +$b = Psr7\stream_for('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\stream_for(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\stream_for(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\stream_for('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. + +This stream decorator skips the first 10 bytes of the given stream to remove +the gzip header, converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + call_user_func($this->callback); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\stream_for('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Function API + +There are various functions available under the `GuzzleHttp\Psr7` namespace. + + +## `function str` + +`function str(MessageInterface $message)` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\str($request); +``` + + +## `function uri_for` + +`function uri_for($uri)` + +This function accepts a string or `Psr\Http\Message\UriInterface` and returns a +UriInterface for the given value. If the value is already a `UriInterface`, it +is returned as-is. + +```php +$uri = GuzzleHttp\Psr7\uri_for('http://example.com'); +assert($uri === GuzzleHttp\Psr7\uri_for($uri)); +``` + + +## `function stream_for` + +`function stream_for($resource = '', array $options = [])` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +* - metadata: Array of custom metadata. +* - size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\stream_for('foo'); +$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\stream_for($generator(100)); +``` + + +## `function parse_header` + +`function parse_header($header)` + +Parse an array of header values containing ";" separated data into an array of +associative arrays representing the header key value pair data of the header. +When a parameter does not contain a value, but just contains a key, this +function will inject a key with a '' string value. + + +## `function normalize_header` + +`function normalize_header($header)` + +Converts an array of header values that may contain comma separated headers +into an array of headers with no comma separated values. + + +## `function modify_request` + +`function modify_request(RequestInterface $request, array $changes)` + +Clone and modify a request with the given changes. This method is useful for +reducing the number of clones needed to mutate a message. + +The changes can be one of: + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `function rewind_body` + +`function rewind_body(MessageInterface $message)` + +Attempts to rewind a message body and throws an exception on failure. The body +of the message will only be rewound if a call to `tell()` returns a value other +than `0`. + + +## `function try_fopen` + +`function try_fopen($filename, $mode)` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an error +handler that checks for errors and throws an exception instead. + + +## `function copy_to_string` + +`function copy_to_string(StreamInterface $stream, $maxLen = -1)` + +Copy the contents of a stream into a string until the given number of bytes +have been read. + + +## `function copy_to_stream` + +`function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)` + +Copy the contents of a stream into another stream until the given number of +bytes have been read. + + +## `function hash` + +`function hash(StreamInterface $stream, $algo, $rawOutput = false)` + +Calculate a hash of a Stream. This method reads the entire stream to calculate +a rolling hash (based on PHP's hash_init functions). + + +## `function readline` + +`function readline(StreamInterface $stream, $maxLength = null)` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `function parse_request` + +`function parse_request($message)` + +Parses a request message string into a request object. + + +## `function parse_response` + +`function parse_response($message)` + +Parses a response message string into a response object. + + +## `function parse_query` + +`function parse_query($str, $urlEncoding = true)` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key value pair +will become an array. This function does not parse nested PHP style arrays into +an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into +`['foo[a]' => '1', 'foo[b]' => '2']`). + + +## `function build_query` + +`function build_query(array $params, $encoding = PHP_QUERY_RFC3986)` + +Build a query string from an array of key value pairs. + +This function can use the return value of parse_query() to build a query string. +This function does not modify the provided keys when an array is encountered +(like http_build_query would). + + +## `function mimetype_from_filename` + +`function mimetype_from_filename($filename)` + +Determines the mimetype of a file by looking at its extension. + + +## `function mimetype_from_extension` + +`function mimetype_from_extension($extension)` + +Maps a file extensions to a mimetype. + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called +manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers +do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 0000000000..168a055b06 --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,49 @@ +{ + "name": "guzzlehttp/psr7", + "type": "library", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8", + "ext-zlib": "*" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000000..472a0d61ba --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,241 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + * + * {@inheritdoc} + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind() + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + . $i . ' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + $this->current++; + } + + $result = $this->streams[$this->current]->read($remaining); + + // Using a loose comparison here to match on '', false, and null + if ($result == null) { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000000..af4d4c2277 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,137 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + // TODO: What should happen here? + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000000..ed68f0861a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,138 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence == SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } + + private function cacheEntireStream() + { + $target = new FnStream(['write' => 'strlen']); + copy_to_stream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000000..8935c80d72 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php new file mode 100644 index 0000000000..73daea6f37 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -0,0 +1,158 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * @throws \LogicException + */ + public function __wakeup() + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind() + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET) + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000000..5e4f6028ca --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,52 @@ +read(10); + $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); + // Skip the header, that is 10 + length of filename + 1 (nil) bytes + $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); + $resource = StreamWrapper::getResource($stream); + stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } + + /** + * @param StreamInterface $stream + * @param $header + * @return int + */ + private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) + { + $filename_header_length = 0; + + if (substr(bin2hex($header), 6, 2) === '08') { + // we have a filename, read until nil + $filename_header_length = 1; + while ($stream->read(1) !== chr(0)) { + $filename_header_length++; + } + } + + return $filename_header_length; + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000000..02cec3af49 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,39 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return stream_for(try_fopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000000..e4f239e30f --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,155 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset %s with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit($limit) + { + $this->limit = $limit; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000000..a7966d10cf --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,213 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header) + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (is_int($header)) { + // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec + // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. + $header = (string) $header; + } + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + private function normalizeHeaderValue($value) + { + if (!is_array($value)) { + return $this->trimHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimHeaderValues($value); + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return trim((string) $value, " \t"); + }, $values); + } + + private function assertHeader($header) + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if ($header === '') { + throw new \InvalidArgumentException('Header name can not be empty.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000000..c0fd584f75 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,153 @@ +boundary = $boundary ?: sha1(uniqid('', true)); + $this->stream = $this->createStream($elements); + } + + /** + * Get the boundary + * + * @return string + */ + public function getBoundary() + { + return $this->boundary; + } + + public function isWritable() + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + */ + private function getHeaders(array $headers) + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements) + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(stream_for("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element) + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = stream_for($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if (substr($uri, 0, 6) !== 'php://') { + $element['filename'] = $uri; + } + } + + list($body, $headers) = $this->createElement( + $element['name'], + $element['contents'], + isset($element['filename']) ? $element['filename'] : null, + isset($element['headers']) ? $element['headers'] : [] + ); + + $stream->addStream(stream_for($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(stream_for("\r\n")); + } + + /** + * @return array + */ + private function createElement($name, StreamInterface $stream, $filename, array $headers) + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf('form-data; name="%s"; filename="%s"', + $name, + basename($filename)) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = mimetype_from_filename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000000..233221805e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,22 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + try { + return copy_to_string($this); + } catch (\Exception $e) { + return ''; + } + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000000..59f337db11 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,151 @@ +assertMethod($method); + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + } + + public function getRequestTarget() + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target == '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget) + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + public function getMethod() + { + return $this->method; + } + + public function withMethod($method) + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri() + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false) + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri() + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + private function assertMethod($method) + { + if (!is_string($method) || $method === '') { + throw new \InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000000..e7e04d86a6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,154 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase = ''; + + /** @var int */ + private $statusCode = 200; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|null|resource|StreamInterface $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + $status = 200, + array $headers = [], + $body = null, + $version = '1.1', + $reason = null + ) { + $this->assertStatusCodeIsInteger($status); + $status = (int) $status; + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::$phrases[$this->statusCode])) { + $this->reasonPhrase = self::$phrases[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = '') + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { + $reasonPhrase = self::$phrases[$new->statusCode]; + } + $new->reasonPhrase = $reasonPhrase; + return $new; + } + + private function assertStatusCodeIsInteger($statusCode) + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange($statusCode) + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000000..505e4742b6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,18 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000000..1a09a6c87c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,376 @@ +serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files A array which respect $_FILES structure + * @throws InvalidArgumentException for unrecognized values + * @return array + */ + public static function normalizeFiles(array $files) + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * @return array|UploadedFileInterface + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @param array $files + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []) + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key], + 'error' => $files['error'][$key], + 'name' => $files['name'][$key], + 'type' => $files['type'][$key], + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + * + * @return ServerRequestInterface + */ + public static function fromGlobals() + { + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority($authority) + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = isset($parts['host']) ? $parts['host'] : null; + $port = isset($parts['port']) ? $parts['port'] : null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + * + * @return UriInterface + */ + public static function getUriFromGlobals() + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + + /** + * {@inheritdoc} + */ + public function getServerParams() + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles() + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + */ + public function withUploadedFiles(array $uploadedFiles) + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams() + { + return $this->cookieParams; + } + + /** + * {@inheritdoc} + */ + public function withCookieParams(array $cookies) + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams() + { + return $this->queryParams; + } + + /** + * {@inheritdoc} + */ + public function withQueryParams(array $query) + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + */ + public function withParsedBody($data) + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + /** + * {@inheritdoc} + */ + public function withAttribute($attribute, $value) + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutAttribute($attribute) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000000..d9e7409c7c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,267 @@ +size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + try { + $this->seek(0); + return (string) stream_get_contents($this->stream); + } catch (\Exception $e) { + return ''; + } + } + + public function getContents() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $contents = stream_get_contents($this->stream); + + if ($contents === false) { + throw new \RuntimeException('Unable to read stream contents'); + } + + return $contents; + } + + public function close() + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $whence = (int) $whence; + + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + . $offset . ' with whence ' . var_export($whence, true)); + } + } + + public function read($length) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + $string = fread($this->stream, $length); + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000000..daec6f52ea --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,149 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @param string $name Name of the property (allows "stream" only). + * + * @return StreamInterface + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array([$this->stream, $method], $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000000..0f3a2856a2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,161 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @param StreamInterface $stream + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream] + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + $this->stream->seek($offset, $whence); + + return true; + } + + public function stream_cast($cast_as) + { + $stream = clone($this->stream); + + return $stream->detach(); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } + + public function url_stat($path, $flags) + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000000..e62bd5c807 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,316 @@ +setError($errorStatus); + $this->setSize($size); + $this->setClientFilename($clientFilename); + $this->setClientMediaType($clientMediaType); + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param mixed $streamOrFile + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile) + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @param int $error + * @throws InvalidArgumentException + */ + private function setError($error) + { + if (false === is_int($error)) { + throw new InvalidArgumentException( + 'Upload file error status must be an integer' + ); + } + + if (false === in_array($error, UploadedFile::$errors)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + /** + * @param int $size + * @throws InvalidArgumentException + */ + private function setSize($size) + { + if (false === is_int($size)) { + throw new InvalidArgumentException( + 'Upload file size must be an integer' + ); + } + + $this->size = $size; + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringOrNull($param) + { + return in_array(gettype($param), ['string', 'NULL']); + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringNotEmpty($param) + { + return is_string($param) && false === empty($param); + } + + /** + * @param string|null $clientFilename + * @throws InvalidArgumentException + */ + private function setClientFilename($clientFilename) + { + if (false === $this->isStringOrNull($clientFilename)) { + throw new InvalidArgumentException( + 'Upload file client filename must be a string or null' + ); + } + + $this->clientFilename = $clientFilename; + } + + /** + * @param string|null $clientMediaType + * @throws InvalidArgumentException + */ + private function setClientMediaType($clientMediaType) + { + if (false === $this->isStringOrNull($clientMediaType)) { + throw new InvalidArgumentException( + 'Upload file client media type must be a string or null' + ); + } + + $this->clientMediaType = $clientMediaType; + } + + /** + * Return true if there is no upload error + * + * @return boolean + */ + private function isOk() + { + return $this->error === UPLOAD_ERR_OK; + } + + /** + * @return boolean + */ + public function isMoved() + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive() + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + /** + * {@inheritdoc} + * @throws RuntimeException if the upload was not successful. + */ + public function getStream() + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + return new LazyOpenStream($this->file, 'r+'); + } + + /** + * {@inheritdoc} + * + * @see http://php.net/is_uploaded_file + * @see http://php.net/move_uploaded_file + * @param string $targetPath Path to which to move the uploaded file. + * @throws RuntimeException if the upload was not successful. + * @throws InvalidArgumentException if the $path specified is invalid. + * @throws RuntimeException on any error during the move operation, or on + * the second or subsequent call to the method. + */ + public function moveTo($targetPath) + { + $this->validateActive(); + + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + $this->moved = php_sapi_name() == 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + copy_to_stream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + /** + * {@inheritdoc} + * + * @return int|null The file size in bytes or null if unknown. + */ + public function getSize() + { + return $this->size; + } + + /** + * {@inheritdoc} + * + * @see http://php.net/manual/en/features.file-upload.errors.php + * @return int One of PHP's UPLOAD_ERR_XXX constants. + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + * + * @return string|null The filename sent by the client or null if none + * was provided. + */ + public function getClientFilename() + { + return $this->clientFilename; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType() + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000000..825a25eedb --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,760 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; + private static $charSubDelims = '!\$&\'\(\)\*\+,;='; + private static $replaceQuery = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** + * @param string $uri URI to parse + */ + public function __construct($uri = '') + { + // weak type check to also accept null until we can add scalar type hints + if ($uri != '') { + $parts = parse_url($uri); + if ($parts === false) { + throw new \InvalidArgumentException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + public function __toString() + { + return self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @param string $scheme + * @param string $authority + * @param string $path + * @param string $query + * @param string $fragment + * + * @return string + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents($scheme, $authority, $path, $query, $fragment) + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + + if ($authority != ''|| $scheme === 'file') { + $uri .= '//' . $authority; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?' . $query; + } + + if ($fragment != '') { + $uri .= '#' . $fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + * + * @param UriInterface $uri + * + * @return bool + */ + public static function isDefaultPort(UriInterface $uri) + { + return $uri->getPort() === null + || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @param UriInterface $uri + * + * @return bool + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Removes dot segments from a path and returns the new path. + * + * @param string $path + * + * @return string + * + * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. + * @see UriResolver::removeDotSegments + */ + public static function removeDotSegments($path) + { + return UriResolver::removeDotSegments($path); + } + + /** + * Converts the relative URI into a new URI that is resolved against the base URI. + * + * @param UriInterface $base Base URI + * @param string|UriInterface $rel Relative URI + * + * @return UriInterface + * + * @deprecated since version 1.4. Use UriResolver::resolve instead. + * @see UriResolver::resolve + */ + public static function resolve(UriInterface $base, $rel) + { + if (!($rel instanceof UriInterface)) { + $rel = new self($rel); + } + + return UriResolver::resolve($base, $rel); + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + * + * @return UriInterface + */ + public static function withoutQueryValue(UriInterface $uri, $key) + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + * + * @return UriInterface + */ + public static function withQueryValue(UriInterface $uri, $key, $value) + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + * + * @return UriInterface + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString($key, $value); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @param array $parts + * + * @return UriInterface + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws \InvalidArgumentException If the components do not form a valid URI. + */ + public static function fromParts(array $parts) + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme() + { + return $this->scheme; + } + + public function getAuthority() + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo() + { + return $this->userInfo; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + + public function getPath() + { + return $this->path; + } + + public function getQuery() + { + return $this->query; + } + + public function getFragment() + { + return $this->fragment; + } + + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null) + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->validateState(); + + return $new; + } + + public function withHost($host) + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->validateState(); + + return $new; + } + + public function withPort($port) + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path) + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->validateState(); + + return $new; + } + + public function withQuery($query) + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + public function withFragment($fragment) + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts) + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + } + + $this->removeDefaultPort(); + } + + /** + * @param string $scheme + * + * @return string + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme) + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return strtolower($scheme); + } + + /** + * @param string $component + * + * @return string + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component) + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param string $host + * + * @return string + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host) + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return strtolower($host); + } + + /** + * @param int|null $port + * + * @return int|null + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port) + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (0 > $port || 0xffff < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param UriInterface $uri + * @param array $keys + * + * @return array + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + /** + * @param string $key + * @param string|null $value + * + * @return string + */ + private static function generateQueryString($key, $value) + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::$replaceQuery); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::$replaceQuery); + } + + return $queryString; + } + + private function removeDefaultPort() + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param string $path + * + * @return string + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path) + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param string $str + * + * @return string + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str) + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match) + { + return rawurlencode($match[0]); + } + + private function validateState() + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && $this->path[0] !== '/') { + @trigger_error( + 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . + 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', + E_USER_DEPRECATED + ); + $this->path = '/'. $this->path; + //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000000..384c29e508 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,216 @@ +getPath() === '' && + ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri) + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match) { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri) + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000000..c1cb8a275a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,219 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + * + * @param UriInterface $base Base URI + * @param UriInterface $target Target URI + * + * @return UriInterface The relative URI reference + */ + public static function relativize(UriInterface $base, UriInterface $target) + { + if ($target->getScheme() !== '' && + ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target) + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php new file mode 100644 index 0000000000..8e6dafe68e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -0,0 +1,899 @@ +getMethod() . ' ' + . $message->getRequestTarget()) + . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' + . $message->getStatusCode() . ' ' + . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + + return "{$msg}\r\n\r\n" . $message->getBody(); +} + +/** + * Returns a UriInterface for the given value. + * + * This function accepts a string or {@see Psr\Http\Message\UriInterface} and + * returns a UriInterface for the given value. If the value is already a + * `UriInterface`, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @return UriInterface + * @throws \InvalidArgumentException + */ +function uri_for($uri) +{ + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); +} + +/** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param array $options Additional options + * + * @return StreamInterface + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ +function stream_for($resource = '', array $options = []) +{ + if (is_scalar($resource)) { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + return new Stream($resource, $options); + case 'object': + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return stream_for((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(fopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); +} + +/** + * Parse an array of header values containing ";" separated data into an + * array of associative arrays representing the header key value pair + * data of the header. When a parameter does not contain a value, but just + * contains a key, this function will inject a key with a '' string value. + * + * @param string|array $header Header to parse into components. + * + * @return array Returns the parsed header values. + */ +function parse_header($header) +{ + static $trimmed = "\"' \n\t\r"; + $params = $matches = []; + + foreach (normalize_header($header) as $val) { + $part = []; + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + + return $params; +} + +/** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @return array Returns the normalized header field values. + */ +function normalize_header($header) +{ + if (!is_array($header)) { + return array_map('trim', explode(',', $header)); + } + + $result = []; + foreach ($header as $value) { + foreach ((array) $value as $v) { + if (strpos($v, ',') === false) { + $result[] = $v; + continue; + } + foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { + $result[] = trim($vv); + } + } + } + + return $result; +} + +/** + * Clone and modify a request with the given changes. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + * + * @return RequestInterface + */ +function modify_request(RequestInterface $request, array $changes) +{ + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = _caseless_remove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + return (new ServerRequest( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + } + + return new Request( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion() + ); +} + +/** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` returns a + * value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ +function rewind_body(MessageInterface $message) +{ + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } +} + +/** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * @throws \RuntimeException if the file cannot be opened + */ +function try_fopen($filename, $mode) +{ + $ex = null; + set_error_handler(function () use ($filename, $mode, &$ex) { + $ex = new \RuntimeException(sprintf( + 'Unable to open %s using mode %s: %s', + $filename, + $mode, + func_get_args()[1] + )); + }); + + $handle = fopen($filename, $mode); + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; +} + +/** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * @return string + * @throws \RuntimeException on error. + */ +function copy_to_string(StreamInterface $stream, $maxLen = -1) +{ + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; +} + +/** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ +function copy_to_stream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 +) { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } +} + +/** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws \RuntimeException on error. + */ +function hash( + StreamInterface $stream, + $algo, + $rawOutput = false +) { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; +} + +/** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * + * @return string + */ +function readline(StreamInterface $stream, $maxLength = null) +{ + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + // Using a loose equality here to match on '' and false. + if (null == ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; +} + +/** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + * + * @return Request + */ +function parse_request($message) +{ + $data = _parse_message($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); +} + +/** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + * + * @return Response + */ +function parse_response($message) +{ + $data = _parse_message($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + isset($parts[2]) ? $parts[2] : null + ); +} + +/** + * Parse a query string into an associative array. + * + * If multiple values are found for the same key, the value of that key + * value pair will become an array. This function does not parse nested + * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will + * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + * + * @return array + */ +function parse_query($str, $urlEncoding = true) +{ + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { return $str; }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!isset($result[$key])) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; +} + +/** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of parse_query() to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like http_build_query would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + * @return string + */ +function build_query(array $params, $encoding = PHP_QUERY_RFC3986) +{ + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function ($str) { return $str; }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder($k); + if (!is_array($v)) { + $qs .= $k; + if ($v !== null) { + $qs .= '=' . $encoder($v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + if ($vv !== null) { + $qs .= '=' . $encoder($vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; +} + +/** + * Determines the mimetype of a file by looking at its extension. + * + * @param $filename + * + * @return null|string + */ +function mimetype_from_filename($filename) +{ + return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); +} + +/** + * Maps a file extensions to a mimetype. + * + * @param $extension string The file extension. + * + * @return string|null + * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types + */ +function mimetype_from_extension($extension) +{ + static $mimetypes = [ + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aac' => 'audio/x-aac', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'asc' => 'text/plain', + 'asf' => 'video/x-ms-asf', + 'atom' => 'application/atom+xml', + 'avi' => 'video/x-msvideo', + 'bmp' => 'image/bmp', + 'bz2' => 'application/x-bzip2', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'deb' => 'application/x-debian-package', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dvi' => 'application/x-dvi', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'etx' => 'text/x-setext', + 'flac' => 'audio/flac', + 'flv' => 'video/x-flv', + 'gif' => 'image/gif', + 'gz' => 'application/gzip', + 'htm' => 'text/html', + 'html' => 'text/html', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ini' => 'text/plain', + 'iso' => 'application/x-iso9660-image', + 'jar' => 'application/java-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'text/javascript', + 'json' => 'application/json', + 'latex' => 'application/x-latex', + 'log' => 'text/plain', + 'm4a' => 'audio/mp4', + 'm4v' => 'video/mp4', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mov' => 'video/quicktime', + 'mkv' => 'video/x-matroska', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4v' => 'video/mp4', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'pbm' => 'image/x-portable-bitmap', + 'pdf' => 'application/pdf', + 'pgm' => 'image/x-portable-graymap', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'ppm' => 'image/x-portable-pixmap', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'ps' => 'application/postscript', + 'qt' => 'video/quicktime', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'svg' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 'tar' => 'application/x-tar', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'torrent' => 'application/x-bittorrent', + 'ttf' => 'application/x-font-ttf', + 'txt' => 'text/plain', + 'wav' => 'audio/x-wav', + 'webm' => 'video/webm', + 'webp' => 'image/webp', + 'wma' => 'audio/x-ms-wma', + 'wmv' => 'video/x-ms-wmv', + 'woff' => 'application/x-font-woff', + 'wsdl' => 'application/wsdl+xml', + 'xbm' => 'image/x-xbitmap', + 'xls' => 'application/vnd.ms-excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'yaml' => 'text/yaml', + 'yml' => 'text/yaml', + 'zip' => 'application/zip', + ]; + + $extension = strtolower($extension); + + return isset($mimetypes[$extension]) + ? $mimetypes[$extension] + : null; +} + +/** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + * + * @return array + * @internal + */ +function _parse_message($message) +{ + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + list($rawHeaders, $body) = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + list($startLine, $rawHeaders) = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; +} + +/** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + * + * @return string + * @internal + */ +function _parse_request_uri($path, array $headers) +{ + $hostKey = array_filter(array_keys($headers), function ($k) { + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); +} + +/** + * Get a short summary of the message body + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + * + * @return null|string + */ +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) +{ + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; +} + +/** @internal */ +function _caseless_remove($keys, array $data) +{ + $result = []; + + foreach ($keys as &$key) { + $key = strtolower($key); + } + + foreach ($data as $k => $v) { + if (!in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; +} diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php new file mode 100644 index 0000000000..96a4a83a01 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions_include.php @@ -0,0 +1,6 @@ +=5.4.0", + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.7", + "mockery/mockery": "~0.9.2" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "minimum-stability": "stable" +} diff --git a/vendor/intervention/image/provides.json b/vendor/intervention/image/provides.json new file mode 100644 index 0000000000..a8cd1b6a54 --- /dev/null +++ b/vendor/intervention/image/provides.json @@ -0,0 +1,11 @@ +{ + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": [ + { + "alias": "Image", + "facade": "Intervention\\Image\\Facades\\Image" + } + ] +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractColor.php b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php new file mode 100644 index 0000000000..c9846c6ae5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractColor.php @@ -0,0 +1,229 @@ +parse($value); + } + + /** + * Parses given value as color + * + * @param mixed $value + * @return \Intervention\Image\AbstractColor + */ + public function parse($value) + { + switch (true) { + + case is_string($value): + $this->initFromString($value); + break; + + case is_int($value): + $this->initFromInteger($value); + break; + + case is_array($value): + $this->initFromArray($value); + break; + + case is_object($value): + $this->initFromObject($value); + break; + + case is_null($value): + $this->initFromArray([255, 255, 255, 0]); + break; + + default: + throw new NotReadableException( + "Color format ({$value}) cannot be read." + ); + } + + return $this; + } + + /** + * Formats current color instance into given format + * + * @param string $type + * @return mixed + */ + public function format($type) + { + switch (strtolower($type)) { + + case 'rgba': + return $this->getRgba(); + + case 'hex': + return $this->getHex('#'); + + case 'int': + case 'integer': + return $this->getInt(); + + case 'array': + return $this->getArray(); + + case 'obj': + case 'object': + return $this; + + default: + throw new NotSupportedException( + "Color format ({$type}) is not supported." + ); + } + } + + /** + * Reads RGBA values from string into array + * + * @param string $value + * @return array + */ + protected function rgbaFromString($value) + { + $result = false; + + // parse color string in hexidecimal format like #cccccc or cccccc or ccc + $hexPattern = '/^#?([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i'; + + // parse color string in format rgb(140, 140, 140) + $rgbPattern = '/^rgb ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3})\)$/i'; + + // parse color string in format rgba(255, 0, 0, 0.5) + $rgbaPattern = '/^rgba ?\(([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9]{1,3}), ?([0-9.]{1,4})\)$/i'; + + if (preg_match($hexPattern, $value, $matches)) { + $result = []; + $result[0] = strlen($matches[1]) == '1' ? hexdec($matches[1].$matches[1]) : hexdec($matches[1]); + $result[1] = strlen($matches[2]) == '1' ? hexdec($matches[2].$matches[2]) : hexdec($matches[2]); + $result[2] = strlen($matches[3]) == '1' ? hexdec($matches[3].$matches[3]) : hexdec($matches[3]); + $result[3] = 1; + } elseif (preg_match($rgbPattern, $value, $matches)) { + $result = []; + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = 1; + } elseif (preg_match($rgbaPattern, $value, $matches)) { + $result = []; + $result[0] = ($matches[1] >= 0 && $matches[1] <= 255) ? intval($matches[1]) : 0; + $result[1] = ($matches[2] >= 0 && $matches[2] <= 255) ? intval($matches[2]) : 0; + $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; + $result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0; + } else { + throw new NotReadableException( + "Unable to read color ({$value})." + ); + } + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php new file mode 100644 index 0000000000..de770c328f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDecoder.php @@ -0,0 +1,359 @@ +data = $data; + } + + /** + * Init from given URL + * + * @param string $url + * @return \Intervention\Image\Image + */ + public function initFromUrl($url) + { + + $options = [ + 'http' => [ + 'method'=>"GET", + 'header'=>"Accept-language: en\r\n". + "User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2\r\n" + ] + ]; + + $context = stream_context_create($options); + + + if ($data = @file_get_contents($url, false, $context)) { + return $this->initFromBinary($data); + } + + throw new NotReadableException( + "Unable to init from given url (".$url.")." + ); + } + + /** + * Init from given stream + * + * @param StreamInterface|resource $stream + * @return \Intervention\Image\Image + */ + public function initFromStream($stream) + { + if (!$stream instanceof StreamInterface) { + $stream = new Stream($stream); + } + + try { + $offset = $stream->tell(); + } catch (\RuntimeException $e) { + $offset = 0; + } + + $shouldAndCanSeek = $offset !== 0 && $stream->isSeekable(); + + if ($shouldAndCanSeek) { + $stream->rewind(); + } + + try { + $data = $stream->getContents(); + } catch (\RuntimeException $e) { + $data = null; + } + + if ($shouldAndCanSeek) { + $stream->seek($offset); + } + + if ($data) { + return $this->initFromBinary($data); + } + + throw new NotReadableException( + "Unable to init from given stream" + ); + } + + /** + * Determines if current source data is GD resource + * + * @return boolean + */ + public function isGdResource() + { + if (is_resource($this->data)) { + return (get_resource_type($this->data) == 'gd'); + } + + return false; + } + + /** + * Determines if current source data is Imagick object + * + * @return boolean + */ + public function isImagick() + { + return is_a($this->data, 'Imagick'); + } + + /** + * Determines if current source data is Intervention\Image\Image object + * + * @return boolean + */ + public function isInterventionImage() + { + return is_a($this->data, '\Intervention\Image\Image'); + } + + /** + * Determines if current data is SplFileInfo object + * + * @return boolean + */ + public function isSplFileInfo() + { + return is_a($this->data, 'SplFileInfo'); + } + + /** + * Determines if current data is Symfony UploadedFile component + * + * @return boolean + */ + public function isSymfonyUpload() + { + return is_a($this->data, 'Symfony\Component\HttpFoundation\File\UploadedFile'); + } + + /** + * Determines if current source data is file path + * + * @return boolean + */ + public function isFilePath() + { + if (is_string($this->data)) { + try { + return is_file($this->data); + } catch (\Exception $e) { + return false; + } + } + + return false; + } + + /** + * Determines if current source data is url + * + * @return boolean + */ + public function isUrl() + { + return (bool) filter_var($this->data, FILTER_VALIDATE_URL); + } + + /** + * Determines if current source data is a stream resource + * + * @return boolean + */ + public function isStream() + { + if ($this->data instanceof StreamInterface) return true; + if (!is_resource($this->data)) return false; + if (get_resource_type($this->data) !== 'stream') return false; + + return true; + } + + /** + * Determines if current source data is binary data + * + * @return boolean + */ + public function isBinary() + { + if (is_string($this->data)) { + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $this->data); + return (substr($mime, 0, 4) != 'text' && $mime != 'application/x-empty'); + } + + return false; + } + + /** + * Determines if current source data is data-url + * + * @return boolean + */ + public function isDataUrl() + { + $data = $this->decodeDataUrl($this->data); + + return is_null($data) ? false : true; + } + + /** + * Determines if current source data is base64 encoded + * + * @return boolean + */ + public function isBase64() + { + if (!is_string($this->data)) { + return false; + } + + return base64_encode(base64_decode($this->data)) === str_replace(["\n", "\r"], '', $this->data); + } + + /** + * Initiates new Image from Intervention\Image\Image + * + * @param Image $object + * @return \Intervention\Image\Image + */ + public function initFromInterventionImage($object) + { + return $object; + } + + /** + * Parses and decodes binary image data from data-url + * + * @param string $data_url + * @return string + */ + private function decodeDataUrl($data_url) + { + if (!is_string($data_url)) { + return null; + } + + $pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P.+)$/"; + preg_match($pattern, $data_url, $matches); + + if (is_array($matches) && array_key_exists('data', $matches)) { + return base64_decode($matches['data']); + } + + return null; + } + + /** + * Initiates new image from mixed data + * + * @param mixed $data + * @return \Intervention\Image\Image + */ + public function init($data) + { + $this->data = $data; + + switch (true) { + + case $this->isGdResource(): + return $this->initFromGdResource($this->data); + + case $this->isImagick(): + return $this->initFromImagick($this->data); + + case $this->isInterventionImage(): + return $this->initFromInterventionImage($this->data); + + case $this->isSplFileInfo(): + return $this->initFromPath($this->data->getRealPath()); + + case $this->isBinary(): + return $this->initFromBinary($this->data); + + case $this->isUrl(): + return $this->initFromUrl($this->data); + + case $this->isStream(): + return $this->initFromStream($this->data); + + case $this->isDataUrl(): + return $this->initFromBinary($this->decodeDataUrl($this->data)); + + case $this->isFilePath(): + return $this->initFromPath($this->data); + + // isBase64 has to be after isFilePath to prevent false positives + case $this->isBase64(): + return $this->initFromBinary(base64_decode($this->data)); + + default: + throw new NotReadableException("Image source not readable"); + } + } + + /** + * Decoder object transforms to string source data + * + * @return string + */ + public function __toString() + { + return (string) $this->data; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php new file mode 100644 index 0000000000..d2356ae804 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractDriver.php @@ -0,0 +1,136 @@ +decoder->init($data); + } + + /** + * Encodes given image + * + * @param Image $image + * @param string $format + * @param int $quality + * @return \Intervention\Image\Image + */ + public function encode($image, $format, $quality) + { + return $this->encoder->process($image, $format, $quality); + } + + /** + * Executes named command on given image + * + * @param Image $image + * @param string $name + * @param array $arguments + * @return \Intervention\Image\Commands\AbstractCommand + */ + public function executeCommand($image, $name, $arguments) + { + $commandName = $this->getCommandClassName($name); + $command = new $commandName($arguments); + $command->execute($image); + + return $command; + } + + /** + * Returns classname of given command name + * + * @param string $name + * @return string + */ + private function getCommandClassName($name) + { + $name = mb_convert_case($name[0], MB_CASE_UPPER, 'utf-8') . mb_substr($name, 1, mb_strlen($name)); + + $drivername = $this->getDriverName(); + $classnameLocal = sprintf('\Intervention\Image\%s\Commands\%sCommand', $drivername, ucfirst($name)); + $classnameGlobal = sprintf('\Intervention\Image\Commands\%sCommand', ucfirst($name)); + + if (class_exists($classnameLocal)) { + return $classnameLocal; + } elseif (class_exists($classnameGlobal)) { + return $classnameGlobal; + } + + throw new NotSupportedException( + "Command ({$name}) is not available for driver ({$drivername})." + ); + } + + /** + * Returns name of current driver instance + * + * @return string + */ + public function getDriverName() + { + $reflect = new \ReflectionClass($this); + $namespace = $reflect->getNamespaceName(); + + return substr(strrchr($namespace, "\\"), 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php new file mode 100644 index 0000000000..d3e59eaa4e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractEncoder.php @@ -0,0 +1,244 @@ +setImage($image); + $this->setFormat($format); + $this->setQuality($quality); + + switch (strtolower($this->format)) { + + case 'data-url': + $this->result = $this->processDataUrl(); + break; + + case 'gif': + case 'image/gif': + $this->result = $this->processGif(); + break; + + case 'png': + case 'image/png': + case 'image/x-png': + $this->result = $this->processPng(); + break; + + case 'jpg': + case 'jpeg': + case 'image/jpg': + case 'image/jpeg': + case 'image/pjpeg': + $this->result = $this->processJpeg(); + break; + + case 'tif': + case 'tiff': + case 'image/tiff': + case 'image/tif': + case 'image/x-tif': + case 'image/x-tiff': + $this->result = $this->processTiff(); + break; + + case 'bmp': + case 'bmp': + case 'ms-bmp': + case 'x-bitmap': + case 'x-bmp': + case 'x-ms-bmp': + case 'x-win-bitmap': + case 'x-windows-bmp': + case 'x-xbitmap': + case 'image/ms-bmp': + case 'image/x-bitmap': + case 'image/x-bmp': + case 'image/x-ms-bmp': + case 'image/x-win-bitmap': + case 'image/x-windows-bmp': + case 'image/x-xbitmap': + $this->result = $this->processBmp(); + break; + + case 'ico': + case 'image/x-ico': + case 'image/x-icon': + case 'image/vnd.microsoft.icon': + $this->result = $this->processIco(); + break; + + case 'psd': + case 'image/vnd.adobe.photoshop': + $this->result = $this->processPsd(); + break; + + case 'webp': + case 'image/webp': + case 'image/x-webp': + $this->result = $this->processWebp(); + break; + + default: + throw new NotSupportedException( + "Encoding format ({$format}) is not supported." + ); + } + + $this->setImage(null); + + return $image->setEncoded($this->result); + } + + /** + * Processes and returns encoded image as data-url string + * + * @return string + */ + protected function processDataUrl() + { + $mime = $this->image->mime ? $this->image->mime : 'image/png'; + + return sprintf('data:%s;base64,%s', + $mime, + base64_encode($this->process($this->image, $mime, $this->quality)) + ); + } + + /** + * Sets image to process + * + * @param Image $image + */ + protected function setImage($image) + { + $this->image = $image; + } + + /** + * Determines output format + * + * @param string $format + */ + protected function setFormat($format = null) + { + if ($format == '' && $this->image instanceof Image) { + $format = $this->image->mime; + } + + $this->format = $format ? $format : 'jpg'; + + return $this; + } + + /** + * Determines output quality + * + * @param int $quality + */ + protected function setQuality($quality) + { + $quality = is_null($quality) ? 90 : $quality; + $quality = $quality === 0 ? 1 : $quality; + + if ($quality < 0 || $quality > 100) { + throw new InvalidArgumentException( + 'Quality must range from 0 to 100.' + ); + } + + $this->quality = intval($quality); + + return $this; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractFont.php b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php new file mode 100644 index 0000000000..0b9b979984 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractFont.php @@ -0,0 +1,267 @@ +text = $text; + } + + /** + * Set text to be written + * + * @param String $text + * @return void + */ + public function text($text) + { + $this->text = $text; + + return $this; + } + + /** + * Get text to be written + * + * @return String + */ + public function getText() + { + return $this->text; + } + + /** + * Set font size in pixels + * + * @param int $size + * @return void + */ + public function size($size) + { + $this->size = $size; + + return $this; + } + + /** + * Get font size in pixels + * + * @return int + */ + public function getSize() + { + return $this->size; + } + + /** + * Set color of text to be written + * + * @param mixed $color + * @return void + */ + public function color($color) + { + $this->color = $color; + + return $this; + } + + /** + * Get color of text + * + * @return mixed + */ + public function getColor() + { + return $this->color; + } + + /** + * Set rotation angle of text + * + * @param int $angle + * @return void + */ + public function angle($angle) + { + $this->angle = $angle; + + return $this; + } + + /** + * Get rotation angle of text + * + * @return int + */ + public function getAngle() + { + return $this->angle; + } + + /** + * Set horizontal text alignment + * + * @param string $align + * @return void + */ + public function align($align) + { + $this->align = $align; + + return $this; + } + + /** + * Get horizontal text alignment + * + * @return string + */ + public function getAlign() + { + return $this->align; + } + + /** + * Set vertical text alignment + * + * @param string $valign + * @return void + */ + public function valign($valign) + { + $this->valign = $valign; + + return $this; + } + + /** + * Get vertical text alignment + * + * @return string + */ + public function getValign() + { + return $this->valign; + } + + /** + * Set path to font file + * + * @param string $file + * @return void + */ + public function file($file) + { + $this->file = $file; + + return $this; + } + + /** + * Get path to font file + * + * @return string + */ + public function getFile() + { + return $this->file; + } + + /** + * Checks if current font has access to an applicable font file + * + * @return boolean + */ + protected function hasApplicableFontFile() + { + if (is_string($this->file)) { + return file_exists($this->file); + } + + return false; + } + + /** + * Counts lines of text to be written + * + * @return int + */ + public function countLines() + { + return count(explode(PHP_EOL, $this->text)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/AbstractShape.php b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php new file mode 100644 index 0000000000..cd4a9f1c68 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/AbstractShape.php @@ -0,0 +1,71 @@ +background = $color; + } + + /** + * Set border width and color of current shape + * + * @param int $width + * @param string $color + * @return void + */ + public function border($width, $color = null) + { + $this->border_width = is_numeric($width) ? intval($width) : 0; + $this->border_color = is_null($color) ? '#000000' : $color; + } + + /** + * Determines if current shape has border + * + * @return boolean + */ + public function hasBorder() + { + return ($this->border_width >= 1); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php new file mode 100644 index 0000000000..e31078ceb5 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/AbstractCommand.php @@ -0,0 +1,81 @@ +arguments = $arguments; + } + + /** + * Creates new argument instance from given argument key + * + * @param int $key + * @return \Intervention\Image\Commands\Argument + */ + public function argument($key) + { + return new Argument($this, $key); + } + + /** + * Returns output data of current command + * + * @return mixed + */ + public function getOutput() + { + return $this->output ? $this->output : null; + } + + /** + * Determines if current instance has output data + * + * @return boolean + */ + public function hasOutput() + { + return ! is_null($this->output); + } + + /** + * Sets output data of current command + * + * @param mixed $value + */ + public function setOutput($value) + { + $this->output = $value; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php new file mode 100644 index 0000000000..9538199f69 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/Argument.php @@ -0,0 +1,225 @@ +command = $command; + $this->key = $key; + } + + /** + * Returns name of current arguments command + * + * @return string + */ + public function getCommandName() + { + preg_match("/\\\\([\w]+)Command$/", get_class($this->command), $matches); + return isset($matches[1]) ? lcfirst($matches[1]).'()' : 'Method'; + } + + /** + * Returns value of current argument + * + * @param mixed $default + * @return mixed + */ + public function value($default = null) + { + $arguments = $this->command->arguments; + + if (is_array($arguments)) { + return isset($arguments[$this->key]) ? $arguments[$this->key] : $default; + } + + return $default; + } + + /** + * Defines current argument as required + * + * @return \Intervention\Image\Commands\Argument + */ + public function required() + { + if ( ! array_key_exists($this->key, $this->command->arguments)) { + throw new InvalidArgumentException( + sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName()) + ); + } + + return $this; + } + + /** + * Determines that current argument must be of given type + * + * @return \Intervention\Image\Commands\Argument + */ + public function type($type) + { + $valid = true; + $value = $this->value(); + + if ($value === null) { + return $this; + } + + switch (strtolower($type)) { + case 'bool': + case 'boolean': + $valid = \is_bool($value); + $message = '%s accepts only boolean values as argument %d.'; + break; + case 'int': + case 'integer': + $valid = \is_int($value); + $message = '%s accepts only integer values as argument %d.'; + break; + case 'num': + case 'numeric': + $valid = is_numeric($value); + $message = '%s accepts only numeric values as argument %d.'; + break; + case 'str': + case 'string': + $valid = \is_string($value); + $message = '%s accepts only string values as argument %d.'; + break; + case 'array': + $valid = \is_array($value); + $message = '%s accepts only array as argument %d.'; + break; + case 'closure': + $valid = is_a($value, '\Closure'); + $message = '%s accepts only Closure as argument %d.'; + break; + case 'digit': + $valid = $this->isDigit($value); + $message = '%s accepts only integer values as argument %d.'; + break; + } + + if (! $valid) { + $commandName = $this->getCommandName(); + $argument = $this->key + 1; + + if (isset($message)) { + $message = sprintf($message, $commandName, $argument); + } else { + $message = sprintf('Missing argument for %d.', $argument); + } + + throw new InvalidArgumentException( + $message + ); + } + + return $this; + } + + /** + * Determines that current argument value must be numeric between given values + * + * @return \Intervention\Image\Commands\Argument + */ + public function between($x, $y) + { + $value = $this->type('numeric')->value(); + + if (is_null($value)) { + return $this; + } + + $alpha = min($x, $y); + $omega = max($x, $y); + + if ($value < $alpha || $value > $omega) { + throw new InvalidArgumentException( + sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y) + ); + } + + return $this; + } + + /** + * Determines that current argument must be over a minimum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function min($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v < $value) { + throw new InvalidArgumentException( + sprintf('Argument %d must be at least %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Determines that current argument must be under a maxiumum value + * + * @return \Intervention\Image\Commands\Argument + */ + public function max($value) + { + $v = $this->type('numeric')->value(); + + if (is_null($v)) { + return $this; + } + + if ($v > $value) { + throw new InvalidArgumentException( + sprintf('Argument %d may not be greater than %s.', $this->key, $value) + ); + } + + return $this; + } + + /** + * Checks if value is "PHP" integer (120 but also 120.0) + * + * @param mixed $value + * @return boolean + */ + private function isDigit($value) + { + return is_numeric($value) ? intval($value) == $value : false; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php new file mode 100644 index 0000000000..9acc403082 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ChecksumCommand.php @@ -0,0 +1,29 @@ +getSize(); + + for ($x=0; $x <= ($size->width-1); $x++) { + for ($y=0; $y <= ($size->height-1); $y++) { + $colors[] = $image->pickColor($x, $y, 'array'); + } + } + + $this->setOutput(md5(serialize($colors))); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php new file mode 100644 index 0000000000..c627818e37 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/CircleCommand.php @@ -0,0 +1,35 @@ +argument(0)->type('numeric')->required()->value(); + $x = $this->argument(1)->type('numeric')->required()->value(); + $y = $this->argument(2)->type('numeric')->required()->value(); + $callback = $this->argument(3)->type('closure')->value(); + + $circle_classname = sprintf('\Intervention\Image\%s\Shapes\CircleShape', + $image->getDriver()->getDriverName()); + + $circle = new $circle_classname($diameter); + + if ($callback instanceof Closure) { + $callback($circle); + } + + $circle->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php new file mode 100644 index 0000000000..4637e0205c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/EllipseCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $height = $this->argument(1)->type('numeric')->required()->value(); + $x = $this->argument(2)->type('numeric')->required()->value(); + $y = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $ellipse_classname = sprintf('\Intervention\Image\%s\Shapes\EllipseShape', + $image->getDriver()->getDriverName()); + + $ellipse = new $ellipse_classname($width, $height); + + if ($callback instanceof Closure) { + $callback($ellipse); + } + + $ellipse->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php new file mode 100644 index 0000000000..7103f2fd30 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ExifCommand.php @@ -0,0 +1,51 @@ +argument(0)->value(); + + // try to read exif data from image file + try { + $data = @exif_read_data($image->dirname . '/' . $image->basename); + + if (!is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + } catch (\Exception $e) { + throw new NotReadableException( + sprintf( + "Cannot read the Exif data from the filename (%s) provided ", + $image->dirname . '/' . $image->basename + ), + $e->getCode(), + $e + ); + } + + $this->setOutput($data); + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php new file mode 100644 index 0000000000..ae953d2005 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/IptcCommand.php @@ -0,0 +1,66 @@ +argument(0)->value(); + + $info = []; + @getimagesize($image->dirname .'/'. $image->basename, $info); + + $data = []; + + if (array_key_exists('APP13', $info)) { + $iptc = iptcparse($info['APP13']); + + if (is_array($iptc)) { + $data['DocumentTitle'] = isset($iptc["2#005"][0]) ? $iptc["2#005"][0] : null; + $data['Urgency'] = isset($iptc["2#010"][0]) ? $iptc["2#010"][0] : null; + $data['Category'] = isset($iptc["2#015"][0]) ? $iptc["2#015"][0] : null; + $data['Subcategories'] = isset($iptc["2#020"][0]) ? $iptc["2#020"][0] : null; + $data['Keywords'] = isset($iptc["2#025"][0]) ? $iptc["2#025"] : null; + $data['SpecialInstructions'] = isset($iptc["2#040"][0]) ? $iptc["2#040"][0] : null; + $data['CreationDate'] = isset($iptc["2#055"][0]) ? $iptc["2#055"][0] : null; + $data['CreationTime'] = isset($iptc["2#060"][0]) ? $iptc["2#060"][0] : null; + $data['AuthorByline'] = isset($iptc["2#080"][0]) ? $iptc["2#080"][0] : null; + $data['AuthorTitle'] = isset($iptc["2#085"][0]) ? $iptc["2#085"][0] : null; + $data['City'] = isset($iptc["2#090"][0]) ? $iptc["2#090"][0] : null; + $data['SubLocation'] = isset($iptc["2#092"][0]) ? $iptc["2#092"][0] : null; + $data['State'] = isset($iptc["2#095"][0]) ? $iptc["2#095"][0] : null; + $data['Country'] = isset($iptc["2#101"][0]) ? $iptc["2#101"][0] : null; + $data['OTR'] = isset($iptc["2#103"][0]) ? $iptc["2#103"][0] : null; + $data['Headline'] = isset($iptc["2#105"][0]) ? $iptc["2#105"][0] : null; + $data['Source'] = isset($iptc["2#110"][0]) ? $iptc["2#110"][0] : null; + $data['PhotoSource'] = isset($iptc["2#115"][0]) ? $iptc["2#115"][0] : null; + $data['Copyright'] = isset($iptc["2#116"][0]) ? $iptc["2#116"][0] : null; + $data['Caption'] = isset($iptc["2#120"][0]) ? $iptc["2#120"][0] : null; + $data['CaptionWriter'] = isset($iptc["2#122"][0]) ? $iptc["2#122"][0] : null; + } + } + + if (! is_null($key) && is_array($data)) { + $data = array_key_exists($key, $data) ? $data[$key] : false; + } + + $this->setOutput($data); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php new file mode 100644 index 0000000000..a068c662a2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/LineCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $line_classname = sprintf('\Intervention\Image\%s\Shapes\LineShape', + $image->getDriver()->getDriverName()); + + $line = new $line_classname($x2, $y2); + + if ($callback instanceof Closure) { + $callback($line); + } + + $line->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php new file mode 100644 index 0000000000..552482cb4c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/OrientateCommand.php @@ -0,0 +1,48 @@ +exif('Orientation')) { + + case 2: + $image->flip(); + break; + + case 3: + $image->rotate(180); + break; + + case 4: + $image->rotate(180)->flip(); + break; + + case 5: + $image->rotate(270)->flip(); + break; + + case 6: + $image->rotate(270); + break; + + case 7: + $image->rotate(90)->flip(); + break; + + case 8: + $image->rotate(90); + break; + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php new file mode 100644 index 0000000000..a2fa997889 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PolygonCommand.php @@ -0,0 +1,49 @@ +argument(0)->type('array')->required()->value(); + $callback = $this->argument(1)->type('closure')->value(); + + $vertices_count = count($points); + + // check if number if coordinates is even + if ($vertices_count % 2 !== 0) { + throw new InvalidArgumentException( + "The number of given polygon vertices must be even." + ); + } + + if ($vertices_count < 6) { + throw new InvalidArgumentException( + "You must have at least 3 points in your array." + ); + } + + $polygon_classname = sprintf('\Intervention\Image\%s\Shapes\PolygonShape', + $image->getDriver()->getDriverName()); + + $polygon = new $polygon_classname($points); + + if ($callback instanceof Closure) { + $callback($polygon); + } + + $polygon->applyToImage($image); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php new file mode 100644 index 0000000000..d75cd903b8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/PsrResponseCommand.php @@ -0,0 +1,45 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + //Encoded property will be populated at this moment + $stream = $image->stream($format, $quality); + + $mimetype = finfo_buffer( + finfo_open(FILEINFO_MIME_TYPE), + $image->getEncoded() + ); + + $this->setOutput(new Response( + 200, + [ + 'Content-Type' => $mimetype, + 'Content-Length' => strlen($image->getEncoded()) + ], + $stream + )); + + return true; + } +} \ No newline at end of file diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php new file mode 100644 index 0000000000..24378b3867 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/RectangleCommand.php @@ -0,0 +1,36 @@ +argument(0)->type('numeric')->required()->value(); + $y1 = $this->argument(1)->type('numeric')->required()->value(); + $x2 = $this->argument(2)->type('numeric')->required()->value(); + $y2 = $this->argument(3)->type('numeric')->required()->value(); + $callback = $this->argument(4)->type('closure')->value(); + + $rectangle_classname = sprintf('\Intervention\Image\%s\Shapes\RectangleShape', + $image->getDriver()->getDriverName()); + + $rectangle = new $rectangle_classname($x1, $y1, $x2, $y2); + + if ($callback instanceof Closure) { + $callback($rectangle); + } + + $rectangle->applyToImage($image, $x1, $y1); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php new file mode 100644 index 0000000000..7903b5af4b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/ResponseCommand.php @@ -0,0 +1,26 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + $response = new Response($image, $format, $quality); + + $this->setOutput($response->make()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php new file mode 100644 index 0000000000..111c475690 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/StreamCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + $quality = $this->argument(1)->between(0, 100)->value(); + + $this->setOutput(\GuzzleHttp\Psr7\stream_for( + $image->encode($format, $quality)->getEncoded() + )); + + return true; + } +} \ No newline at end of file diff --git a/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php new file mode 100644 index 0000000000..3c60b4e774 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Commands/TextCommand.php @@ -0,0 +1,34 @@ +argument(0)->required()->value(); + $x = $this->argument(1)->type('numeric')->value(0); + $y = $this->argument(2)->type('numeric')->value(0); + $callback = $this->argument(3)->type('closure')->value(); + + $fontclassname = sprintf('\Intervention\Image\%s\Font', + $image->getDriver()->getDriverName()); + + $font = new $fontclassname($text); + + if ($callback instanceof Closure) { + $callback($font); + } + + $font->applyToImage($image, $x, $y); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Constraint.php b/vendor/intervention/image/src/Intervention/Image/Constraint.php new file mode 100644 index 0000000000..44bdd67a63 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Constraint.php @@ -0,0 +1,92 @@ +size = $size; + } + + /** + * Returns current size of constraint + * + * @return \Intervention\Image\Size + */ + public function getSize() + { + return $this->size; + } + + /** + * Fix the given argument in current constraint + * + * @param int $type + * @return void + */ + public function fix($type) + { + $this->fixed = ($this->fixed & ~(1 << $type)) | (1 << $type); + } + + /** + * Checks if given argument is fixed in current constraint + * + * @param int $type + * @return boolean + */ + public function isFixed($type) + { + return (bool) ($this->fixed & (1 << $type)); + } + + /** + * Fixes aspect ratio in current constraint + * + * @return void + */ + public function aspectRatio() + { + $this->fix(self::ASPECTRATIO); + } + + /** + * Fixes possibility to size up in current constraint + * + * @return void + */ + public function upsize() + { + $this->fix(self::UPSIZE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php new file mode 100644 index 0000000000..83e6b91f28 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Exception/ImageException.php @@ -0,0 +1,8 @@ +dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null; + $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null; + $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null; + $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null; + + if (file_exists($path) && is_file($path)) { + $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path); + } + + return $this; + } + + /** + * Get file size + * + * @return mixed + */ + public function filesize() + { + $path = $this->basePath(); + + if (file_exists($path) && is_file($path)) { + return filesize($path); + } + + return false; + } + + /** + * Get fully qualified path + * + * @return string + */ + public function basePath() + { + if ($this->dirname && $this->basename) { + return ($this->dirname .'/'. $this->basename); + } + + return null; + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php new file mode 100644 index 0000000000..4e8f92b82e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/DemoFilter.php @@ -0,0 +1,44 @@ +size = is_numeric($size) ? intval($size) : self::DEFAULT_SIZE; + } + + /** + * Applies filter effects to given image + * + * @param \Intervention\Image\Image $image + * @return \Intervention\Image\Image + */ + public function applyFilter(Image $image) + { + $image->pixelate($this->size); + $image->greyscale(); + + return $image; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php new file mode 100644 index 0000000000..88f6cbfe03 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Filters/FilterInterface.php @@ -0,0 +1,16 @@ +a = ($value >> 24) & 0xFF; + $this->r = ($value >> 16) & 0xFF; + $this->g = ($value >> 8) & 0xFF; + $this->b = $value & 0xFF; + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + $this->a = $this->alpha2gd($a); + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $this->a = 0; + + } + + $this->r = $r; + $this->g = $g; + $this->b = $b; + } + + /** + * Initiates color object from given string + * + * @param string $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->r = $color[0]; + $this->g = $color[1]; + $this->b = $color[2]; + $this->a = $this->alpha2gd($color[3]); + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param int $r + * @param int $g + * @param int $b + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = 0; + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param int $r + * @param int $g + * @param int $b + * @param float $a + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a = 1) + { + $this->r = intval($r); + $this->g = intval($g); + $this->b = intval($b); + $this->a = $this->alpha2gd($a); + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + throw new NotSupportedException( + "GD colors cannot init from ImagickPixel objects." + ); + } + + /** + * Calculates integer value of current color instance + * + * @return int + */ + public function getInt() + { + return ($this->a << 24) + ($this->r << 16) + ($this->g << 8) + $this->b; + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, $this->r, $this->g, $this->b); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return [$this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)]; + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', $this->r, $this->g, $this->b, round(1 - $this->a / 127, 2)); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param int $tolerance + * @return boolean + */ + public function differs(AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance * 1.27); + + $delta = [ + 'r' => abs($color->r - $this->r), + 'g' => abs($color->g - $this->g), + 'b' => abs($color->b - $this->b), + 'a' => abs($color->a - $this->a) + ]; + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Convert rgba alpha (0-1) value to gd value (0-127) + * + * @param float $input + * @return int + */ + private function alpha2gd($input) + { + $oldMin = 0; + $oldMax = 1; + + $newMin = 127; + $newMax = 0; + + return ceil(((($input- $oldMin) * ($newMax - $newMin)) / ($oldMax - $oldMin)) + $newMin); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php new file mode 100644 index 0000000000..310dc03a96 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BackupCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + + // clone current image resource + $clone = clone $image; + $image->setBackup($clone->getCore(), $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php new file mode 100644 index 0000000000..c4fca0eae3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BlurCommand.php @@ -0,0 +1,25 @@ +argument(0)->between(0, 100)->value(1); + + for ($i=0; $i < intval($amount); $i++) { + imagefilter($image->getCore(), IMG_FILTER_GAUSSIAN_BLUR); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php new file mode 100644 index 0000000000..4e48464b1d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/BrightnessCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_BRIGHTNESS, ($level * 2.55)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php new file mode 100644 index 0000000000..410917b334 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ColorizeCommand.php @@ -0,0 +1,29 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = round($red * 2.55); + $green = round($green * 2.55); + $blue = round($blue * 2.55); + + // apply filter + return imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $red, $green, $blue); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php new file mode 100644 index 0000000000..916c41f828 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ContrastCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1)); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php new file mode 100644 index 0000000000..b7f595421b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/CropCommand.php @@ -0,0 +1,40 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new \Intervention\Image\Exception\InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + return $this->modify($image, 0, 0, $position->x, $position->y, $cropped->width, $cropped->height, $cropped->width, $cropped->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php new file mode 100644 index 0000000000..4503d10fe6 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/DestroyCommand.php @@ -0,0 +1,27 @@ +getCore()); + + // destroy backups + foreach ($image->getBackups() as $backup) { + imagedestroy($backup); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php new file mode 100644 index 0000000000..cf19082100 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FillCommand.php @@ -0,0 +1,69 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $width = $image->getWidth(); + $height = $image->getHeight(); + $resource = $image->getCore(); + + try { + + // set image tile filling + $source = new Decoder; + $tile = $source->init($filling); + imagesettile($image->getCore(), $tile->getCore()); + $filling = IMG_COLOR_TILED; + + } catch (\Intervention\Image\Exception\NotReadableException $e) { + + // set solid color filling + $color = new Color($filling); + $filling = $color->getInt(); + } + + imagealphablending($resource, true); + + if (is_int($x) && is_int($y)) { + + // resource should be visible through transparency + $base = $image->getDriver()->newImage($width, $height)->getCore(); + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // floodfill if exact position is defined + imagefill($resource, $x, $y, $filling); + + // copy filled original over base + imagecopy($base, $resource, 0, 0, 0, 0, $width, $height); + + // set base as new resource-core + $image->setCore($base); + imagedestroy($resource); + + } else { + // fill whole image otherwise + imagefilledrectangle($resource, 0, 0, $width - 1, $height - 1, $filling); + } + + isset($tile) ? imagedestroy($tile->getCore()) : null; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php new file mode 100644 index 0000000000..d861ad94cf --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FitCommand.php @@ -0,0 +1,32 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, $cropped->pivot->x, $cropped->pivot->y, $resized->getWidth(), $resized->getHeight(), $cropped->getWidth(), $cropped->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php new file mode 100644 index 0000000000..aa8f230e86 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/FlipCommand.php @@ -0,0 +1,37 @@ +argument(0)->value('h'); + + $size = $image->getSize(); + $dst = clone $size; + + switch (strtolower($mode)) { + case 2: + case 'v': + case 'vert': + case 'vertical': + $size->pivot->y = $size->height - 1; + $size->height = $size->height * (-1); + break; + + default: + $size->pivot->x = $size->width - 1; + $size->width = $size->width * (-1); + break; + } + + return $this->modify($image, 0, 0, $size->pivot->x, $size->pivot->y, $dst->width, $dst->height, $size->width, $size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php new file mode 100644 index 0000000000..7de0fb8a11 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GammaCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('numeric')->required()->value(); + + return imagegammacorrect($image->getCore(), 1, $gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php new file mode 100644 index 0000000000..9eb7e20922 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GetSizeCommand.php @@ -0,0 +1,25 @@ +setOutput(new Size( + imagesx($image->getCore()), + imagesy($image->getCore()) + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php new file mode 100644 index 0000000000..12921e79ea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php @@ -0,0 +1,19 @@ +getCore(), IMG_FILTER_GRAYSCALE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php new file mode 100644 index 0000000000..d31e9cde0c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php new file mode 100644 index 0000000000..47c7703983 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InsertCommand.php @@ -0,0 +1,34 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + imagealphablending($image->getCore(), true); + return imagecopy($image->getCore(), $watermark->getCore(), $target->x, $target->y, 0, 0, $watermark_size->width, $watermark_size->height); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php new file mode 100644 index 0000000000..e3461cb075 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InterlaceCommand.php @@ -0,0 +1,23 @@ +argument(0)->type('bool')->value(true); + + imageinterlace($image->getCore(), $mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php new file mode 100644 index 0000000000..1a514f1d43 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/InvertCommand.php @@ -0,0 +1,19 @@ +getCore(), IMG_FILTER_NEGATE); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php new file mode 100644 index 0000000000..0baed7e911 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php @@ -0,0 +1,53 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // create empty canvas + $resource = imagecreatetruecolor($size->width, $size->height); + + // define matte + if (is_null($matte)) { + $matte = imagecolorallocatealpha($resource, 255, 255, 255, 127); + } else { + $matte = $image->getDriver()->parseColor($matte)->getInt(); + } + + // fill with matte and copy original image + imagefill($resource, 0, 0, $matte); + + // set transparency + imagecolortransparent($resource, $matte); + + // copy original image + imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height); + + if (is_numeric($count) && $count <= 256) { + // decrease colors + imagetruecolortopalette($resource, true, $count); + } + + // set new resource + $image->setCore($resource); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php new file mode 100644 index 0000000000..4c61429b2c --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/MaskCommand.php @@ -0,0 +1,83 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + $image_size = $image->getSize(); + + // create empty canvas + $canvas = $image->getDriver()->newImage($image_size->width, $image_size->height, [0,0,0,0]); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + $mask_size = $mask->getSize(); + + // resize mask to size of current image (if necessary) + if ($mask_size != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + imagealphablending($canvas->getCore(), false); + + if ( ! $mask_w_alpha) { + // mask from greyscale image + imagefilter($mask->getCore(), IMG_FILTER_GRAYSCALE); + } + + // redraw old image pixel by pixel considering alpha map + for ($x=0; $x < $image_size->width; $x++) { + for ($y=0; $y < $image_size->height; $y++) { + + $color = $image->pickColor($x, $y, 'array'); + $alpha = $mask->pickColor($x, $y, 'array'); + + if ($mask_w_alpha) { + $alpha = $alpha[3]; // use alpha channel as mask + } else { + + if ($alpha[3] == 0) { // transparent as black + $alpha = 0; + } else { + + // $alpha = floatval(round((($alpha[0] + $alpha[1] + $alpha[3]) / 3) / 255, 2)); + + // image is greyscale, so channel doesn't matter (use red channel) + $alpha = floatval(round($alpha[0] / 255, 2)); + } + + } + + // preserve alpha of original image... + if ($color[3] < $alpha) { + $alpha = $color[3]; + } + + // replace alpha value + $color[3] = $alpha; + + // redraw pixel + $canvas->pixel($color, $x, $y); + } + } + + + // replace current image with masked instance + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php new file mode 100644 index 0000000000..48492d24f2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/OpacityCommand.php @@ -0,0 +1,31 @@ +argument(0)->between(0, 100)->required()->value(); + + // get size of image + $size = $image->getSize(); + + // build temp alpha mask + $mask_color = sprintf('rgba(0, 0, 0, %.1F)', $transparency / 100); + $mask = $image->getDriver()->newImage($size->width, $size->height, $mask_color); + + // mask image + $image->mask($mask->getCore(), true); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php new file mode 100644 index 0000000000..bad96f498d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PickColorCommand.php @@ -0,0 +1,37 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = imagecolorat($image->getCore(), $x, $y); + + if ( ! imageistruecolor($image->getCore())) { + $color = imagecolorsforindex($image->getCore(), $color); + $color['alpha'] = round(1 - $color['alpha'] / 127, 2); + } + + $color = new Color($color); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php new file mode 100644 index 0000000000..2a90ce34f4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelCommand.php @@ -0,0 +1,25 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + return imagesetpixel($image->getCore(), $x, $y, $color->getInt()); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php new file mode 100644 index 0000000000..0934797a89 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/PixelateCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('digit')->value(10); + + return imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $size, true); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php new file mode 100644 index 0000000000..12c41bf6e2 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResetCommand.php @@ -0,0 +1,38 @@ +argument(0)->value(); + + if (is_resource($backup = $image->getBackup($backupName))) { + + // destroy current resource + imagedestroy($image->getCore()); + + // clone backup + $backup = $image->getDriver()->cloneCore($backup); + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new RuntimeException( + "Backup not available. Call backup() before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php new file mode 100644 index 0000000000..73f3df308b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -0,0 +1,83 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $transparent = imagecolorallocatealpha($canvas->getCore(), 255, 255, 255, 127); + imagealphablending($canvas->getCore(), false); // do not blend / just overwrite + imagefilledrectangle($canvas->getCore(), $dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1, $transparent); + + // copy image into new canvas + imagecopy($canvas->getCore(), $image->getCore(), $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php new file mode 100644 index 0000000000..382d9709e3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/ResizeCommand.php @@ -0,0 +1,84 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $this->modify($image, 0, 0, 0, 0, $resized->getWidth(), $resized->getHeight(), $image->getWidth(), $image->getHeight()); + + return true; + } + + /** + * Wrapper function for 'imagecopyresampled' + * + * @param Image $image + * @param int $dst_x + * @param int $dst_y + * @param int $src_x + * @param int $src_y + * @param int $dst_w + * @param int $dst_h + * @param int $src_w + * @param int $src_h + * @return boolean + */ + protected function modify($image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) + { + // create new image + $modified = imagecreatetruecolor($dst_w, $dst_h); + + // get current image + $resource = $image->getCore(); + + // preserve transparency + $transIndex = imagecolortransparent($resource); + + if ($transIndex != -1) { + $rgba = imagecolorsforindex($modified, $transIndex); + $transColor = imagecolorallocatealpha($modified, $rgba['red'], $rgba['green'], $rgba['blue'], 127); + imagefill($modified, 0, 0, $transColor); + imagecolortransparent($modified, $transColor); + } else { + imagealphablending($modified, false); + imagesavealpha($modified, true); + } + + // copy content from resource + $result = imagecopyresampled( + $modified, + $resource, + $dst_x, + $dst_y, + $src_x, + $src_y, + $dst_w, + $dst_h, + $src_w, + $src_h + ); + + // set new content as recource + $image->setCore($modified); + + return $result; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php new file mode 100644 index 0000000000..e02b91760e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/RotateCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // restrict rotations beyond 360 degrees, since the end result is the same + $angle %= 360; + + // rotate image + $image->setCore(imagerotate($image->getCore(), $angle, $color->getInt())); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php new file mode 100644 index 0000000000..782e565020 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/SharpenCommand.php @@ -0,0 +1,34 @@ +argument(0)->between(0, 100)->value(10); + + // build matrix + $min = $amount >= 10 ? $amount * -0.01 : 0; + $max = $amount * -0.025; + $abs = ((4 * $min + 4 * $max) * -1) + 1; + $div = 1; + + $matrix = [ + [$min, $max, $min], + [$max, $abs, $max], + [$min, $max, $min] + ]; + + // apply the matrix + return imageconvolution($image->getCore(), $matrix, $div, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php new file mode 100644 index 0000000000..2e36975270 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/TrimCommand.php @@ -0,0 +1,176 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + // default values + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = ['top', 'right', 'bottom', 'left']; + } elseif (is_string($away)) { + $away = [$away]; + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $color = new Color; // color will only be used to compare alpha channel + } else { + $color = $image->pickColor($base_x, $base_y, 'object'); + } + + $top_x = 0; + $top_y = 0; + $bottom_x = $width; + $bottom_y = $height; + + // search upper part of image for colors to trim away + if (in_array('top', $away)) { + + for ($y=0; $y < ceil($height/2); $y++) { + for ($x=0; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_y = max(0, $y - $feather); + break 2; + } + + } + } + + } + + // search left part of image for colors to trim away + if (in_array('left', $away)) { + + for ($x=0; $x < ceil($width/2); $x++) { + for ($y=$top_y; $y < $height; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $top_x = max(0, $x - $feather); + break 2; + } + + } + } + + } + + // search lower part of image for colors to trim away + if (in_array('bottom', $away)) { + + for ($y=($height-1); $y >= floor($height/2)-1; $y--) { + for ($x=$top_x; $x < $width; $x++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_y = min($height, $y+1 + $feather); + break 2; + } + + } + } + + } + + // search right part of image for colors to trim away + if (in_array('right', $away)) { + + for ($x=($width-1); $x >= floor($width/2)-1; $x--) { + for ($y=$top_y; $y < $bottom_y; $y++) { + + $checkColor = $image->pickColor($x, $y, 'object'); + + if ($checkTransparency) { + $checkColor->r = $color->r; + $checkColor->g = $color->g; + $checkColor->b = $color->b; + } + + if ($color->differs($checkColor, $tolerance)) { + $bottom_x = min($width, $x+1 + $feather); + break 2; + } + + } + } + + } + + + // trim parts of image + return $this->modify($image, 0, 0, $top_x, $top_y, ($bottom_x-$top_x), ($bottom_y-$top_y), ($bottom_x-$top_x), ($bottom_y-$top_y)); + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php new file mode 100644 index 0000000000..43000d5dcc --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php new file mode 100644 index 0000000000..6d2d7b4d37 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Decoder.php @@ -0,0 +1,155 @@ +gdResourceToTruecolor($core); + + // build image + $image = $this->initFromGdResource($core); + $image->mime = $mime; + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + return new Image(new Driver, $resource); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + throw new NotSupportedException( + "Gd driver is unable to init from Imagick object." + ); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $resource = @imagecreatefromstring($binary); + + if ($resource === false) { + throw new NotReadableException( + "Unable to init from given binary data." + ); + } + + $image = $this->initFromGdResource($resource); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Transform GD resource into Truecolor version + * + * @param resource $resource + * @return bool + */ + public function gdResourceToTruecolor(&$resource) + { + $width = imagesx($resource); + $height = imagesy($resource); + + // new canvas + $canvas = imagecreatetruecolor($width, $height); + + // fill with transparent color + imagealphablending($canvas, false); + $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127); + imagefilledrectangle($canvas, 0, 0, $width, $height, $transparent); + imagecolortransparent($canvas, $transparent); + imagealphablending($canvas, true); + + // copy original + imagecopy($canvas, $resource, 0, 0, 0, 0, $width, $height); + imagedestroy($resource); + + $resource = $canvas; + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php new file mode 100644 index 0000000000..5f2f23ea37 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Driver.php @@ -0,0 +1,89 @@ +coreAvailable()) { + throw new NotSupportedException( + "GD Library extension not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param int $width + * @param int $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + // create empty resource + $core = imagecreatetruecolor($width, $height); + $image = new Image(new static, $core); + + // set background color + $background = new Color($background); + imagefill($image->getCore(), 0, 0, $background->getInt()); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('gd') && function_exists('gd_info')); + } + + /** + * Returns clone of given core + * + * @return mixed + */ + public function cloneCore($core) + { + $width = imagesx($core); + $height = imagesy($core); + $clone = imagecreatetruecolor($width, $height); + imagealphablending($clone, false); + imagesavealpha($clone, true); + $transparency = imagecolorallocatealpha($clone, 0, 0, 0, 127); + imagefill($clone, 0, 0, $transparency); + + imagecopy($clone, $core, 0, 0, 0, 0, $width, $height); + + return $clone; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php new file mode 100644 index 0000000000..d8cc02178a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Encoder.php @@ -0,0 +1,124 @@ +image->getCore(), null, $this->quality); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_JPEG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + ob_start(); + $resource = $this->image->getCore(); + imagealphablending($resource, false); + imagesavealpha($resource, true); + imagepng($resource, null, -1); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_PNG); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + ob_start(); + imagegif($this->image->getCore()); + $this->image->mime = image_type_to_mime_type(IMAGETYPE_GIF); + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + protected function processWebp() + { + if ( ! function_exists('imagewebp')) { + throw new NotSupportedException( + "Webp format is not supported by PHP installation." + ); + } + + ob_start(); + imagewebp($this->image->getCore(), null, $this->quality); + $this->image->mime = defined('IMAGETYPE_WEBP') ? image_type_to_mime_type(IMAGETYPE_WEBP) : 'image/webp'; + $buffer = ob_get_contents(); + ob_end_clean(); + + return $buffer; + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + throw new NotSupportedException( + "TIFF format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + throw new NotSupportedException( + "BMP format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + throw new NotSupportedException( + "ICO format is not supported by Gd Driver." + ); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + throw new NotSupportedException( + "PSD format is not supported by Gd Driver." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Font.php b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php new file mode 100644 index 0000000000..47a7b15bd8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Font.php @@ -0,0 +1,256 @@ +size * 0.75)); + } + + /** + * Filter function to access internal integer font values + * + * @return int + */ + private function getInternalFont() + { + $internalfont = is_null($this->file) ? 1 : $this->file; + $internalfont = is_numeric($internalfont) ? $internalfont : false; + + if ( ! in_array($internalfont, [1, 2, 3, 4, 5])) { + throw new NotSupportedException( + sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont) + ); + } + + return intval($internalfont); + } + + /** + * Get width of an internal font character + * + * @return int + */ + private function getInternalFontWidth() + { + return $this->getInternalFont() + 4; + } + + /** + * Get height of an internal font character + * + * @return int + */ + private function getInternalFontHeight() + { + switch ($this->getInternalFont()) { + case 1: + return 8; + + case 2: + return 14; + + case 3: + return 14; + + case 4: + return 16; + + case 5: + return 16; + } + } + + /** + * Calculates bounding box of current font setting + * + * @return Array + */ + public function getBoxSize() + { + $box = []; + + if ($this->hasApplicableFontFile()) { + + // get bounding box with angle 0 + $box = imagettfbbox($this->getPointSize(), 0, $this->file, $this->text); + + // rotate points manually + if ($this->angle != 0) { + + $angle = pi() * 2 - $this->angle * pi() * 2 / 360; + + for ($i=0; $i<4; $i++) { + $x = $box[$i * 2]; + $y = $box[$i * 2 + 1]; + $box[$i * 2] = cos($angle) * $x - sin($angle) * $y; + $box[$i * 2 + 1] = sin($angle) * $x + cos($angle) * $y; + } + } + + $box['width'] = intval(abs($box[4] - $box[0])); + $box['height'] = intval(abs($box[5] - $box[1])); + + } else { + + // get current internal font size + $width = $this->getInternalFontWidth(); + $height = $this->getInternalFontHeight(); + + if (strlen($this->text) == 0) { + // no text -> no boxsize + $box['width'] = 0; + $box['height'] = 0; + } else { + // calculate boxsize + $box['width'] = strlen($this->text) * $width; + $box['height'] = $height; + } + } + + return $box; + } + + /** + * Draws font to given image at given position + * + * @param Image $image + * @param int $posx + * @param int $posy + * @return void + */ + public function applyToImage(Image $image, $posx = 0, $posy = 0) + { + // parse text color + $color = new Color($this->color); + + if ($this->hasApplicableFontFile()) { + + if ($this->angle != 0 || is_string($this->align) || is_string($this->valign)) { + + $box = $this->getBoxSize(); + + $align = is_null($this->align) ? 'left' : strtolower($this->align); + $valign = is_null($this->valign) ? 'bottom' : strtolower($this->valign); + + // correction on position depending on v/h alignment + switch ($align.'-'.$valign) { + + case 'center-top': + $posx = $posx - round(($box[6]+$box[4])/2); + $posy = $posy - round(($box[7]+$box[5])/2); + break; + + case 'right-top': + $posx = $posx - $box[4]; + $posy = $posy - $box[5]; + break; + + case 'left-top': + $posx = $posx - $box[6]; + $posy = $posy - $box[7]; + break; + + case 'center-center': + case 'center-middle': + $posx = $posx - round(($box[0]+$box[4])/2); + $posy = $posy - round(($box[1]+$box[5])/2); + break; + + case 'right-center': + case 'right-middle': + $posx = $posx - round(($box[2]+$box[4])/2); + $posy = $posy - round(($box[3]+$box[5])/2); + break; + + case 'left-center': + case 'left-middle': + $posx = $posx - round(($box[0]+$box[6])/2); + $posy = $posy - round(($box[1]+$box[7])/2); + break; + + case 'center-bottom': + $posx = $posx - round(($box[0]+$box[2])/2); + $posy = $posy - round(($box[1]+$box[3])/2); + break; + + case 'right-bottom': + $posx = $posx - $box[2]; + $posy = $posy - $box[3]; + break; + + case 'left-bottom': + $posx = $posx - $box[0]; + $posy = $posy - $box[1]; + break; + } + } + + // enable alphablending for imagettftext + imagealphablending($image->getCore(), true); + + // draw ttf text + imagettftext($image->getCore(), $this->getPointSize(), $this->angle, $posx, $posy, $color->getInt(), $this->file, $this->text); + + } else { + + // get box size + $box = $this->getBoxSize(); + $width = $box['width']; + $height = $box['height']; + + // internal font specific position corrections + if ($this->getInternalFont() == 1) { + $top_correction = 1; + $bottom_correction = 2; + } elseif ($this->getInternalFont() == 3) { + $top_correction = 2; + $bottom_correction = 4; + } else { + $top_correction = 3; + $bottom_correction = 4; + } + + // x-position corrections for horizontal alignment + switch (strtolower($this->align)) { + case 'center': + $posx = ceil($posx - ($width / 2)); + break; + + case 'right': + $posx = ceil($posx - $width) + 1; + break; + } + + // y-position corrections for vertical alignment + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + $posy = ceil($posy - ($height / 2)); + break; + + case 'top': + $posy = ceil($posy - $top_correction); + break; + + default: + case 'bottom': + $posy = round($posy - $height + $bottom_correction); + break; + } + + // draw text + imagestring($image->getCore(), $this->getInternalFont(), $posx, $posy, $this->text, $color->getInt()); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php new file mode 100644 index 0000000000..c3c42144d3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php new file mode 100644 index 0000000000..78e5e4a59a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/EllipseShape.php @@ -0,0 +1,65 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + // parse background color + $background = new Color($this->background); + + if ($this->hasBorder()) { + // slightly smaller ellipse to keep 1px bordered edges clean + imagefilledellipse($image->getCore(), $x, $y, $this->width-1, $this->height-1, $background->getInt()); + + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + + // gd's imageellipse doesn't respect imagesetthickness so i use imagearc with 359.9 degrees here + imagearc($image->getCore(), $x, $y, $this->width, $this->height, 0, 359.99, $border_color->getInt()); + } else { + imagefilledellipse($image->getCore(), $x, $y, $this->width, $this->height, $background->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php new file mode 100644 index 0000000000..ea38b513e4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/LineShape.php @@ -0,0 +1,90 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param int $width + * @return void + */ + public function width($width) + { + throw new \Intervention\Image\Exception\NotSupportedException( + "Line width is not supported by GD driver." + ); + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $color = new Color($this->color); + imageline($image->getCore(), $x, $y, $this->x, $this->y, $color->getInt()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php new file mode 100644 index 0000000000..5e14df40ef --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/PolygonShape.php @@ -0,0 +1,49 @@ +points = $points; + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledpolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagepolygon($image->getCore(), $this->points, intval(count($this->points) / 2), $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php new file mode 100644 index 0000000000..5f69a7f927 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Gd/Shapes/RectangleShape.php @@ -0,0 +1,76 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $background = new Color($this->background); + imagefilledrectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $background->getInt()); + + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + imagesetthickness($image->getCore(), $this->border_width); + imagerectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $border_color->getInt()); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Image.php b/vendor/intervention/image/src/Intervention/Image/Image.php new file mode 100644 index 0000000000..7d5a59b7d8 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Image.php @@ -0,0 +1,370 @@ +driver = $driver; + $this->core = $core; + } + + /** + * Magic method to catch all image calls + * usually any AbstractCommand + * + * @param string $name + * @param Array $arguments + * @return mixed + */ + public function __call($name, $arguments) + { + $command = $this->driver->executeCommand($this, $name, $arguments); + return $command->hasOutput() ? $command->getOutput() : $this; + } + + /** + * Starts encoding of current image + * + * @param string $format + * @param int $quality + * @return \Intervention\Image\Image + */ + public function encode($format = null, $quality = 90) + { + return $this->driver->encode($this, $format, $quality); + } + + /** + * Saves encoded image in filesystem + * + * @param string $path + * @param int $quality + * @param string $format + * @return \Intervention\Image\Image + */ + public function save($path = null, $quality = null, $format = null) + { + $path = is_null($path) ? $this->basePath() : $path; + + if (is_null($path)) { + throw new NotWritableException( + "Can't write to undefined path." + ); + } + + if ($format === null) { + $format = pathinfo($path, PATHINFO_EXTENSION); + } + + $data = $this->encode($format, $quality); + $saved = @file_put_contents($path, $data); + + if ($saved === false) { + throw new NotWritableException( + "Can't write image data to path ({$path})" + ); + } + + // set new file info + $this->setFileInfoFromPath($path); + + return $this; + } + + /** + * Runs a given filter on current image + * + * @param FiltersFilterInterface $filter + * @return \Intervention\Image\Image + */ + public function filter(Filters\FilterInterface $filter) + { + return $filter->applyFilter($this); + } + + /** + * Returns current image driver + * + * @return \Intervention\Image\AbstractDriver + */ + public function getDriver() + { + return $this->driver; + } + + /** + * Sets current image driver + * @param AbstractDriver $driver + */ + public function setDriver(AbstractDriver $driver) + { + $this->driver = $driver; + + return $this; + } + + /** + * Returns current image resource/obj + * + * @return mixed + */ + public function getCore() + { + return $this->core; + } + + /** + * Sets current image resource + * + * @param mixed $core + */ + public function setCore($core) + { + $this->core = $core; + + return $this; + } + + /** + * Returns current image backup + * + * @param string $name + * @return mixed + */ + public function getBackup($name = null) + { + $name = is_null($name) ? 'default' : $name; + + if ( ! $this->backupExists($name)) { + throw new RuntimeException( + "Backup with name ({$name}) not available. Call backup() before reset()." + ); + } + + return $this->backups[$name]; + } + + /** + * Returns all backups attached to image + * + * @return array + */ + public function getBackups() + { + return $this->backups; + } + + /** + * Sets current image backup + * + * @param mixed $resource + * @param string $name + * @return self + */ + public function setBackup($resource, $name = null) + { + $name = is_null($name) ? 'default' : $name; + + $this->backups[$name] = $resource; + + return $this; + } + + /** + * Checks if named backup exists + * + * @param string $name + * @return bool + */ + private function backupExists($name) + { + return array_key_exists($name, $this->backups); + } + + /** + * Checks if current image is already encoded + * + * @return boolean + */ + public function isEncoded() + { + return ! empty($this->encoded); + } + + /** + * Returns encoded image data of current image + * + * @return string + */ + public function getEncoded() + { + return $this->encoded; + } + + /** + * Sets encoded image buffer + * + * @param string $value + */ + public function setEncoded($value) + { + $this->encoded = $value; + + return $this; + } + + /** + * Calculates current image width + * + * @return int + */ + public function getWidth() + { + return $this->getSize()->width; + } + + /** + * Alias of getWidth() + * + * @return int + */ + public function width() + { + return $this->getWidth(); + } + + /** + * Calculates current image height + * + * @return int + */ + public function getHeight() + { + return $this->getSize()->height; + } + + /** + * Alias of getHeight + * + * @return int + */ + public function height() + { + return $this->getHeight(); + } + + /** + * Reads mime type + * + * @return string + */ + public function mime() + { + return $this->mime; + } + + /** + * Returns encoded image data in string conversion + * + * @return string + */ + public function __toString() + { + return $this->encoded; + } + + /** + * Cloning an image + */ + public function __clone() + { + $this->core = $this->driver->cloneCore($this->core); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManager.php b/vendor/intervention/image/src/Intervention/Image/ImageManager.php new file mode 100644 index 0000000000..324fe7fa30 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManager.php @@ -0,0 +1,142 @@ + 'gd' + ]; + + /** + * Creates new instance of Image Manager + * + * @param array $config + */ + public function __construct(array $config = []) + { + $this->checkRequirements(); + $this->configure($config); + } + + /** + * Overrides configuration settings + * + * @param array $config + * + * @return self + */ + public function configure(array $config = []) + { + $this->config = array_replace($this->config, $config); + + return $this; + } + + /** + * Initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + */ + public function make($data) + { + return $this->createDriver()->init($data); + } + + /** + * Creates an empty image canvas + * + * @param int $width + * @param int $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public function canvas($width, $height, $background = null) + { + return $this->createDriver()->newImage($width, $height, $background); + } + + /** + * Create new cached image and run callback + * (requires additional package intervention/imagecache) + * + * @param Closure $callback + * @param int $lifetime + * @param boolean $returnObj + * + * @return Image + */ + public function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + if (class_exists('Intervention\\Image\\ImageCache')) { + // create imagecache + $imagecache = new ImageCache($this); + + // run callback + if (is_callable($callback)) { + $callback($imagecache); + } + + return $imagecache->get($lifetime, $returnObj); + } + + throw new MissingDependencyException( + "Please install package intervention/imagecache before running this function." + ); + } + + /** + * Creates a driver instance according to config settings + * + * @return \Intervention\Image\AbstractDriver + */ + private function createDriver() + { + if (is_string($this->config['driver'])) { + $drivername = ucfirst($this->config['driver']); + $driverclass = sprintf('Intervention\\Image\\%s\\Driver', $drivername); + + if (class_exists($driverclass)) { + return new $driverclass; + } + + throw new NotSupportedException( + "Driver ({$drivername}) could not be instantiated." + ); + } + + if ($this->config['driver'] instanceof AbstractDriver) { + return $this->config['driver']; + } + + throw new NotSupportedException( + "Unknown driver type." + ); + } + + /** + * Check if all requirements are available + * + * @return void + */ + private function checkRequirements() + { + if ( ! function_exists('finfo_buffer')) { + throw new MissingDependencyException( + "PHP Fileinfo extension must be installed/enabled to use Intervention Image." + ); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php new file mode 100644 index 0000000000..a1b5642641 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageManagerStatic.php @@ -0,0 +1,88 @@ +configure($config); + } + + /** + * Statically initiates an Image instance from different input types + * + * @param mixed $data + * + * @return \Intervention\Image\Image + * @throws \Intervention\Image\Exception\NotReadableException + */ + public static function make($data) + { + return self::getManager()->make($data); + } + + /** + * Statically creates an empty image canvas + * + * @param int $width + * @param int $height + * @param mixed $background + * + * @return \Intervention\Image\Image + */ + public static function canvas($width, $height, $background = null) + { + return self::getManager()->canvas($width, $height, $background); + } + + /** + * Create new cached image and run callback statically + * + * @param Closure $callback + * @param int $lifetime + * @param boolean $returnObj + * + * @return mixed + */ + public static function cache(Closure $callback, $lifetime = null, $returnObj = false) + { + return self::getManager()->cache($callback, $lifetime, $returnObj); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php new file mode 100644 index 0000000000..e106d06cb0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProvider.php @@ -0,0 +1,87 @@ +provider = $this->getProvider(); + } + + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + if (method_exists($this->provider, 'boot')) { + return $this->provider->boot(); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + return $this->provider->register(); + } + + /** + * Return ServiceProvider according to Laravel version + * + * @return \Intervention\Image\Provider\ProviderInterface + */ + private function getProvider() + { + if ($this->app instanceof LumenApplication) { + $provider = '\Intervention\Image\ImageServiceProviderLumen'; + } elseif (version_compare(IlluminateApplication::VERSION, '5.0', '<')) { + $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; + } else { + $provider = '\Intervention\Image\ImageServiceProviderLaravel5'; + } + + return new $provider($this->app); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['image']; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php new file mode 100755 index 0000000000..3b1388f252 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel4.php @@ -0,0 +1,112 @@ +package('intervention/image'); + + // try to create imagecache route only if imagecache is present + if (class_exists('Intervention\\Image\\ImageCache')) { + + $app = $this->app; + + // load imagecache config + $app['config']->package('intervention/imagecache', __DIR__.'/../../../../imagecache/src/config', 'imagecache'); + $config = $app['config']; + + // create dynamic manipulation route + if (is_string($config->get('imagecache::route'))) { + + // add original to route templates + $config->set('imagecache::templates.original', null); + + // setup image manipulator route + $app['router']->get($config->get('imagecache::route').'/{template}/{filename}', ['as' => 'imagecache', function ($template, $filename) use ($app, $config) { + + // disable session cookies for image route + $app['config']->set('session.driver', 'array'); + + // find file + foreach ($config->get('imagecache::paths') as $path) { + // don't allow '..' in filenames + $image_path = $path.'/'.str_replace('..', '', $filename); + if (file_exists($image_path) && is_file($image_path)) { + break; + } else { + $image_path = false; + } + } + + // abort if file not found + if ($image_path === false) { + $app->abort(404); + } + + // define template callback + $callback = $config->get("imagecache::templates.{$template}"); + + if (is_callable($callback) || class_exists($callback)) { + + // image manipulation based on callback + $content = $app['image']->cache(function ($image) use ($image_path, $callback) { + + switch (true) { + case is_callable($callback): + return $callback($image->make($image_path)); + break; + + case class_exists($callback): + return $image->make($image_path)->filter(new $callback); + break; + } + + }, $config->get('imagecache::lifetime')); + + } else { + + // get original image file contents + $content = file_get_contents($image_path); + } + + // define mime type + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $content); + + // return http response + return new IlluminateResponse($content, 200, [ + 'Content-Type' => $mime, + 'Cache-Control' => 'max-age='.($config->get('imagecache::lifetime')*60).', public', + 'Etag' => md5($content) + ]); + + }])->where(['template' => join('|', array_keys($config->get('imagecache::templates'))), 'filename' => '[ \w\\.\\/\\-]+']); + } + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + $app['image'] = $app->share(function ($app) { + return new ImageManager($app['config']->get('image::config')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php new file mode 100644 index 0000000000..dd40ebd979 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLaravel5.php @@ -0,0 +1,89 @@ +publishes([ + __DIR__.'/../../config/config.php' => config_path('image.php') + ]); + + // setup intervention/imagecache if package is installed + $this->cacheIsInstalled() ? $this->bootstrapImageCache() : null; + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $app = $this->app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // create image + $app->singleton('image', function ($app) { + return new ImageManager($app['config']->get('image')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } + + /** + * Bootstrap imagecache + * + * @return void + */ + protected function bootstrapImageCache() + { + $app = $this->app; + $config = __DIR__.'/../../../../imagecache/src/config/config.php'; + + $this->publishes([ + $config => config_path('imagecache.php') + ]); + + // merge default config + $this->mergeConfigFrom( + $config, + 'imagecache' + ); + + // imagecache route + if (is_string(config('imagecache.route'))) { + + $filename_pattern = '[ \w\\.\\/\\-\\@\(\)]+'; + + // route to access template applied image file + $app['router']->get(config('imagecache.route').'/{template}/{filename}', [ + 'uses' => 'Intervention\Image\ImageCacheController@getResponse', + 'as' => 'imagecache' + ])->where(['filename' => $filename_pattern]); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php new file mode 100644 index 0000000000..b756a61f5e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLeague.php @@ -0,0 +1,42 @@ +config = $config; + } + + /** + * Register the server provider. + * + * @return void + */ + public function register() + { + $this->getContainer()->share('Intervention\Image\ImageManager', function () { + return new ImageManager($this->config); + }); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php new file mode 100644 index 0000000000..4a381ccd41 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/ImageServiceProviderLumen.php @@ -0,0 +1,34 @@ +app; + + // merge default config + $this->mergeConfigFrom( + __DIR__.'/../../config/config.php', + 'image' + ); + + // set configuration + $app->configure('image'); + + // create image + $app->singleton('image',function ($app) { + return new ImageManager($app['config']->get('image')); + }); + + $app->alias('image', 'Intervention\Image\ImageManager'); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php new file mode 100644 index 0000000000..a41ff3a6ed --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Color.php @@ -0,0 +1,279 @@ +> 24) & 0xFF; + $r = ($value >> 16) & 0xFF; + $g = ($value >> 8) & 0xFF; + $b = $value & 0xFF; + $a = $this->rgb2alpha($a); + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given array + * + * @param array $value + * @return \Intervention\Image\AbstractColor + */ + public function initFromArray($array) + { + $array = array_values($array); + + if (count($array) == 4) { + + // color array with alpha value + list($r, $g, $b, $a) = $array; + + } elseif (count($array) == 3) { + + // color array without alpha value + list($r, $g, $b) = $array; + $a = 1; + } + + $this->setPixel($r, $g, $b, $a); + } + + /** + * Initiates color object from given string + * + * @param string $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromString($value) + { + if ($color = $this->rgbaFromString($value)) { + $this->setPixel($color[0], $color[1], $color[2], $color[3]); + } + } + + /** + * Initiates color object from given ImagickPixel object + * + * @param ImagickPixel $value + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromObject($value) + { + if (is_a($value, '\ImagickPixel')) { + $this->pixel = $value; + } + } + + /** + * Initiates color object from given R, G and B values + * + * @param int $r + * @param int $g + * @param int $b + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgb($r, $g, $b) + { + $this->setPixel($r, $g, $b); + } + + /** + * Initiates color object from given R, G, B and A values + * + * @param int $r + * @param int $g + * @param int $b + * @param float $a + * + * @return \Intervention\Image\AbstractColor + */ + public function initFromRgba($r, $g, $b, $a) + { + $this->setPixel($r, $g, $b, $a); + } + + /** + * Calculates integer value of current color instance + * + * @return int + */ + public function getInt() + { + $r = $this->getRedValue(); + $g = $this->getGreenValue(); + $b = $this->getBlueValue(); + $a = intval(round($this->getAlphaValue() * 255)); + + return intval(($a << 24) + ($r << 16) + ($g << 8) + $b); + } + + /** + * Calculates hexadecimal value of current color instance + * + * @param string $prefix + * + * @return string + */ + public function getHex($prefix = '') + { + return sprintf('%s%02x%02x%02x', $prefix, + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue() + ); + } + + /** + * Calculates RGB(A) in array format of current color instance + * + * @return array + */ + public function getArray() + { + return [ + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ]; + } + + /** + * Calculates RGBA in string format of current color instance + * + * @return string + */ + public function getRgba() + { + return sprintf('rgba(%d, %d, %d, %.2F)', + $this->getRedValue(), + $this->getGreenValue(), + $this->getBlueValue(), + $this->getAlphaValue() + ); + } + + /** + * Determines if current color is different from given color + * + * @param AbstractColor $color + * @param int $tolerance + * @return boolean + */ + public function differs(AbstractColor $color, $tolerance = 0) + { + $color_tolerance = round($tolerance * 2.55); + $alpha_tolerance = round($tolerance); + + $delta = [ + 'r' => abs($color->getRedValue() - $this->getRedValue()), + 'g' => abs($color->getGreenValue() - $this->getGreenValue()), + 'b' => abs($color->getBlueValue() - $this->getBlueValue()), + 'a' => abs($color->getAlphaValue() - $this->getAlphaValue()) + ]; + + return ( + $delta['r'] > $color_tolerance or + $delta['g'] > $color_tolerance or + $delta['b'] > $color_tolerance or + $delta['a'] > $alpha_tolerance + ); + } + + /** + * Returns RGB red value of current color + * + * @return int + */ + public function getRedValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_RED) * 255)); + } + + /** + * Returns RGB green value of current color + * + * @return int + */ + public function getGreenValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_GREEN) * 255)); + } + + /** + * Returns RGB blue value of current color + * + * @return int + */ + public function getBlueValue() + { + return intval(round($this->pixel->getColorValue(\Imagick::COLOR_BLUE) * 255)); + } + + /** + * Returns RGB alpha value of current color + * + * @return float + */ + public function getAlphaValue() + { + return round($this->pixel->getColorValue(\Imagick::COLOR_ALPHA), 2); + } + + /** + * Initiates ImagickPixel from given RGBA values + * + * @return \ImagickPixel + */ + private function setPixel($r, $g, $b, $a = null) + { + $a = is_null($a) ? 1 : $a; + + return $this->pixel = new \ImagickPixel( + sprintf('rgba(%d, %d, %d, %.2F)', $r, $g, $b, $a) + ); + } + + /** + * Returns current color as ImagickPixel + * + * @return \ImagickPixel + */ + public function getPixel() + { + return $this->pixel; + } + + /** + * Calculates RGA integer alpha value into float value + * + * @param int $value + * @return float + */ + private function rgb2alpha($value) + { + // (255 -> 1.0) / (0 -> 0.0) + return (float) round($value/255, 2); + } + +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php new file mode 100644 index 0000000000..76b4f72bbb --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BackupCommand.php @@ -0,0 +1,25 @@ +argument(0)->value(); + + // clone current image resource + $clone = clone $image; + $image->setBackup($clone->getCore(), $backupName); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php new file mode 100644 index 0000000000..d2533e0ea4 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BlurCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(0, 100)->value(1); + + return $image->getCore()->blurImage(1 * $amount, 0.5 * $amount); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php new file mode 100644 index 0000000000..03ac8478de --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->modulateImage(100 + $level, 100, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php new file mode 100644 index 0000000000..3a6506f6da --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php @@ -0,0 +1,44 @@ +argument(0)->between(-100, 100)->required()->value(); + $green = $this->argument(1)->between(-100, 100)->required()->value(); + $blue = $this->argument(2)->between(-100, 100)->required()->value(); + + // normalize colorize levels + $red = $this->normalizeLevel($red); + $green = $this->normalizeLevel($green); + $blue = $this->normalizeLevel($blue); + + $qrange = $image->getCore()->getQuantumRange(); + + // apply + $image->getCore()->levelImage(0, $red, $qrange['quantumRangeLong'], \Imagick::CHANNEL_RED); + $image->getCore()->levelImage(0, $green, $qrange['quantumRangeLong'], \Imagick::CHANNEL_GREEN); + $image->getCore()->levelImage(0, $blue, $qrange['quantumRangeLong'], \Imagick::CHANNEL_BLUE); + + return true; + } + + private function normalizeLevel($level) + { + if ($level > 0) { + return $level/5; + } else { + return ($level+100)/100; + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php new file mode 100644 index 0000000000..c4847c61da --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ContrastCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(-100, 100)->required()->value(); + + return $image->getCore()->sigmoidalContrastImage($level > 0, $level / 4, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php new file mode 100644 index 0000000000..618edea7d0 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/CropCommand.php @@ -0,0 +1,45 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $x = $this->argument(2)->type('digit')->value(); + $y = $this->argument(3)->type('digit')->value(); + + if (is_null($width) || is_null($height)) { + throw new InvalidArgumentException( + "Width and height of cutout needs to be defined." + ); + } + + $cropped = new Size($width, $height); + $position = new Point($x, $y); + + // align boxes + if (is_null($x) && is_null($y)) { + $position = $image->getSize()->align('center')->relativePosition($cropped->align('center')); + } + + // crop image core + $image->getCore()->cropImage($cropped->width, $cropped->height, $position->x, $position->y); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php new file mode 100644 index 0000000000..58c9556e40 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/DestroyCommand.php @@ -0,0 +1,27 @@ +getCore()->clear(); + + // destroy backups + foreach ($image->getBackups() as $backup) { + $backup->clear(); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php new file mode 100644 index 0000000000..521b38b092 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ExifCommand.php @@ -0,0 +1,63 @@ +preferExtension = false; + } + + /** + * Read Exif data from the given image + * + * @param \Intervention\Image\Image $image + * @return boolean + */ + public function execute($image) + { + if ($this->preferExtension && function_exists('exif_read_data')) { + return parent::execute($image); + } + + $core = $image->getCore(); + + if ( ! method_exists($core, 'getImageProperties')) { + throw new NotSupportedException( + "Reading Exif data is not supported by this PHP installation." + ); + } + + $requestedKey = $this->argument(0)->value(); + if ($requestedKey !== null) { + $this->setOutput($core->getImageProperty('exif:' . $requestedKey)); + return true; + } + + $exif = []; + $properties = $core->getImageProperties(); + foreach ($properties as $key => $value) { + if (substr($key, 0, 5) !== 'exif:') { + continue; + } + + $exif[substr($key, 5)] = $value; + } + + $this->setOutput($exif); + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php new file mode 100644 index 0000000000..82baac532d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FillCommand.php @@ -0,0 +1,105 @@ +argument(0)->value(); + $x = $this->argument(1)->type('digit')->value(); + $y = $this->argument(2)->type('digit')->value(); + + $imagick = $image->getCore(); + + try { + // set image filling + $source = new Decoder; + $filling = $source->init($filling); + + } catch (NotReadableException $e) { + + // set solid color filling + $filling = new Color($filling); + } + + // flood fill if coordinates are set + if (is_int($x) && is_int($y)) { + + // flood fill with texture + if ($filling instanceof Image) { + + // create tile + $tile = clone $image->getCore(); + + // mask away color at position + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // create canvas + $canvas = clone $image->getCore(); + + // fill canvas with texture + $canvas = $canvas->textureImage($filling->getCore()); + + // merge canvas and tile + $canvas->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // replace image core + $image->setCore($canvas); + + // flood fill with color + } elseif ($filling instanceof Color) { + + // create canvas with filling + $canvas = new \Imagick; + $canvas->newImage($image->getWidth(), $image->getHeight(), $filling->getPixel(), 'png'); + + // create tile to put on top + $tile = clone $image->getCore(); + + // mask away color at pos. + $tile->transparentPaintImage($tile->getImagePixelColor($x, $y), 0, 0, false); + + // save alpha channel of original image + $alpha = clone $image->getCore(); + + // merge original with canvas and tile + $image->getCore()->compositeImage($canvas, \Imagick::COMPOSITE_DEFAULT, 0, 0); + $image->getCore()->compositeImage($tile, \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // restore alpha channel of original image + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + } + + } else { + + if ($filling instanceof Image) { + + // fill whole image with texture + $image->setCore($image->getCore()->textureImage($filling->getCore())); + + } elseif ($filling instanceof Color) { + + // fill whole image with color + $draw = new \ImagickDraw(); + $draw->setFillColor($filling->getPixel()); + $draw->rectangle(0, 0, $image->getWidth(), $image->getHeight()); + $image->getCore()->drawImage($draw); + } + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php new file mode 100644 index 0000000000..6d62ba677b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FitCommand.php @@ -0,0 +1,42 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->value($width); + $constraints = $this->argument(2)->type('closure')->value(); + $position = $this->argument(3)->type('string')->value('center'); + + // calculate size + $cropped = $image->getSize()->fit(new Size($width, $height), $position); + $resized = clone $cropped; + $resized = $resized->resize($width, $height, $constraints); + + // crop image + $image->getCore()->cropImage( + $cropped->width, + $cropped->height, + $cropped->pivot->x, + $cropped->pivot->y + ); + + // resize image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + $image->getCore()->setImagePage(0,0,0,0); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php new file mode 100644 index 0000000000..abae16ad13 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/FlipCommand.php @@ -0,0 +1,27 @@ +argument(0)->value('h'); + + if (in_array(strtolower($mode), [2, 'v', 'vert', 'vertical'])) { + // flip vertical + return $image->getCore()->flipImage(); + } else { + // flip horizontal + return $image->getCore()->flopImage(); + } + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php new file mode 100644 index 0000000000..200515f3b3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GammaCommand.php @@ -0,0 +1,21 @@ +argument(0)->type('numeric')->required()->value(); + + return $image->getCore()->gammaImage($gamma); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php new file mode 100644 index 0000000000..ccccedb03a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php @@ -0,0 +1,28 @@ +getCore(); + + $this->setOutput(new Size( + $core->getImageWidth(), + $core->getImageHeight() + )); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php new file mode 100644 index 0000000000..df0ff5b576 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php @@ -0,0 +1,19 @@ +getCore()->modulateImage(100, 0, 100); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php new file mode 100644 index 0000000000..0b61e50c16 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/HeightenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = null; + $this->arguments[1] = $height; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php new file mode 100644 index 0000000000..2a9974367f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InsertCommand.php @@ -0,0 +1,33 @@ +argument(0)->required()->value(); + $position = $this->argument(1)->type('string')->value(); + $x = $this->argument(2)->type('digit')->value(0); + $y = $this->argument(3)->type('digit')->value(0); + + // build watermark + $watermark = $image->getDriver()->init($source); + + // define insertion point + $image_size = $image->getSize()->align($position, $x, $y); + $watermark_size = $watermark->getSize()->align($position); + $target = $image_size->relativePosition($watermark_size); + + // insert image at position + return $image->getCore()->compositeImage($watermark->getCore(), \Imagick::COMPOSITE_DEFAULT, $target->x, $target->y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php new file mode 100644 index 0000000000..913cab7e0d --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php @@ -0,0 +1,29 @@ +argument(0)->type('bool')->value(true); + + if ($mode) { + $mode = \Imagick::INTERLACE_LINE; + } else { + $mode = \Imagick::INTERLACE_NO; + } + + $image->getCore()->setInterlaceScheme($mode); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php new file mode 100644 index 0000000000..1d134301bb --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/InvertCommand.php @@ -0,0 +1,19 @@ +getCore()->negateImage(false); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php new file mode 100644 index 0000000000..16f9b82e91 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php @@ -0,0 +1,59 @@ +argument(0)->value(); + $matte = $this->argument(1)->value(); + + // get current image size + $size = $image->getSize(); + + // build 2 color alpha mask from original alpha + $alpha = clone $image->getCore(); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->transparentPaintImage('#ffffff', 0, 0, false); + $alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + $alpha->negateImage(false); + + if ($matte) { + + // get matte color + $mattecolor = $image->getDriver()->parseColor($matte)->getPixel(); + + // create matte image + $canvas = new \Imagick; + $canvas->newImage($size->width, $size->height, $mattecolor, 'png'); + + // lower colors of original and copy to matte + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $canvas->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + + // copy new alpha to canvas + $canvas->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // replace core + $image->setCore($canvas); + + } else { + + $image->getCore()->quantizeImage($count, \Imagick::COLORSPACE_RGB, 0, false, false); + $image->getCore()->compositeImage($alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + } + + return true; + + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php new file mode 100644 index 0000000000..af9d6b2f50 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/MaskCommand.php @@ -0,0 +1,60 @@ +argument(0)->value(); + $mask_w_alpha = $this->argument(1)->type('bool')->value(false); + + // get imagick + $imagick = $image->getCore(); + + // build mask image from source + $mask = $image->getDriver()->init($mask_source); + + // resize mask to size of current image (if necessary) + $image_size = $image->getSize(); + if ($mask->getSize() != $image_size) { + $mask->resize($image_size->width, $image_size->height); + } + + $imagick->setImageMatte(true); + + if ($mask_w_alpha) { + + // just mask with alpha map + $imagick->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DSTIN, 0, 0); + + } else { + + // get alpha channel of original as greyscale image + $original_alpha = clone $imagick; + $original_alpha->separateImageChannel(\Imagick::CHANNEL_ALPHA); + + // use red channel from mask ask alpha + $mask_alpha = clone $mask->getCore(); + $mask_alpha->compositeImage($mask->getCore(), \Imagick::COMPOSITE_DEFAULT, 0, 0); + // $mask_alpha->setImageAlphaChannel(\Imagick::ALPHACHANNEL_DEACTIVATE); + $mask_alpha->separateImageChannel(\Imagick::CHANNEL_ALL); + + // combine both alphas from original and mask + $original_alpha->compositeImage($mask_alpha, \Imagick::COMPOSITE_COPYOPACITY, 0, 0); + + // mask the image with the alpha combination + $imagick->compositeImage($original_alpha, \Imagick::COMPOSITE_DSTIN, 0, 0); + } + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php new file mode 100644 index 0000000000..b4708d899b --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/OpacityCommand.php @@ -0,0 +1,23 @@ +argument(0)->between(0, 100)->required()->value(); + + $transparency = $transparency > 0 ? (100 / $transparency) : 1000; + + return $image->getCore()->evaluateImage(\Imagick::EVALUATE_DIVIDE, $transparency, \Imagick::CHANNEL_ALPHA); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php new file mode 100644 index 0000000000..978a1284ee --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PickColorCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('digit')->required()->value(); + $y = $this->argument(1)->type('digit')->required()->value(); + $format = $this->argument(2)->type('string')->value('array'); + + // pick color + $color = new Color($image->getCore()->getImagePixelColor($x, $y)); + + // format to output + $this->setOutput($color->format($format)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php new file mode 100644 index 0000000000..6eb6ae715e --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelCommand.php @@ -0,0 +1,31 @@ +argument(0)->required()->value(); + $color = new Color($color); + $x = $this->argument(1)->type('digit')->required()->value(); + $y = $this->argument(2)->type('digit')->required()->value(); + + // prepare pixel + $draw = new \ImagickDraw; + $draw->setFillColor($color->getPixel()); + $draw->point($x, $y); + + // apply pixel + return $image->getCore()->drawImage($draw); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php new file mode 100644 index 0000000000..6fe7949134 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/PixelateCommand.php @@ -0,0 +1,27 @@ +argument(0)->type('digit')->value(10); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $image->getCore()->scaleImage(max(1, ($width / $size)), max(1, ($height / $size))); + $image->getCore()->scaleImage($width, $height); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php new file mode 100644 index 0000000000..77b7f33668 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResetCommand.php @@ -0,0 +1,40 @@ +argument(0)->value(); + + $backup = $image->getBackup($backupName); + + if ($backup instanceof \Imagick) { + + // destroy current core + $image->getCore()->clear(); + + // clone backup + $backup = clone $backup; + + // reset to new resource + $image->setCore($backup); + + return true; + } + + throw new RuntimeException( + "Backup not available. Call backup({$backupName}) before reset()." + ); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php new file mode 100644 index 0000000000..ecf0761062 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -0,0 +1,91 @@ +argument(0)->type('digit')->required()->value(); + $height = $this->argument(1)->type('digit')->required()->value(); + $anchor = $this->argument(2)->value('center'); + $relative = $this->argument(3)->type('boolean')->value(false); + $bgcolor = $this->argument(4)->value(); + + $original_width = $image->getWidth(); + $original_height = $image->getHeight(); + + // check of only width or height is set + $width = is_null($width) ? $original_width : intval($width); + $height = is_null($height) ? $original_height : intval($height); + + // check on relative width/height + if ($relative) { + $width = $original_width + $width; + $height = $original_height + $height; + } + + // check for negative width/height + $width = ($width <= 0) ? $width + $original_width : $width; + $height = ($height <= 0) ? $height + $original_height : $height; + + // create new canvas + $canvas = $image->getDriver()->newImage($width, $height, $bgcolor); + + // set copy position + $canvas_size = $canvas->getSize()->align($anchor); + $image_size = $image->getSize()->align($anchor); + $canvas_pos = $image_size->relativePosition($canvas_size); + $image_pos = $canvas_size->relativePosition($image_size); + + if ($width <= $original_width) { + $dst_x = 0; + $src_x = $canvas_pos->x; + $src_w = $canvas_size->width; + } else { + $dst_x = $image_pos->x; + $src_x = 0; + $src_w = $original_width; + } + + if ($height <= $original_height) { + $dst_y = 0; + $src_y = $canvas_pos->y; + $src_h = $canvas_size->height; + } else { + $dst_y = $image_pos->y; + $src_y = 0; + $src_h = $original_height; + } + + // make image area transparent to keep transparency + // even if background-color is set + $rect = new \ImagickDraw; + $fill = $canvas->pickColor(0, 0, 'hex'); + $fill = $fill == '#ff0000' ? '#00ff00' : '#ff0000'; + $rect->setFillColor($fill); + $rect->rectangle($dst_x, $dst_y, $dst_x + $src_w - 1, $dst_y + $src_h - 1); + $canvas->getCore()->drawImage($rect); + $canvas->getCore()->transparentPaintImage($fill, 0, 0, false); + + $canvas->getCore()->setImageColorspace($image->getCore()->getImageColorspace()); + + // copy image into new canvas + $image->getCore()->cropImage($src_w, $src_h, $src_x, $src_y); + $canvas->getCore()->compositeImage($image->getCore(), \Imagick::COMPOSITE_DEFAULT, $dst_x, $dst_y); + $canvas->getCore()->setImagePage(0,0,0,0); + + // set new core to canvas + $image->setCore($canvas->getCore()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php new file mode 100644 index 0000000000..3d4dc5bedb --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/ResizeCommand.php @@ -0,0 +1,29 @@ +argument(0)->value(); + $height = $this->argument(1)->value(); + $constraints = $this->argument(2)->type('closure')->value(); + + // resize box + $resized = $image->getSize()->resize($width, $height, $constraints); + + // modify image + $image->getCore()->scaleImage($resized->getWidth(), $resized->getHeight()); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php new file mode 100644 index 0000000000..edaef0d3f9 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/RotateCommand.php @@ -0,0 +1,30 @@ +argument(0)->type('numeric')->required()->value(); + $color = $this->argument(1)->value(); + $color = new Color($color); + + // restrict rotations beyond 360 degrees, since the end result is the same + $angle %= 360; + + // rotate image + $image->getCore()->rotateImage($color->getPixel(), ($angle * -1)); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php new file mode 100644 index 0000000000..bc5e393f26 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/SharpenCommand.php @@ -0,0 +1,21 @@ +argument(0)->between(0, 100)->value(10); + + return $image->getCore()->unsharpMaskImage(1, 1, $amount / 6.25, 0); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php new file mode 100644 index 0000000000..bdc897be73 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/TrimCommand.php @@ -0,0 +1,121 @@ +argument(0)->type('string')->value(); + $away = $this->argument(1)->value(); + $tolerance = $this->argument(2)->type('numeric')->value(0); + $feather = $this->argument(3)->type('numeric')->value(0); + + $width = $image->getWidth(); + $height = $image->getHeight(); + + $checkTransparency = false; + + // define borders to trim away + if (is_null($away)) { + $away = ['top', 'right', 'bottom', 'left']; + } elseif (is_string($away)) { + $away = [$away]; + } + + // lower border names + foreach ($away as $key => $value) { + $away[$key] = strtolower($value); + } + + // define base color position + switch (strtolower($base)) { + case 'transparent': + case 'trans': + $checkTransparency = true; + $base_x = 0; + $base_y = 0; + break; + + case 'bottom-right': + case 'right-bottom': + $base_x = $width - 1; + $base_y = $height - 1; + break; + + default: + case 'top-left': + case 'left-top': + $base_x = 0; + $base_y = 0; + break; + } + + // pick base color + if ($checkTransparency) { + $base_color = new Color; // color will only be used to compare alpha channel + } else { + $base_color = $image->pickColor($base_x, $base_y, 'object'); + } + + // trim on clone to get only coordinates + $trimed = clone $image->getCore(); + + // add border to trim specific color + $trimed->borderImage($base_color->getPixel(), 1, 1); + + // trim image + $trimed->trimImage(65850 / 100 * $tolerance); + + // get coordinates of trim + $imagePage = $trimed->getImagePage(); + list($crop_x, $crop_y) = [$imagePage['x']-1, $imagePage['y']-1]; + // $trimed->setImagePage(0, 0, 0, 0); + list($crop_width, $crop_height) = [$trimed->width, $trimed->height]; + + // adjust settings if right should not be trimed + if ( ! in_array('right', $away)) { + $crop_width = $crop_width + ($width - ($width - $crop_x)); + } + + // adjust settings if bottom should not be trimed + if ( ! in_array('bottom', $away)) { + $crop_height = $crop_height + ($height - ($height - $crop_y)); + } + + // adjust settings if left should not be trimed + if ( ! in_array('left', $away)) { + $crop_width = $crop_width + $crop_x; + $crop_x = 0; + } + + // adjust settings if top should not be trimed + if ( ! in_array('top', $away)) { + $crop_height = $crop_height + $crop_y; + $crop_y = 0; + } + + // add feather + $crop_width = min($width, ($crop_width + $feather * 2)); + $crop_height = min($height, ($crop_height + $feather * 2)); + $crop_x = max(0, ($crop_x - $feather)); + $crop_y = max(0, ($crop_y - $feather)); + + // finally crop based on page + $image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y); + $image->getCore()->setImagePage(0,0,0,0); + + $trimed->destroy(); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php new file mode 100644 index 0000000000..a1967534ca --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Commands/WidenCommand.php @@ -0,0 +1,28 @@ +argument(0)->type('digit')->required()->value(); + $additionalConstraints = $this->argument(1)->type('closure')->value(); + + $this->arguments[0] = $width; + $this->arguments[1] = null; + $this->arguments[2] = function ($constraint) use ($additionalConstraints) { + $constraint->aspectRatio(); + if(is_callable($additionalConstraints)) + $additionalConstraints($constraint); + }; + + return parent::execute($image); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php new file mode 100644 index 0000000000..f4dde9a84a --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Decoder.php @@ -0,0 +1,124 @@ +setBackgroundColor(new \ImagickPixel('transparent')); + $core->readImage($path); + $core->setImageType(defined('\Imagick::IMGTYPE_TRUECOLORALPHA') ? \Imagick::IMGTYPE_TRUECOLORALPHA : \Imagick::IMGTYPE_TRUECOLORMATTE); + + } catch (\ImagickException $e) { + throw new \Intervention\Image\Exception\NotReadableException( + "Unable to read image from path ({$path}).", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->setFileInfoFromPath($path); + + return $image; + } + + /** + * Initiates new image from GD resource + * + * @param Resource $resource + * @return \Intervention\Image\Image + */ + public function initFromGdResource($resource) + { + throw new NotSupportedException( + 'Imagick driver is unable to init from GD resource.' + ); + } + + /** + * Initiates new image from Imagick object + * + * @param Imagick $object + * @return \Intervention\Image\Image + */ + public function initFromImagick(\Imagick $object) + { + // currently animations are not supported + // so all images are turned into static + $object = $this->removeAnimation($object); + + // reset image orientation + $object->setImageOrientation(\Imagick::ORIENTATION_UNDEFINED); + + return new Image(new Driver, $object); + } + + /** + * Initiates new image from binary data + * + * @param string $data + * @return \Intervention\Image\Image + */ + public function initFromBinary($binary) + { + $core = new \Imagick; + + try { + $core->setBackgroundColor(new \ImagickPixel('transparent')); + + $core->readImageBlob($binary); + + } catch (\ImagickException $e) { + throw new NotReadableException( + "Unable to read image from binary data.", + 0, + $e + ); + } + + // build image + $image = $this->initFromImagick($core); + $image->mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $binary); + + return $image; + } + + /** + * Turns object into one frame Imagick object + * by removing all frames except first + * + * @param Imagick $object + * @return Imagick + */ + private function removeAnimation(\Imagick $object) + { + $imagick = new \Imagick; + + foreach ($object as $frame) { + $imagick->addImage($frame->getImage()); + break; + } + + $object->destroy(); + + return $imagick; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php new file mode 100644 index 0000000000..bb26ca0fea --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Driver.php @@ -0,0 +1,74 @@ +coreAvailable()) { + throw new NotSupportedException( + "ImageMagick module not available with this PHP installation." + ); + } + + $this->decoder = $decoder ? $decoder : new Decoder; + $this->encoder = $encoder ? $encoder : new Encoder; + } + + /** + * Creates new image instance + * + * @param int $width + * @param int $height + * @param mixed $background + * @return \Intervention\Image\Image + */ + public function newImage($width, $height, $background = null) + { + $background = new Color($background); + + // create empty core + $core = new \Imagick; + $core->newImage($width, $height, $background->getPixel(), 'png'); + $core->setType(\Imagick::IMGTYPE_UNDEFINED); + $core->setImageType(\Imagick::IMGTYPE_UNDEFINED); + $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED); + + // build image + $image = new Image(new static, $core); + + return $image; + } + + /** + * Reads given string into color object + * + * @param string $value + * @return AbstractColor + */ + public function parseColor($value) + { + return new Color($value); + } + + /** + * Checks if core module installation is available + * + * @return boolean + */ + protected function coreAvailable() + { + return (extension_loaded('imagick') && class_exists('Imagick')); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php new file mode 100644 index 0000000000..ac7345e4ab --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Encoder.php @@ -0,0 +1,173 @@ +image->getCore(); + $imagick->setImageBackgroundColor('white'); + $imagick->setBackgroundColor('white'); + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PNG string + * + * @return string + */ + protected function processPng() + { + $format = 'png'; + $compression = \Imagick::COMPRESSION_ZIP; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as GIF string + * + * @return string + */ + protected function processGif() + { + $format = 'gif'; + $compression = \Imagick::COMPRESSION_LZW; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + protected function processWebp() + { + if ( ! \Imagick::queryFormats('WEBP')) { + throw new NotSupportedException( + "Webp format is not supported by Imagick installation." + ); + } + + $format = 'webp'; + $compression = \Imagick::COMPRESSION_JPEG; + + $imagick = $this->image->getCore(); + $imagick->setImageBackgroundColor(new \ImagickPixel('transparent')); + + $imagick = $imagick->mergeImageLayers(\Imagick::LAYERMETHOD_MERGE); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as TIFF string + * + * @return string + */ + protected function processTiff() + { + $format = 'tiff'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + $imagick->setCompressionQuality($this->quality); + $imagick->setImageCompressionQuality($this->quality); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as BMP string + * + * @return string + */ + protected function processBmp() + { + $format = 'bmp'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as ICO string + * + * @return string + */ + protected function processIco() + { + $format = 'ico'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } + + /** + * Processes and returns encoded image as PSD string + * + * @return string + */ + protected function processPsd() + { + $format = 'psd'; + $compression = \Imagick::COMPRESSION_UNDEFINED; + + $imagick = $this->image->getCore(); + $imagick->setFormat($format); + $imagick->setImageFormat($format); + $imagick->setCompression($compression); + $imagick->setImageCompression($compression); + + return $imagick->getImagesBlob(); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php new file mode 100644 index 0000000000..0c5002a472 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Font.php @@ -0,0 +1,121 @@ +setStrokeAntialias(true); + $draw->setTextAntialias(true); + + // set font file + if ($this->hasApplicableFontFile()) { + $draw->setFont($this->file); + } else { + throw new RuntimeException( + "Font file must be provided to apply text to image." + ); + } + + // parse text color + $color = new Color($this->color); + + $draw->setFontSize($this->size); + $draw->setFillColor($color->getPixel()); + + // align horizontal + switch (strtolower($this->align)) { + case 'center': + $align = \Imagick::ALIGN_CENTER; + break; + + case 'right': + $align = \Imagick::ALIGN_RIGHT; + break; + + default: + $align = \Imagick::ALIGN_LEFT; + break; + } + + $draw->setTextAlignment($align); + + // align vertical + if (strtolower($this->valign) != 'bottom') { + + // corrections on y-position + switch (strtolower($this->valign)) { + case 'center': + case 'middle': + // calculate box size + $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text); + $posy = $posy + $dimensions['textHeight'] * 0.65 / 2; + break; + + case 'top': + // calculate box size + $dimensions = $image->getCore()->queryFontMetrics($draw, $this->text, false); + $posy = $posy + $dimensions['textHeight'] * 0.65; + break; + } + } + + // apply to image + $image->getCore()->annotateImage($draw, $posx, $posy, $this->angle * (-1), $this->text); + } + + /** + * Calculates bounding box of current font setting + * + * @return array + */ + public function getBoxSize() + { + $box = []; + + // build draw object + $draw = new \ImagickDraw(); + $draw->setStrokeAntialias(true); + $draw->setTextAntialias(true); + + // set font file + if ($this->hasApplicableFontFile()) { + $draw->setFont($this->file); + } else { + throw new RuntimeException( + "Font file must be provided to apply text to image." + ); + } + + $draw->setFontSize($this->size); + + $dimensions = (new \Imagick())->queryFontMetrics($draw, $this->text); + + if (strlen($this->text) == 0) { + // no text -> no boxsize + $box['width'] = 0; + $box['height'] = 0; + } else { + // get boxsize + $box['width'] = intval(abs($dimensions['textWidth'])); + $box['height'] = intval(abs($dimensions['textHeight'])); + } + + return $box; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php new file mode 100644 index 0000000000..24172ea116 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/CircleShape.php @@ -0,0 +1,40 @@ +width = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->height = is_numeric($diameter) ? intval($diameter) : $this->diameter; + $this->diameter = is_numeric($diameter) ? intval($diameter) : $this->diameter; + } + + /** + * Draw current circle on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + return parent::applyToImage($image, $x, $y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php new file mode 100644 index 0000000000..99694b97b3 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/EllipseShape.php @@ -0,0 +1,66 @@ +width = is_numeric($width) ? intval($width) : $this->width; + $this->height = is_numeric($height) ? intval($height) : $this->height; + } + + /** + * Draw ellipse instance on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $circle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $circle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $circle->setStrokeWidth($this->border_width); + $circle->setStrokeColor($border_color->getPixel()); + } + + $circle->ellipse($x, $y, $this->width / 2, $this->height / 2, 0, 360); + + $image->getCore()->drawImage($circle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php new file mode 100644 index 0000000000..0d6b3297d1 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/LineShape.php @@ -0,0 +1,94 @@ +x = is_numeric($x) ? intval($x) : $this->x; + $this->y = is_numeric($y) ? intval($y) : $this->y; + } + + /** + * Set current line color + * + * @param string $color + * @return void + */ + public function color($color) + { + $this->color = $color; + } + + /** + * Set current line width in pixels + * + * @param int $width + * @return void + */ + public function width($width) + { + $this->width = $width; + } + + /** + * Draw current instance of line to given endpoint on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $line = new \ImagickDraw; + + $color = new Color($this->color); + $line->setStrokeColor($color->getPixel()); + $line->setStrokeWidth($this->width); + + $line->line($this->x, $this->y, $x, $y); + $image->getCore()->drawImage($line); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php new file mode 100644 index 0000000000..45f44ad88f --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/PolygonShape.php @@ -0,0 +1,81 @@ +points = $this->formatPoints($points); + } + + /** + * Draw polygon on given image + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $polygon = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $polygon->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $polygon->setStrokeWidth($this->border_width); + $polygon->setStrokeColor($border_color->getPixel()); + } + + $polygon->polygon($this->points); + + $image->getCore()->drawImage($polygon); + + return true; + } + + /** + * Format polygon points to Imagick format + * + * @param Array $points + * @return Array + */ + private function formatPoints($points) + { + $ipoints = []; + $count = 1; + + foreach ($points as $key => $value) { + if ($count%2 === 0) { + $y = $value; + $ipoints[] = ['x' => $x, 'y' => $y]; + } else { + $x = $value; + } + $count++; + } + + return $ipoints; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php new file mode 100644 index 0000000000..1166d77b79 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Imagick/Shapes/RectangleShape.php @@ -0,0 +1,84 @@ +x1 = is_numeric($x1) ? intval($x1) : $this->x1; + $this->y1 = is_numeric($y1) ? intval($y1) : $this->y1; + $this->x2 = is_numeric($x2) ? intval($x2) : $this->x2; + $this->y2 = is_numeric($y2) ? intval($y2) : $this->y2; + } + + /** + * Draw rectangle to given image at certain position + * + * @param Image $image + * @param int $x + * @param int $y + * @return boolean + */ + public function applyToImage(Image $image, $x = 0, $y = 0) + { + $rectangle = new \ImagickDraw; + + // set background + $bgcolor = new Color($this->background); + $rectangle->setFillColor($bgcolor->getPixel()); + + // set border + if ($this->hasBorder()) { + $border_color = new Color($this->border_color); + $rectangle->setStrokeWidth($this->border_width); + $rectangle->setStrokeColor($border_color->getPixel()); + } + + $rectangle->rectangle($this->x1, $this->y1, $this->x2, $this->y2); + + $image->getCore()->drawImage($rectangle); + + return true; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Point.php b/vendor/intervention/image/src/Intervention/Image/Point.php new file mode 100644 index 0000000000..d51452e026 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Point.php @@ -0,0 +1,64 @@ +x = is_numeric($x) ? intval($x) : 0; + $this->y = is_numeric($y) ? intval($y) : 0; + } + + /** + * Sets X coordinate + * + * @param int $x + */ + public function setX($x) + { + $this->x = intval($x); + } + + /** + * Sets Y coordinate + * + * @param int $y + */ + public function setY($y) + { + $this->y = intval($y); + } + + /** + * Sets both X and Y coordinate + * + * @param int $x + * @param int $y + */ + public function setPosition($x, $y) + { + $this->setX($x); + $this->setY($y); + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Response.php b/vendor/intervention/image/src/Intervention/Image/Response.php new file mode 100644 index 0000000000..8e79408117 --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Response.php @@ -0,0 +1,78 @@ +image = $image; + $this->format = $format ? $format : $image->mime; + $this->quality = $quality ? $quality : 90; + } + + /** + * Builds response according to settings + * + * @return mixed + */ + public function make() + { + $this->image->encode($this->format, $this->quality); + $data = $this->image->getEncoded(); + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data); + $length = strlen($data); + + if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) { + + $response = IlluminateResponse::make($data); + $response->header('Content-Type', $mime); + $response->header('Content-Length', $length); + + } elseif (class_exists('\Symfony\Component\HttpFoundation\Response')) { + + $response = SymfonyResponse::create($data); + $response->headers->set('Content-Type', $mime); + $response->headers->set('Content-Length', $length); + + } else { + + header('Content-Type: ' . $mime); + header('Content-Length: ' . $length); + $response = $data; + } + + return $response; + } +} diff --git a/vendor/intervention/image/src/Intervention/Image/Size.php b/vendor/intervention/image/src/Intervention/Image/Size.php new file mode 100644 index 0000000000..46ae3135ef --- /dev/null +++ b/vendor/intervention/image/src/Intervention/Image/Size.php @@ -0,0 +1,374 @@ +width = is_numeric($width) ? intval($width) : 1; + $this->height = is_numeric($height) ? intval($height) : 1; + $this->pivot = $pivot ? $pivot : new Point; + } + + /** + * Set the width and height absolutely + * + * @param int $width + * @param int $height + */ + public function set($width, $height) + { + $this->width = $width; + $this->height = $height; + } + + /** + * Set current pivot point + * + * @param Point $point + */ + public function setPivot(Point $point) + { + $this->pivot = $point; + } + + /** + * Get the current width + * + * @return int + */ + public function getWidth() + { + return $this->width; + } + + /** + * Get the current height + * + * @return int + */ + public function getHeight() + { + return $this->height; + } + + /** + * Calculate the current aspect ratio + * + * @return float + */ + public function getRatio() + { + return $this->width / $this->height; + } + + /** + * Resize to desired width and/or height + * + * @param int $width + * @param int $height + * @param Closure $callback + * @return Size + */ + public function resize($width, $height, Closure $callback = null) + { + if (is_null($width) && is_null($height)) { + throw new InvalidArgumentException( + "Width or height needs to be defined." + ); + } + + // new size with dominant width + $dominant_w_size = clone $this; + $dominant_w_size->resizeHeight($height, $callback); + $dominant_w_size->resizeWidth($width, $callback); + + // new size with dominant height + $dominant_h_size = clone $this; + $dominant_h_size->resizeWidth($width, $callback); + $dominant_h_size->resizeHeight($height, $callback); + + // decide which size to use + if ($dominant_h_size->fitsInto(new self($width, $height))) { + $this->set($dominant_h_size->width, $dominant_h_size->height); + } else { + $this->set($dominant_w_size->width, $dominant_w_size->height); + } + + return $this; + } + + /** + * Scale size according to given constraints + * + * @param int $width + * @param Closure $callback + * @return Size + */ + private function resizeWidth($width, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($width)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($width > $max_width) ? $max_width : $width; + } else { + $this->width = $width; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $h = max(1, intval(round($this->width / $constraint->getSize()->getRatio()))); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($h > $max_height) ? $max_height : $h; + } else { + $this->height = $h; + } + } + } + } + + /** + * Scale size according to given constraints + * + * @param int $height + * @param Closure $callback + * @return Size + */ + private function resizeHeight($height, Closure $callback = null) + { + $constraint = $this->getConstraint($callback); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $max_width = $constraint->getSize()->getWidth(); + $max_height = $constraint->getSize()->getHeight(); + } + + if (is_numeric($height)) { + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->height = ($height > $max_height) ? $max_height : $height; + } else { + $this->height = $height; + } + + if ($constraint->isFixed(Constraint::ASPECTRATIO)) { + $w = max(1, intval(round($this->height * $constraint->getSize()->getRatio()))); + + if ($constraint->isFixed(Constraint::UPSIZE)) { + $this->width = ($w > $max_width) ? $max_width : $w; + } else { + $this->width = $w; + } + } + } + } + + /** + * Calculate the relative position to another Size + * based on the pivot point settings of both sizes. + * + * @param Size $size + * @return \Intervention\Image\Point + */ + public function relativePosition(Size $size) + { + $x = $this->pivot->x - $size->pivot->x; + $y = $this->pivot->y - $size->pivot->y; + + return new Point($x, $y); + } + + /** + * Resize given Size to best fitting size of current size. + * + * @param Size $size + * @return \Intervention\Image\Size + */ + public function fit(Size $size, $position = 'center') + { + // create size with auto height + $auto_height = clone $size; + + $auto_height->resize($this->width, null, function ($constraint) { + $constraint->aspectRatio(); + }); + + // decide which version to use + if ($auto_height->fitsInto($this)) { + + $size = $auto_height; + + } else { + + // create size with auto width + $auto_width = clone $size; + + $auto_width->resize(null, $this->height, function ($constraint) { + $constraint->aspectRatio(); + }); + + $size = $auto_width; + } + + $this->align($position); + $size->align($position); + $size->setPivot($this->relativePosition($size)); + + return $size; + } + + /** + * Checks if given size fits into current size + * + * @param Size $size + * @return boolean + */ + public function fitsInto(Size $size) + { + return ($this->width <= $size->width) && ($this->height <= $size->height); + } + + /** + * Aligns current size's pivot point to given position + * and moves point automatically by offset. + * + * @param string $position + * @param int $offset_x + * @param int $offset_y + * @return \Intervention\Image\Size + */ + public function align($position, $offset_x = 0, $offset_y = 0) + { + switch (strtolower($position)) { + + case 'top': + case 'top-center': + case 'top-middle': + case 'center-top': + case 'middle-top': + $x = intval($this->width / 2); + $y = 0 + $offset_y; + break; + + case 'top-right': + case 'right-top': + $x = $this->width - $offset_x; + $y = 0 + $offset_y; + break; + + case 'left': + case 'left-center': + case 'left-middle': + case 'center-left': + case 'middle-left': + $x = 0 + $offset_x; + $y = intval($this->height / 2); + break; + + case 'right': + case 'right-center': + case 'right-middle': + case 'center-right': + case 'middle-right': + $x = $this->width - $offset_x; + $y = intval($this->height / 2); + break; + + case 'bottom-left': + case 'left-bottom': + $x = 0 + $offset_x; + $y = $this->height - $offset_y; + break; + + case 'bottom': + case 'bottom-center': + case 'bottom-middle': + case 'center-bottom': + case 'middle-bottom': + $x = intval($this->width / 2); + $y = $this->height - $offset_y; + break; + + case 'bottom-right': + case 'right-bottom': + $x = $this->width - $offset_x; + $y = $this->height - $offset_y; + break; + + case 'center': + case 'middle': + case 'center-center': + case 'middle-middle': + $x = intval($this->width / 2); + $y = intval($this->height / 2); + break; + + default: + case 'top-left': + case 'left-top': + $x = 0 + $offset_x; + $y = 0 + $offset_y; + break; + } + + $this->pivot->setPosition($x, $y); + + return $this; + } + + /** + * Runs constraints on current size + * + * @param Closure $callback + * @return \Intervention\Image\Constraint + */ + private function getConstraint(Closure $callback = null) + { + $constraint = new Constraint(clone $this); + + if (is_callable($callback)) { + $callback($constraint); + } + + return $constraint; + } +} diff --git a/vendor/intervention/image/src/config/config.php b/vendor/intervention/image/src/config/config.php new file mode 100644 index 0000000000..2b1d2c3e11 --- /dev/null +++ b/vendor/intervention/image/src/config/config.php @@ -0,0 +1,20 @@ + 'gd' + +]; diff --git a/vendor/psr/http-message/CHANGELOG.md b/vendor/psr/http-message/CHANGELOG.md new file mode 100644 index 0000000000..74b1ef923c --- /dev/null +++ b/vendor/psr/http-message/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.0.1 - 2016-08-06 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Updated all `@return self` annotation references in interfaces to use + `@return static`, which more closelly follows the semantics of the + specification. +- Updated the `MessageInterface::getHeaders()` return annotation to use the + value `string[][]`, indicating the format is a nested array of strings. +- Updated the `@link` annotation for `RequestInterface::withRequestTarget()` + to point to the correct section of RFC 7230. +- Updated the `ServerRequestInterface::withUploadedFiles()` parameter annotation + to add the parameter name (`$uploadedFiles`). +- Updated a `@throws` annotation for the `UploadedFileInterface::moveTo()` + method to correctly reference the method parameter (it was referencing an + incorrect parameter name previously). + +## 1.0.0 - 2016-05-18 + +Initial stable release; reflects accepted PSR-7 specification. diff --git a/vendor/psr/http-message/LICENSE b/vendor/psr/http-message/LICENSE new file mode 100644 index 0000000000..c2d8e452de --- /dev/null +++ b/vendor/psr/http-message/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/psr/http-message/README.md b/vendor/psr/http-message/README.md new file mode 100644 index 0000000000..28185338f7 --- /dev/null +++ b/vendor/psr/http-message/README.md @@ -0,0 +1,13 @@ +PSR Http Message +================ + +This repository holds all interfaces/classes/traits related to +[PSR-7](http://www.php-fig.org/psr/psr-7/). + +Note that this is not a HTTP message implementation of its own. It is merely an +interface that describes a HTTP message. See the specification for more details. + +Usage +----- + +We'll certainly need some stuff in here. \ No newline at end of file diff --git a/vendor/psr/http-message/composer.json b/vendor/psr/http-message/composer.json new file mode 100644 index 0000000000..b0d2937a03 --- /dev/null +++ b/vendor/psr/http-message/composer.json @@ -0,0 +1,26 @@ +{ + "name": "psr/http-message", + "description": "Common interface for HTTP messages", + "keywords": ["psr", "psr-7", "http", "http-message", "request", "response"], + "homepage": "https://github.com/php-fig/http-message", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php new file mode 100644 index 0000000000..dd46e5ec81 --- /dev/null +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -0,0 +1,187 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders(); + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader($name); + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader($name); + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine($name); + + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader($name, $value); + + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader($name, $value); + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader($name); + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody(); + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body); +} diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php new file mode 100644 index 0000000000..a96d4fd636 --- /dev/null +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -0,0 +1,129 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams(); + + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query); + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles(); + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles); + + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data); + + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes(); + + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute($name, $default = null); + + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute($name, $value); + + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute($name); +} diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php new file mode 100644 index 0000000000..f68f391269 --- /dev/null +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -0,0 +1,158 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority(); + + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo(); + + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost(); + + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort(); + + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath(); + + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery(); + + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment(); + + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme($scheme); + + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo($user, $password = null); + + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost($host); + + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort($port); + + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath($path); + + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery($query); + + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment($fragment); + + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString(); +} diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 0000000000..be5540c2af --- /dev/null +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 0000000000..9430d76bbc --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 0000000000..de8ce62e45 --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000000..c7285a5ba1 --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ + 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +}