From 8e6476b4028e44687e10bf7fb2617a2d2fff97d2 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Fri, 15 Dec 2017 13:27:25 -0800 Subject: Update composer dependencies --- vendor/composer/autoload_classmap.php | 44 +- vendor/composer/autoload_psr4.php | 4 +- vendor/composer/autoload_static.php | 60 +- vendor/composer/installed.json | 519 +++++++++------ vendor/gregwar/captcha/.gitignore | 1 + vendor/gregwar/captcha/.travis.yml | 4 + vendor/gregwar/captcha/CaptchaBuilder.php | 720 -------------------- vendor/gregwar/captcha/CaptchaBuilderInterface.php | 30 - vendor/gregwar/captcha/Font/captcha0.ttf | Bin 49224 -> 0 bytes vendor/gregwar/captcha/Font/captcha1.ttf | Bin 76232 -> 0 bytes vendor/gregwar/captcha/Font/captcha2.ttf | Bin 33984 -> 0 bytes vendor/gregwar/captcha/Font/captcha3.ttf | Bin 15976 -> 0 bytes vendor/gregwar/captcha/Font/captcha4.ttf | Bin 906980 -> 0 bytes vendor/gregwar/captcha/Font/captcha5.ttf | Bin 49724 -> 0 bytes vendor/gregwar/captcha/ImageFileHandler.php | 106 --- vendor/gregwar/captcha/LICENSE | 2 +- vendor/gregwar/captcha/PhraseBuilder.php | 34 - vendor/gregwar/captcha/PhraseBuilderInterface.php | 21 - vendor/gregwar/captcha/README.md | 34 +- vendor/gregwar/captcha/autoload.php | 16 - vendor/gregwar/captcha/composer.json | 9 +- vendor/gregwar/captcha/demo/demo.php | 5 +- vendor/gregwar/captcha/demo/fingerprint.php | 5 +- vendor/gregwar/captcha/demo/ocr.php | 5 +- vendor/gregwar/captcha/demo/output.php | 5 +- vendor/gregwar/captcha/phpunit.xml.dist | 15 + .../captcha/src/Gregwar/Captcha/CaptchaBuilder.php | 721 ++++++++++++++++++++ .../Gregwar/Captcha/CaptchaBuilderInterface.php | 29 + .../captcha/src/Gregwar/Captcha/Font/captcha0.ttf | Bin 0 -> 49224 bytes .../captcha/src/Gregwar/Captcha/Font/captcha1.ttf | Bin 0 -> 76232 bytes .../captcha/src/Gregwar/Captcha/Font/captcha2.ttf | Bin 0 -> 33984 bytes .../captcha/src/Gregwar/Captcha/Font/captcha3.ttf | Bin 0 -> 15976 bytes .../captcha/src/Gregwar/Captcha/Font/captcha4.ttf | Bin 0 -> 906980 bytes .../captcha/src/Gregwar/Captcha/Font/captcha5.ttf | Bin 0 -> 49724 bytes .../src/Gregwar/Captcha/ImageFileHandler.php | 105 +++ .../captcha/src/Gregwar/Captcha/PhraseBuilder.php | 59 ++ .../src/Gregwar/Captcha/PhraseBuilderInterface.php | 21 + .../gregwar/captcha/tests/CaptchaBuilderTest.php | 30 + vendor/paragonie/random_compat/CHANGELOG.md | 260 -------- vendor/paragonie/random_compat/ERRATA.md | 34 - vendor/paragonie/random_compat/README.md | 176 ----- vendor/paragonie/random_compat/SECURITY.md | 108 --- vendor/paragonie/random_compat/composer.json | 66 +- .../random_compat/lib/byte_safe_strings.php | 20 +- vendor/paragonie/random_compat/lib/cast_to_int.php | 26 +- .../paragonie/random_compat/lib/error_polyfill.php | 17 +- vendor/paragonie/random_compat/lib/random.php | 298 +++++---- .../random_compat/lib/random_bytes_com_dotnet.php | 107 +-- .../random_compat/lib/random_bytes_dev_urandom.php | 211 +++--- .../random_compat/lib/random_bytes_libsodium.php | 108 +-- .../lib/random_bytes_libsodium_legacy.php | 110 ++-- .../random_compat/lib/random_bytes_mcrypt.php | 87 +-- vendor/paragonie/random_compat/lib/random_int.php | 319 +++++---- vendor/paragonie/random_compat/psalm-autoload.php | 9 + vendor/paragonie/random_compat/psalm.xml | 16 + vendor/pimple/pimple/.travis.yml | 16 +- vendor/pimple/pimple/CHANGELOG | 20 + vendor/pimple/pimple/LICENSE | 2 +- vendor/pimple/pimple/README.rst | 149 ++++- vendor/pimple/pimple/composer.json | 8 +- vendor/pimple/pimple/ext/pimple/config.m4 | 2 +- vendor/pimple/pimple/ext/pimple/php_pimple.h | 18 +- vendor/pimple/pimple/ext/pimple/pimple.c | 226 ++++++- vendor/pimple/pimple/src/Pimple/Container.php | 50 +- .../Exception/ExpectedInvokableException.php | 38 ++ .../Pimple/Exception/FrozenServiceException.php | 45 ++ .../InvalidServiceIdentifierException.php | 45 ++ .../Exception/UnknownIdentifierException.php | 45 ++ .../pimple/pimple/src/Pimple/Psr11/Container.php | 55 ++ .../pimple/src/Pimple/Psr11/ServiceLocator.php | 75 +++ .../pimple/pimple/src/Pimple/ServiceIterator.php | 69 ++ .../pimple/pimple/src/Pimple/Tests/PimpleTest.php | 163 ++++- .../src/Pimple/Tests/Psr11/ContainerTest.php | 77 +++ .../src/Pimple/Tests/Psr11/ServiceLocatorTest.php | 134 ++++ .../src/Pimple/Tests/ServiceIteratorTest.php | 52 ++ vendor/psr/container/.gitignore | 3 + vendor/psr/container/LICENSE | 21 + vendor/psr/container/README.md | 5 + vendor/psr/container/composer.json | 27 + .../container/src/ContainerExceptionInterface.php | 13 + vendor/psr/container/src/ContainerInterface.php | 37 ++ .../container/src/NotFoundExceptionInterface.php | 13 + vendor/swiftmailer/swiftmailer/.gitignore | 6 +- vendor/swiftmailer/swiftmailer/.php_cs.dist | 15 + vendor/swiftmailer/swiftmailer/.travis.yml | 8 +- vendor/swiftmailer/swiftmailer/CHANGES | 30 +- vendor/swiftmailer/swiftmailer/VERSION | 2 +- .../lib/classes/Swift/CharacterReader.php | 4 +- .../classes/Swift/CharacterReader/Utf8Reader.php | 32 +- .../Swift/CharacterStream/ArrayCharacterStream.php | 2 +- .../lib/classes/Swift/DependencyContainer.php | 18 +- .../lib/classes/Swift/Encoder/QpEncoder.php | 6 +- .../swiftmailer/lib/classes/Swift/Encoding.php | 2 - .../lib/classes/Swift/Events/CommandEvent.php | 4 +- .../lib/classes/Swift/FailoverTransport.php | 2 +- .../swiftmailer/lib/classes/Swift/Image.php | 10 +- .../lib/classes/Swift/LoadBalancedTransport.php | 2 +- .../lib/classes/Swift/MailTransport.php | 2 +- .../swiftmailer/lib/classes/Swift/Mailer.php | 2 +- .../swiftmailer/lib/classes/Swift/Message.php | 4 +- .../lib/classes/Swift/Mime/Attachment.php | 8 +- .../lib/classes/Swift/Mime/HeaderSet.php | 2 +- .../classes/Swift/Mime/Headers/AbstractHeader.php | 4 +- .../lib/classes/Swift/Mime/Headers/DateHeader.php | 2 +- .../classes/Swift/Mime/Headers/MailboxHeader.php | 6 +- .../Swift/Mime/Headers/ParameterizedHeader.php | 4 +- .../lib/classes/Swift/Mime/Headers/PathHeader.php | 2 +- .../lib/classes/Swift/Mime/MimePart.php | 10 +- .../lib/classes/Swift/Mime/SimpleHeaderSet.php | 2 +- .../lib/classes/Swift/Mime/SimpleMimeEntity.php | 31 +- .../swiftmailer/lib/classes/Swift/MimePart.php | 2 +- .../lib/classes/Swift/NullTransport.php | 5 +- .../classes/Swift/Plugins/ImpersonatePlugin.php | 2 +- .../lib/classes/Swift/Plugins/MessageLogger.php | 4 +- .../classes/Swift/Plugins/PopBeforeSmtpPlugin.php | 10 +- .../swiftmailer/lib/classes/Swift/Preferences.php | 19 +- .../lib/classes/Swift/SendmailTransport.php | 2 +- .../lib/classes/Swift/Signers/BodySigner.php | 2 +- .../lib/classes/Swift/Signers/DKIMSigner.php | 60 +- .../lib/classes/Swift/Signers/DomainKeySigner.php | 31 +- .../lib/classes/Swift/Signers/HeaderSigner.php | 10 +- .../lib/classes/Swift/Signers/OpenDKIMSigner.php | 6 +- .../lib/classes/Swift/Signers/SMimeSigner.php | 18 +- .../lib/classes/Swift/SmtpTransport.php | 2 +- .../lib/classes/Swift/SpoolTransport.php | 2 +- .../StreamFilters/ByteArrayReplacementFilter.php | 2 +- .../StreamFilters/StringReplacementFilter.php | 4 + .../Swift/Transport/AbstractSmtpTransport.php | 9 +- .../Transport/Esmtp/Auth/NTLMAuthenticator.php | 17 +- .../lib/classes/Swift/Transport/EsmtpTransport.php | 18 +- .../lib/classes/Swift/Transport/MailTransport.php | 4 +- .../classes/Swift/Transport/SendmailTransport.php | 2 +- .../lib/classes/Swift/Transport/SpoolTransport.php | 2 +- .../lib/classes/Swift/Transport/StreamBuffer.php | 2 +- .../swiftmailer/lib/dependency_maps/mime_deps.php | 2 +- vendor/swiftmailer/swiftmailer/lib/preferences.php | 2 +- .../swiftmailer/tests/SwiftMailerSmokeTestCase.php | 2 +- .../swiftmailer/tests/acceptance.conf.php.default | 7 - .../ByteStream/FileByteStreamAcceptanceTest.php | 46 +- .../SimpleCharacterReaderFactoryAcceptanceTest.php | 30 +- .../Swift/Encoder/Base64EncoderAcceptanceTest.php | 2 +- .../Swift/Encoder/QpEncoderAcceptanceTest.php | 2 +- .../Swift/Encoder/Rfc2231EncoderAcceptanceTest.php | 2 +- .../Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php | 2 +- .../Swift/KeyCache/DiskKeyCacheAcceptanceTest.php | 14 +- .../acceptance/Swift/MessageAcceptanceTest.php | 2 - .../Swift/Mime/AttachmentAcceptanceTest.php | 4 +- .../Base64ContentEncoderAcceptanceTest.php | 2 +- .../NativeQpContentEncoderAcceptanceTest.php | 4 +- .../PlainContentEncoderAcceptanceTest.php | 2 +- .../QpContentEncoderAcceptanceTest.php | 4 +- .../Swift/Mime/EmbeddedFileAcceptanceTest.php | 4 +- .../Base64HeaderEncoderAcceptanceTest.php | 2 +- .../Swift/Mime/MimePartAcceptanceTest.php | 4 +- .../Swift/Mime/SimpleMessageAcceptanceTest.php | 4 +- .../AbstractStreamBufferAcceptanceTest.php | 4 +- .../StreamBuffer/BasicSocketAcceptanceTest.php | 2 +- .../StreamBuffer/ProcessAcceptanceTest.php | 2 +- .../Transport/StreamBuffer/SocketTimeoutTest.php | 6 +- .../StreamBuffer/SslSocketAcceptanceTest.php | 2 +- .../StreamBuffer/TlsSocketAcceptanceTest.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug118Test.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug206Test.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug34Test.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug35Test.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug38Test.php | 4 +- .../swiftmailer/tests/bug/Swift/Bug51Test.php | 19 +- .../swiftmailer/tests/bug/Swift/Bug71Test.php | 2 +- .../swiftmailer/tests/bug/Swift/Bug76Test.php | 19 +- .../tests/fixtures/MimeEntityFixture.php | 8 + .../smoke/Swift/Smoke/AttachmentSmokeTest.php | 2 +- .../Swift/Smoke/HtmlWithAttachmentSmokeTest.php | 2 +- .../smoke/Swift/Smoke/InternationalSmokeTest.php | 2 +- .../unit/Swift/ByteStream/ArrayByteStreamTest.php | 2 - .../Swift/CharacterReader/UsAsciiReaderTest.php | 2 +- .../unit/Swift/CharacterReader/Utf8ReaderTest.php | 2 +- .../CharacterStream/ArrayCharacterStreamTest.php | 2 - .../tests/unit/Swift/DependencyContainerTest.php | 7 +- .../tests/unit/Swift/Encoder/Base64EncoderTest.php | 2 +- .../tests/unit/Swift/Encoder/QpEncoderTest.php | 2 - .../tests/unit/Swift/Events/CommandEventTest.php | 2 - .../tests/unit/Swift/Events/EventObjectTest.php | 2 - .../tests/unit/Swift/Events/ResponseEventTest.php | 2 - .../tests/unit/Swift/Events/SendEventTest.php | 2 - .../Swift/Events/SimpleEventDispatcherTest.php | 12 +- .../unit/Swift/Events/TransportChangeEventTest.php | 2 - .../Swift/Events/TransportExceptionEventTest.php | 2 - .../unit/Swift/KeyCache/ArrayKeyCacheTest.php | 2 - .../swiftmailer/tests/unit/Swift/MailerTest.php | 2 - .../swiftmailer/tests/unit/Swift/MessageTest.php | 1 - .../unit/Swift/Mime/AbstractMimeEntityTest.php | 42 +- .../tests/unit/Swift/Mime/AttachmentTest.php | 2 - .../ContentEncoder/Base64ContentEncoderTest.php | 2 +- .../ContentEncoder/PlainContentEncoderTest.php | 2 - .../Mime/ContentEncoder/QpContentEncoderTest.php | 2 - .../tests/unit/Swift/Mime/EmbeddedFileTest.php | 2 - .../Mime/HeaderEncoder/QpHeaderEncoderTest.php | 2 - .../Swift/Mime/Headers/ParameterizedHeaderTest.php | 2 - .../tests/unit/Swift/Mime/MimePartTest.php | 2 - .../unit/Swift/Mime/SimpleHeaderFactoryTest.php | 16 +- .../tests/unit/Swift/Mime/SimpleHeaderSetTest.php | 4 +- .../tests/unit/Swift/Mime/SimpleMessageTest.php | 2 - .../tests/unit/Swift/Mime/SimpleMimeEntityTest.php | 2 - .../unit/Swift/Plugins/AntiFloodPluginTest.php | 2 - .../Swift/Plugins/BandwidthMonitorPluginTest.php | 4 +- .../unit/Swift/Plugins/DecoratorPluginTest.php | 2 - .../tests/unit/Swift/Plugins/LoggerPluginTest.php | 2 - .../unit/Swift/Plugins/PopBeforeSmtpPluginTest.php | 2 - .../unit/Swift/Plugins/RedirectingPluginTest.php | 2 - .../unit/Swift/Plugins/ReporterPluginTest.php | 2 - .../Swift/Plugins/Reporters/HitReporterTest.php | 2 +- .../Swift/Plugins/Reporters/HtmlReporterTest.php | 2 +- .../unit/Swift/Plugins/ThrottlerPluginTest.php | 2 - .../tests/unit/Swift/Signers/DKIMSignerTest.php | 14 +- .../unit/Swift/Signers/OpenDKIMSignerTest.php | 2 +- .../tests/unit/Swift/Signers/SMimeSignerTest.php | 2 +- .../ByteArrayReplacementFilterTest.php | 2 - .../StringReplacementFilterFactoryTest.php | 4 +- .../StreamFilters/StringReplacementFilterTest.php | 6 +- .../Transport/AbstractSmtpEventSupportTest.php | 2 - .../Esmtp/Auth/CramMd5AuthenticatorTest.php | 4 +- .../Esmtp/Auth/LoginAuthenticatorTest.php | 4 +- .../Transport/Esmtp/Auth/NTLMAuthenticatorTest.php | 78 +-- .../Esmtp/Auth/PlainAuthenticatorTest.php | 4 +- .../unit/Swift/Transport/Esmtp/AuthHandlerTest.php | 4 +- .../EsmtpTransport/ExtensionSupportTest.php | 1 + .../unit/Swift/Transport/FailoverTransportTest.php | 2 - .../Swift/Transport/LoadBalancedTransportTest.php | 4 +- .../unit/Swift/Transport/MailTransportTest.php | 4 +- .../unit/Swift/Transport/StreamBufferTest.php | 2 - vendor/symfony/finder/.gitignore | 3 + vendor/symfony/finder/CHANGELOG.md | 55 ++ vendor/symfony/finder/Comparator/Comparator.php | 98 +++ .../symfony/finder/Comparator/DateComparator.php | 51 ++ .../symfony/finder/Comparator/NumberComparator.php | 79 +++ .../finder/Exception/AccessDeniedException.php | 19 + .../finder/Exception/ExceptionInterface.php | 25 + vendor/symfony/finder/Finder.php | 723 +++++++++++++++++++++ vendor/symfony/finder/Glob.php | 116 ++++ .../finder/Iterator/CustomFilterIterator.php | 61 ++ .../finder/Iterator/DateRangeFilterIterator.php | 58 ++ .../finder/Iterator/DepthRangeFilterIterator.php | 45 ++ .../Iterator/ExcludeDirectoryFilterIterator.php | 84 +++ .../finder/Iterator/FileTypeFilterIterator.php | 53 ++ .../finder/Iterator/FilecontentFilterIterator.php | 58 ++ .../finder/Iterator/FilenameFilterIterator.php | 47 ++ vendor/symfony/finder/Iterator/FilterIterator.php | 60 ++ .../finder/Iterator/MultiplePcreFilterIterator.php | 112 ++++ .../symfony/finder/Iterator/PathFilterIterator.php | 56 ++ .../finder/Iterator/RecursiveDirectoryIterator.php | 154 +++++ .../finder/Iterator/SizeRangeFilterIterator.php | 57 ++ .../symfony/finder/Iterator/SortableIterator.php | 80 +++ vendor/symfony/finder/LICENSE | 19 + vendor/symfony/finder/README.md | 14 + vendor/symfony/finder/SplFileInfo.php | 79 +++ .../finder/Tests/Comparator/ComparatorTest.php | 65 ++ .../finder/Tests/Comparator/DateComparatorTest.php | 64 ++ .../Tests/Comparator/NumberComparatorTest.php | 108 +++ vendor/symfony/finder/Tests/FinderTest.php | 698 ++++++++++++++++++++ vendor/symfony/finder/Tests/Fixtures/.dot/a | 0 vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon | 0 vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon | 0 vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat | 0 vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat | 0 vendor/symfony/finder/Tests/Fixtures/A/a.dat | 0 .../finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy | 0 .../finder/Tests/Fixtures/copy/A/B/ab.dat.copy | 0 .../finder/Tests/Fixtures/copy/A/a.dat.copy | 0 vendor/symfony/finder/Tests/Fixtures/dolor.txt | 2 + vendor/symfony/finder/Tests/Fixtures/ipsum.txt | 2 + vendor/symfony/finder/Tests/Fixtures/lorem.txt | 2 + vendor/symfony/finder/Tests/Fixtures/one/.dot | 1 + vendor/symfony/finder/Tests/Fixtures/one/a | 0 vendor/symfony/finder/Tests/Fixtures/one/b/c.neon | 0 vendor/symfony/finder/Tests/Fixtures/one/b/d.neon | 0 .../Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat | 0 .../finder/Tests/Fixtures/with space/foo.txt | 0 vendor/symfony/finder/Tests/GlobTest.php | 95 +++ .../Tests/Iterator/CustomFilterIteratorTest.php | 46 ++ .../Tests/Iterator/DateRangeFilterIteratorTest.php | 74 +++ .../Iterator/DepthRangeFilterIteratorTest.php | 83 +++ .../ExcludeDirectoryFilterIteratorTest.php | 80 +++ .../Tests/Iterator/FileTypeFilterIteratorTest.php | 73 +++ .../Iterator/FilecontentFilterIteratorTest.php | 86 +++ .../Tests/Iterator/FilenameFilterIteratorTest.php | 54 ++ .../finder/Tests/Iterator/FilterIteratorTest.php | 53 ++ vendor/symfony/finder/Tests/Iterator/Iterator.php | 55 ++ .../finder/Tests/Iterator/IteratorTestCase.php | 100 +++ .../finder/Tests/Iterator/MockFileListIterator.php | 21 + .../finder/Tests/Iterator/MockSplFileInfo.php | 132 ++++ .../Iterator/MultiplePcreFilterIteratorTest.php | 71 ++ .../Tests/Iterator/PathFilterIteratorTest.php | 82 +++ .../finder/Tests/Iterator/RealIteratorTestCase.php | 110 ++++ .../Iterator/RecursiveDirectoryIteratorTest.php | 59 ++ .../Tests/Iterator/SizeRangeFilterIteratorTest.php | 69 ++ .../finder/Tests/Iterator/SortableIteratorTest.php | 183 ++++++ vendor/symfony/finder/composer.json | 33 + vendor/symfony/finder/phpunit.xml.dist | 30 + 298 files changed, 8725 insertions(+), 2971 deletions(-) delete mode 100644 vendor/gregwar/captcha/CaptchaBuilder.php delete mode 100644 vendor/gregwar/captcha/CaptchaBuilderInterface.php delete mode 100644 vendor/gregwar/captcha/Font/captcha0.ttf delete mode 100644 vendor/gregwar/captcha/Font/captcha1.ttf delete mode 100644 vendor/gregwar/captcha/Font/captcha2.ttf delete mode 100644 vendor/gregwar/captcha/Font/captcha3.ttf delete mode 100644 vendor/gregwar/captcha/Font/captcha4.ttf delete mode 100644 vendor/gregwar/captcha/Font/captcha5.ttf delete mode 100644 vendor/gregwar/captcha/ImageFileHandler.php delete mode 100644 vendor/gregwar/captcha/PhraseBuilder.php delete mode 100644 vendor/gregwar/captcha/PhraseBuilderInterface.php delete mode 100644 vendor/gregwar/captcha/autoload.php create mode 100644 vendor/gregwar/captcha/phpunit.xml.dist create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha0.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha1.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha2.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha3.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha4.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/Font/captcha5.ttf create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/ImageFileHandler.php create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php create mode 100644 vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php create mode 100644 vendor/gregwar/captcha/tests/CaptchaBuilderTest.php delete mode 100644 vendor/paragonie/random_compat/CHANGELOG.md delete mode 100644 vendor/paragonie/random_compat/ERRATA.md delete mode 100644 vendor/paragonie/random_compat/README.md delete mode 100644 vendor/paragonie/random_compat/SECURITY.md create mode 100644 vendor/paragonie/random_compat/psalm-autoload.php create mode 100644 vendor/paragonie/random_compat/psalm.xml create mode 100644 vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php create mode 100644 vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php create mode 100644 vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php create mode 100644 vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php create mode 100644 vendor/pimple/pimple/src/Pimple/Psr11/Container.php create mode 100644 vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php create mode 100644 vendor/pimple/pimple/src/Pimple/ServiceIterator.php create mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php create mode 100644 vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php create mode 100644 vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php create mode 100644 vendor/psr/container/.gitignore create mode 100644 vendor/psr/container/LICENSE create mode 100644 vendor/psr/container/README.md create mode 100644 vendor/psr/container/composer.json create mode 100644 vendor/psr/container/src/ContainerExceptionInterface.php create mode 100644 vendor/psr/container/src/ContainerInterface.php create mode 100644 vendor/psr/container/src/NotFoundExceptionInterface.php create mode 100644 vendor/swiftmailer/swiftmailer/.php_cs.dist create mode 100644 vendor/symfony/finder/.gitignore create mode 100644 vendor/symfony/finder/CHANGELOG.md create mode 100644 vendor/symfony/finder/Comparator/Comparator.php create mode 100644 vendor/symfony/finder/Comparator/DateComparator.php create mode 100644 vendor/symfony/finder/Comparator/NumberComparator.php create mode 100644 vendor/symfony/finder/Exception/AccessDeniedException.php create mode 100644 vendor/symfony/finder/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/finder/Finder.php create mode 100644 vendor/symfony/finder/Glob.php create mode 100644 vendor/symfony/finder/Iterator/CustomFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/DateRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FileTypeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FilecontentFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FilenameFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/FilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/PathFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php create mode 100644 vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php create mode 100644 vendor/symfony/finder/Iterator/SortableIterator.php create mode 100644 vendor/symfony/finder/LICENSE create mode 100644 vendor/symfony/finder/README.md create mode 100644 vendor/symfony/finder/SplFileInfo.php create mode 100644 vendor/symfony/finder/Tests/Comparator/ComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php create mode 100644 vendor/symfony/finder/Tests/FinderTest.php create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/a create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/A/a.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy create mode 100644 vendor/symfony/finder/Tests/Fixtures/dolor.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/ipsum.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/lorem.txt create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/.dot create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/a create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/b/c.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/one/b/d.neon create mode 100644 vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat create mode 100644 vendor/symfony/finder/Tests/Fixtures/with space/foo.txt create mode 100644 vendor/symfony/finder/Tests/GlobTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/Iterator.php create mode 100644 vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php create mode 100644 vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php create mode 100644 vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php create mode 100644 vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php create mode 100644 vendor/symfony/finder/composer.json create mode 100644 vendor/symfony/finder/phpunit.xml.dist (limited to 'vendor') diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index ec299289..c35926d1 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -29,11 +29,11 @@ return array( 'Eluceo\\iCal\\Util\\ComponentUtil' => $vendorDir . '/eluceo/ical/src/Eluceo/iCal/Util/ComponentUtil.php', 'Eluceo\\iCal\\Util\\DateUtil' => $vendorDir . '/eluceo/ical/src/Eluceo/iCal/Util/DateUtil.php', 'Eluceo\\iCal\\Util\\PropertyValueUtil' => $vendorDir . '/eluceo/ical/src/Eluceo/iCal/Util/PropertyValueUtil.php', - 'Gregwar\\Captcha\\CaptchaBuilder' => $vendorDir . '/gregwar/captcha/CaptchaBuilder.php', - 'Gregwar\\Captcha\\CaptchaBuilderInterface' => $vendorDir . '/gregwar/captcha/CaptchaBuilderInterface.php', - 'Gregwar\\Captcha\\ImageFileHandler' => $vendorDir . '/gregwar/captcha/ImageFileHandler.php', - 'Gregwar\\Captcha\\PhraseBuilder' => $vendorDir . '/gregwar/captcha/PhraseBuilder.php', - 'Gregwar\\Captcha\\PhraseBuilderInterface' => $vendorDir . '/gregwar/captcha/PhraseBuilderInterface.php', + 'Gregwar\\Captcha\\CaptchaBuilder' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php', + 'Gregwar\\Captcha\\CaptchaBuilderInterface' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php', + 'Gregwar\\Captcha\\ImageFileHandler' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/ImageFileHandler.php', + 'Gregwar\\Captcha\\PhraseBuilder' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php', + 'Gregwar\\Captcha\\PhraseBuilderInterface' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php', 'JsonRPC\\Client' => $vendorDir . '/fguillot/json-rpc/src/JsonRPC/Client.php', 'JsonRPC\\Exception\\AccessDeniedException' => $vendorDir . '/fguillot/json-rpc/src/JsonRPC/Exception/AccessDeniedException.php', 'JsonRPC\\Exception\\AuthenticationFailureException' => $vendorDir . '/fguillot/json-rpc/src/JsonRPC/Exception/AuthenticationFailureException.php', @@ -767,6 +767,13 @@ return array( 'PicoFeed\\Syndication\\Rss20Helper' => $vendorDir . '/miniflux/picofeed/lib/PicoFeed/Syndication/Rss20Helper.php', 'PicoFeed\\Syndication\\Rss20ItemBuilder' => $vendorDir . '/miniflux/picofeed/lib/PicoFeed/Syndication/Rss20ItemBuilder.php', 'Pimple\\Container' => $vendorDir . '/pimple/pimple/src/Pimple/Container.php', + 'Pimple\\Exception\\ExpectedInvokableException' => $vendorDir . '/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php', + 'Pimple\\Exception\\FrozenServiceException' => $vendorDir . '/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php', + 'Pimple\\Exception\\InvalidServiceIdentifierException' => $vendorDir . '/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php', + 'Pimple\\Exception\\UnknownIdentifierException' => $vendorDir . '/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php', + 'Pimple\\Psr11\\Container' => $vendorDir . '/pimple/pimple/src/Pimple/Psr11/Container.php', + 'Pimple\\Psr11\\ServiceLocator' => $vendorDir . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', + 'Pimple\\ServiceIterator' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => $vendorDir . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', 'Pimple\\Tests\\Fixtures\\Invokable' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php', 'Pimple\\Tests\\Fixtures\\NonInvokable' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php', @@ -774,6 +781,12 @@ return array( 'Pimple\\Tests\\Fixtures\\Service' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php', 'Pimple\\Tests\\PimpleServiceProviderInterfaceTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php', 'Pimple\\Tests\\PimpleTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/PimpleTest.php', + 'Pimple\\Tests\\Psr11\\ContainerTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php', + 'Pimple\\Tests\\Psr11\\ServiceLocatorTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php', + 'Pimple\\Tests\\ServiceIteratorTest' => $vendorDir . '/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php', + 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', + 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', + 'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php', 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php', @@ -928,6 +941,27 @@ return array( 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => $vendorDir . '/symfony/event-dispatcher/EventSubscriberInterface.php', 'Symfony\\Component\\EventDispatcher\\GenericEvent' => $vendorDir . '/symfony/event-dispatcher/GenericEvent.php', 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', + 'Symfony\\Component\\Finder\\Comparator\\Comparator' => $vendorDir . '/symfony/finder/Comparator/Comparator.php', + 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => $vendorDir . '/symfony/finder/Comparator/DateComparator.php', + 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => $vendorDir . '/symfony/finder/Comparator/NumberComparator.php', + 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/finder/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/finder/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Finder\\Finder' => $vendorDir . '/symfony/finder/Finder.php', + 'Symfony\\Component\\Finder\\Glob' => $vendorDir . '/symfony/finder/Glob.php', + 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => $vendorDir . '/symfony/finder/Iterator/CustomFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DateRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => $vendorDir . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FileTypeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilecontentFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilenameFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => $vendorDir . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => $vendorDir . '/symfony/finder/Iterator/PathFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => $vendorDir . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Iterator/SortableIterator.php', + 'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/SplFileInfo.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php', 'ZendXml\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zendxml/library/ZendXml/Exception/ExceptionInterface.php', 'ZendXml\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zendxml/library/ZendXml/Exception/InvalidArgumentException.php', diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index cf0305aa..284d4042 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,12 +7,14 @@ $baseDir = dirname($vendorDir); return array( 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'), 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'), 'SimpleQueue\\' => array($vendorDir . '/fguillot/simple-queue/src'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Kanboard\\' => array($baseDir . '/app'), - 'Gregwar\\Captcha\\' => array($vendorDir . '/gregwar/captcha'), + 'Gregwar\\' => array($vendorDir . '/gregwar/captcha/src/Gregwar'), 'Base32\\' => array($vendorDir . '/christian-riesen/base32/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 48245eed..885ab9b8 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -17,6 +17,7 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'S' => array ( 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Component\\Finder\\' => 25, 'Symfony\\Component\\EventDispatcher\\' => 34, 'Symfony\\Component\\Debug\\' => 24, 'Symfony\\Component\\Console\\' => 26, @@ -25,6 +26,7 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'P' => array ( 'Psr\\Log\\' => 8, + 'Psr\\Container\\' => 14, ), 'K' => array ( @@ -32,7 +34,7 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b ), 'G' => array ( - 'Gregwar\\Captcha\\' => 16, + 'Gregwar\\' => 8, ), 'B' => array ( @@ -45,6 +47,10 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', ), + 'Symfony\\Component\\Finder\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/finder', + ), 'Symfony\\Component\\EventDispatcher\\' => array ( 0 => __DIR__ . '/..' . '/symfony/event-dispatcher', @@ -65,13 +71,17 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), 'Kanboard\\' => array ( 0 => __DIR__ . '/../..' . '/app', ), - 'Gregwar\\Captcha\\' => + 'Gregwar\\' => array ( - 0 => __DIR__ . '/..' . '/gregwar/captcha', + 0 => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar', ), 'Base32\\' => array ( @@ -168,11 +178,11 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'Eluceo\\iCal\\Util\\ComponentUtil' => __DIR__ . '/..' . '/eluceo/ical/src/Eluceo/iCal/Util/ComponentUtil.php', 'Eluceo\\iCal\\Util\\DateUtil' => __DIR__ . '/..' . '/eluceo/ical/src/Eluceo/iCal/Util/DateUtil.php', 'Eluceo\\iCal\\Util\\PropertyValueUtil' => __DIR__ . '/..' . '/eluceo/ical/src/Eluceo/iCal/Util/PropertyValueUtil.php', - 'Gregwar\\Captcha\\CaptchaBuilder' => __DIR__ . '/..' . '/gregwar/captcha/CaptchaBuilder.php', - 'Gregwar\\Captcha\\CaptchaBuilderInterface' => __DIR__ . '/..' . '/gregwar/captcha/CaptchaBuilderInterface.php', - 'Gregwar\\Captcha\\ImageFileHandler' => __DIR__ . '/..' . '/gregwar/captcha/ImageFileHandler.php', - 'Gregwar\\Captcha\\PhraseBuilder' => __DIR__ . '/..' . '/gregwar/captcha/PhraseBuilder.php', - 'Gregwar\\Captcha\\PhraseBuilderInterface' => __DIR__ . '/..' . '/gregwar/captcha/PhraseBuilderInterface.php', + 'Gregwar\\Captcha\\CaptchaBuilder' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php', + 'Gregwar\\Captcha\\CaptchaBuilderInterface' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php', + 'Gregwar\\Captcha\\ImageFileHandler' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/ImageFileHandler.php', + 'Gregwar\\Captcha\\PhraseBuilder' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php', + 'Gregwar\\Captcha\\PhraseBuilderInterface' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php', 'JsonRPC\\Client' => __DIR__ . '/..' . '/fguillot/json-rpc/src/JsonRPC/Client.php', 'JsonRPC\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/fguillot/json-rpc/src/JsonRPC/Exception/AccessDeniedException.php', 'JsonRPC\\Exception\\AuthenticationFailureException' => __DIR__ . '/..' . '/fguillot/json-rpc/src/JsonRPC/Exception/AuthenticationFailureException.php', @@ -906,6 +916,13 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'PicoFeed\\Syndication\\Rss20Helper' => __DIR__ . '/..' . '/miniflux/picofeed/lib/PicoFeed/Syndication/Rss20Helper.php', 'PicoFeed\\Syndication\\Rss20ItemBuilder' => __DIR__ . '/..' . '/miniflux/picofeed/lib/PicoFeed/Syndication/Rss20ItemBuilder.php', 'Pimple\\Container' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Container.php', + 'Pimple\\Exception\\ExpectedInvokableException' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php', + 'Pimple\\Exception\\FrozenServiceException' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php', + 'Pimple\\Exception\\InvalidServiceIdentifierException' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php', + 'Pimple\\Exception\\UnknownIdentifierException' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php', + 'Pimple\\Psr11\\Container' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Psr11/Container.php', + 'Pimple\\Psr11\\ServiceLocator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php', + 'Pimple\\ServiceIterator' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceIterator.php', 'Pimple\\ServiceProviderInterface' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/ServiceProviderInterface.php', 'Pimple\\Tests\\Fixtures\\Invokable' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php', 'Pimple\\Tests\\Fixtures\\NonInvokable' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php', @@ -913,6 +930,12 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'Pimple\\Tests\\Fixtures\\Service' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php', 'Pimple\\Tests\\PimpleServiceProviderInterfaceTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php', 'Pimple\\Tests\\PimpleTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/PimpleTest.php', + 'Pimple\\Tests\\Psr11\\ContainerTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php', + 'Pimple\\Tests\\Psr11\\ServiceLocatorTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php', + 'Pimple\\Tests\\ServiceIteratorTest' => __DIR__ . '/..' . '/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php', + 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', + 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', + 'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php', 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', @@ -1067,6 +1090,27 @@ class ComposerStaticInit6edea6294a88689e3f5c56484bb70c9b 'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventSubscriberInterface.php', 'Symfony\\Component\\EventDispatcher\\GenericEvent' => __DIR__ . '/..' . '/symfony/event-dispatcher/GenericEvent.php', 'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ImmutableEventDispatcher.php', + 'Symfony\\Component\\Finder\\Comparator\\Comparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/Comparator.php', + 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/DateComparator.php', + 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/NumberComparator.php', + 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/finder/Exception/AccessDeniedException.php', + 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/finder/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Finder\\Finder' => __DIR__ . '/..' . '/symfony/finder/Finder.php', + 'Symfony\\Component\\Finder\\Glob' => __DIR__ . '/..' . '/symfony/finder/Glob.php', + 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/CustomFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DateRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FileTypeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilecontentFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilenameFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\FilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/PathFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', + 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SortableIterator.php', + 'Symfony\\Component\\Finder\\SplFileInfo' => __DIR__ . '/..' . '/symfony/finder/SplFileInfo.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php', 'ZendXml\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zendxml/library/ZendXml/Exception/ExceptionInterface.php', 'ZendXml\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zendxml/library/ZendXml/Exception/InvalidArgumentException.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index bbf6fc50..9b5d4902 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -510,56 +510,6 @@ "description": "PHP library to write logs (compatible with PSR-3)", "homepage": "https://github.com/fguillot/simpleLogger" }, - { - "name": "gregwar/captcha", - "version": "v1.1.1", - "version_normalized": "1.1.1.0", - "source": { - "type": "git", - "url": "https://github.com/Gregwar/Captcha.git", - "reference": "1240ab993ca713680573b2d4166900da5f758623" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Gregwar/Captcha/zipball/1240ab993ca713680573b2d4166900da5f758623", - "reference": "1240ab993ca713680573b2d4166900da5f758623", - "shasum": "" - }, - "require": { - "ext-gd": "*", - "php": ">=5.3.0" - }, - "time": "2015-09-11T15:23:20+00:00", - "type": "captcha", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Gregwar\\Captcha\\": "/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Grégoire Passault", - "email": "g.passault@gmail.com", - "homepage": "http://www.gregwar.com/" - }, - { - "name": "Jeremy Livingston", - "email": "jeremy.j.livingston@gmail.com" - } - ], - "description": "Captcha generator", - "homepage": "https://github.com/Gregwar/Captcha", - "keywords": [ - "bot", - "captcha", - "spam" - ] - }, { "name": "zendframework/zendxml", "version": "1.0.2", @@ -662,160 +612,6 @@ "description": "Modern library to handle RSS/Atom feeds", "homepage": "https://github.com/miniflux/picoFeed" }, - { - "name": "paragonie/random_compat", - "version": "v2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/088c04e2f261c33bed6ca5245491cfca69195ccf", - "reference": "088c04e2f261c33bed6ca5245491cfca69195ccf", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "time": "2016-04-03T06:00:07+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ] - }, - { - "name": "pimple/pimple", - "version": "v3.0.2", - "version_normalized": "3.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/a30f7d6e57565a2e1a316e1baf2a483f788b258a", - "reference": "a30f7d6e57565a2e1a316e1baf2a483f788b258a", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2015-09-11T15:10:35+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ] - }, - { - "name": "swiftmailer/swiftmailer", - "version": "v5.4.5", - "version_normalized": "5.4.5.0", - "source": { - "type": "git", - "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "cd142238a339459b10da3d8234220963f392540c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/cd142238a339459b10da3d8234220963f392540c", - "reference": "cd142238a339459b10da3d8234220963f392540c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "mockery/mockery": "~0.9.1", - "symfony/phpunit-bridge": "~3.2" - }, - "time": "2016-12-29T10:02:40+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.4-dev" - } - }, - "installation-source": "dist", - "autoload": { - "files": [ - "lib/swift_required.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Chris Corbyn" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.org", - "keywords": [ - "email", - "mail", - "mailer" - ] - }, { "name": "symfony/polyfill-mbstring", "version": "v1.6.0", @@ -1070,5 +866,320 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com" + }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "version_normalized": "2.0.11.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2017-09-27T21:40:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ] + }, + { + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2017-02-14T16:28:37+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, + { + "name": "pimple/pimple", + "version": "v3.2.2", + "version_normalized": "3.2.2.0", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/4d45fb62d96418396ec58ba76e6f065bca16e10a", + "reference": "4d45fb62d96418396ec58ba76e6f065bca16e10a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "time": "2017-07-23T07:32:15+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ] + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.8", + "version_normalized": "5.4.8.0", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/9a06dc570a0367850280eefd3f1dc2da45aef517", + "reference": "9a06dc570a0367850280eefd3f1dc2da45aef517", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1", + "symfony/phpunit-bridge": "~3.2" + }, + "time": "2017-05-01T15:54:03+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org", + "keywords": [ + "email", + "mail", + "mailer" + ] + }, + { + "name": "symfony/finder", + "version": "v3.4.2", + "version_normalized": "3.4.2.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a", + "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "time": "2017-11-05T16:10:10+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com" + }, + { + "name": "gregwar/captcha", + "version": "v1.1.4", + "version_normalized": "1.1.4.0", + "source": { + "type": "git", + "url": "https://github.com/Gregwar/Captcha.git", + "reference": "0185f4a64faef65612792f0d9a48dbe8d70c585c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Gregwar/Captcha/zipball/0185f4a64faef65612792f0d9a48dbe8d70c585c", + "reference": "0185f4a64faef65612792f0d9a48dbe8d70c585c", + "shasum": "" + }, + "require": { + "ext-gd": "*", + "ext-mbstring": "*", + "php": ">=5.3.0", + "symfony/finder": "~3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "time": "2017-12-01T13:59:36+00:00", + "type": "captcha", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Gregwar\\": "src/Gregwar" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Passault", + "email": "g.passault@gmail.com", + "homepage": "http://www.gregwar.com/" + }, + { + "name": "Jeremy Livingston", + "email": "jeremy.j.livingston@gmail.com" + } + ], + "description": "Captcha generator", + "homepage": "https://github.com/Gregwar/Captcha", + "keywords": [ + "bot", + "captcha", + "spam" + ] } ] diff --git a/vendor/gregwar/captcha/.gitignore b/vendor/gregwar/captcha/.gitignore index 5a275919..5b9939b3 100644 --- a/vendor/gregwar/captcha/.gitignore +++ b/vendor/gregwar/captcha/.gitignore @@ -1,3 +1,4 @@ demo/*.jpg demo/*.pgm demo/temp/ +vendor/ diff --git a/vendor/gregwar/captcha/.travis.yml b/vendor/gregwar/captcha/.travis.yml index 9c4b7049..5d2dbf97 100644 --- a/vendor/gregwar/captcha/.travis.yml +++ b/vendor/gregwar/captcha/.travis.yml @@ -6,6 +6,10 @@ php: - 5.4 - 5.5 - 5.6 + - 7.0 + - 7.1 + - 7.2 + - hhvm script: - composer install diff --git a/vendor/gregwar/captcha/CaptchaBuilder.php b/vendor/gregwar/captcha/CaptchaBuilder.php deleted file mode 100644 index bc6173fe..00000000 --- a/vendor/gregwar/captcha/CaptchaBuilder.php +++ /dev/null @@ -1,720 +0,0 @@ - - * @author Jeremy Livingston - */ -class CaptchaBuilder implements CaptchaBuilderInterface -{ - /** - * @var array - */ - protected $fingerprint = array(); - - /** - * @var bool - */ - protected $useFingerprint = false; - - /** - * @var array - */ - protected $textColor = null; - - /** - * @var array - */ - protected $backgroundColor = null; - - /** - * @var array - */ - protected $backgroundImages = array(); - - /** - * @var resource - */ - protected $contents = null; - - /** - * @var string - */ - protected $phrase = null; - - /** - * @var PhraseBuilderInterface - */ - protected $builder; - - /** - * @var bool - */ - protected $distortion = true; - - /** - * The maximum number of lines to draw in front of - * the image. null - use default algorithm - */ - protected $maxFrontLines = null; - - /** - * The maximum number of lines to draw behind - * the image. null - use default algorithm - */ - protected $maxBehindLines = null; - - /** - * The maximum angle of char - */ - protected $maxAngle = 8; - - /** - * The maximum offset of char - */ - protected $maxOffset = 5; - - /** - * Is the interpolation enabled ? - * - * @var bool - */ - protected $interpolation = true; - - /** - * Ignore all effects - * - * @var bool - */ - protected $ignoreAllEffects = false; - - /** - * Allowed image types for the background images - * - * @var array - */ - protected $allowedBackgroundImageTypes = array('image/png', 'image/jpeg', 'image/gif'); - - /** - * The image contents - */ - public function getContents() - { - return $this->contents; - } - - /** - * Enable/Disables the interpolation - * - * @param $interpolate bool True to enable, false to disable - * - * @return CaptchaBuilder - */ - public function setInterpolation($interpolate = true) - { - $this->interpolation = $interpolate; - - return $this; - } - - /** - * Temporary dir, for OCR check - */ - public $tempDir = 'temp/'; - - public function __construct($phrase = null, PhraseBuilderInterface $builder = null) - { - if ($builder === null) { - $this->builder = new PhraseBuilder; - } else { - $this->builder = $builder; - } - - if ($phrase === null) { - $phrase = $this->builder->build(); - } - - $this->phrase = $phrase; - } - - /** - * Setting the phrase - */ - public function setPhrase($phrase) - { - $this->phrase = (string) $phrase; - } - - /** - * Enables/disable distortion - */ - public function setDistortion($distortion) - { - $this->distortion = (bool) $distortion; - - return $this; - } - - public function setMaxBehindLines($maxBehindLines) - { - $this->maxBehindLines = $maxBehindLines; - - return $this; - } - - public function setMaxFrontLines($maxFrontLines) - { - $this->maxFrontLines = $maxFrontLines; - - return $this; - } - - public function setMaxAngle($maxAngle) - { - $this->maxAngle = $maxAngle; - - return $this; - } - - public function setMaxOffset($maxOffset) - { - $this->maxOffset = $maxOffset; - - return $this; - } - - /** - * Gets the captcha phrase - */ - public function getPhrase() - { - return $this->phrase; - } - - /** - * Returns true if the given phrase is good - */ - public function testPhrase($phrase) - { - return ($this->builder->niceize($phrase) == $this->builder->niceize($this->getPhrase())); - } - - /** - * Instantiation - */ - public static function create($phrase = null) - { - return new self($phrase); - } - - /** - * Sets the text color to use - */ - public function setTextColor($r, $g, $b) - { - $this->textColor = array($r, $g, $b); - - return $this; - } - - /** - * Sets the background color to use - */ - public function setBackgroundColor($r, $g, $b) - { - $this->backgroundColor = array($r, $g, $b); - - return $this; - } - - /** - * Sets the ignoreAllEffects value - * - * @param bool $ignoreAllEffects - * @return CaptchaBuilder - */ - public function setIgnoreAllEffects($ignoreAllEffects) - { - $this->ignoreAllEffects = $ignoreAllEffects; - - return $this; - } - - /** - * Sets the list of background images to use (one image is randomly selected) - */ - public function setBackgroundImages(array $backgroundImages) - { - $this->backgroundImages = $backgroundImages; - - return $this; - } - - /** - * Draw lines over the image - */ - protected function drawLine($image, $width, $height, $tcol = null) - { - if ($tcol === null) { - $tcol = imagecolorallocate($image, $this->rand(100, 255), $this->rand(100, 255), $this->rand(100, 255)); - } - - if ($this->rand(0, 1)) { // Horizontal - $Xa = $this->rand(0, $width/2); - $Ya = $this->rand(0, $height); - $Xb = $this->rand($width/2, $width); - $Yb = $this->rand(0, $height); - } else { // Vertical - $Xa = $this->rand(0, $width); - $Ya = $this->rand(0, $height/2); - $Xb = $this->rand(0, $width); - $Yb = $this->rand($height/2, $height); - } - imagesetthickness($image, $this->rand(1, 3)); - imageline($image, $Xa, $Ya, $Xb, $Yb, $tcol); - } - - /** - * Apply some post effects - */ - protected function postEffect($image) - { - if (!function_exists('imagefilter')) { - return; - } - - if ($this->backgroundColor != null || $this->textColor != null) { - return; - } - - // Negate ? - if ($this->rand(0, 1) == 0) { - imagefilter($image, IMG_FILTER_NEGATE); - } - - // Edge ? - if ($this->rand(0, 10) == 0) { - imagefilter($image, IMG_FILTER_EDGEDETECT); - } - - // Contrast - imagefilter($image, IMG_FILTER_CONTRAST, $this->rand(-50, 10)); - - // Colorize - if ($this->rand(0, 5) == 0) { - imagefilter($image, IMG_FILTER_COLORIZE, $this->rand(-80, 50), $this->rand(-80, 50), $this->rand(-80, 50)); - } - } - - /** - * Writes the phrase on the image - */ - protected function writePhrase($image, $phrase, $font, $width, $height) - { - $length = strlen($phrase); - if ($length === 0) { - return imagecolorallocate($image, 0, 0, 0); - } - - // Gets the text size and start position - $size = $width / $length - $this->rand(0, 3) - 1; - $box = imagettfbbox($size, 0, $font, $phrase); - $textWidth = $box[2] - $box[0]; - $textHeight = $box[1] - $box[7]; - $x = ($width - $textWidth) / 2; - $y = ($height - $textHeight) / 2 + $size; - - if (!count($this->textColor)) { - $textColor = array($this->rand(0, 150), $this->rand(0, 150), $this->rand(0, 150)); - } else { - $textColor = $this->textColor; - } - $col = imagecolorallocate($image, $textColor[0], $textColor[1], $textColor[2]); - - // Write the letters one by one, with random angle - for ($i=0; $i<$length; $i++) { - $box = imagettfbbox($size, 0, $font, $phrase[$i]); - $w = $box[2] - $box[0]; - $angle = $this->rand(-$this->maxAngle, $this->maxAngle); - $offset = $this->rand(-$this->maxOffset, $this->maxOffset); - imagettftext($image, $size, $angle, $x, $y + $offset, $col, $font, $phrase[$i]); - $x += $w; - } - - return $col; - } - - /** - * Try to read the code against an OCR - */ - public function isOCRReadable() - { - if (!is_dir($this->tempDir)) { - @mkdir($this->tempDir, 0755, true); - } - - $tempj = $this->tempDir . uniqid('captcha', true) . '.jpg'; - $tempp = $this->tempDir . uniqid('captcha', true) . '.pgm'; - - $this->save($tempj); - shell_exec("convert $tempj $tempp"); - $value = trim(strtolower(shell_exec("ocrad $tempp"))); - - @unlink($tempj); - @unlink($tempp); - - return $this->testPhrase($value); - } - - /** - * Builds while the code is readable against an OCR - */ - public function buildAgainstOCR($width = 150, $height = 40, $font = null, $fingerprint = null) - { - do { - $this->build($width, $height, $font, $fingerprint); - } while ($this->isOCRReadable()); - } - - /** - * Generate the image - */ - public function build($width = 150, $height = 40, $font = null, $fingerprint = null) - { - if (null !== $fingerprint) { - $this->fingerprint = $fingerprint; - $this->useFingerprint = true; - } else { - $this->fingerprint = array(); - $this->useFingerprint = false; - } - - if ($font === null) { - $font = __DIR__ . '/Font/captcha'.$this->rand(0, 5).'.ttf'; - } - - if (empty($this->backgroundImages)) { - // if background images list is not set, use a color fill as a background - $image = imagecreatetruecolor($width, $height); - if ($this->backgroundColor == null) { - $bg = imagecolorallocate($image, $this->rand(200, 255), $this->rand(200, 255), $this->rand(200, 255)); - } else { - $color = $this->backgroundColor; - $bg = imagecolorallocate($image, $color[0], $color[1], $color[2]); - } - $this->background = $bg; - imagefill($image, 0, 0, $bg); - } else { - // use a random background image - $randomBackgroundImage = $this->backgroundImages[rand(0, count($this->backgroundImages)-1)]; - - $imageType = $this->validateBackgroundImage($randomBackgroundImage); - - $image = $this->createBackgroundImageFromType($randomBackgroundImage, $imageType); - } - - // Apply effects - if (!$this->ignoreAllEffects) { - $square = $width * $height; - $effects = $this->rand($square/3000, $square/2000); - - // set the maximum number of lines to draw in front of the text - if ($this->maxBehindLines != null && $this->maxBehindLines > 0) { - $effects = min($this->maxBehindLines, $effects); - } - - if ($this->maxBehindLines !== 0) { - for ($e = 0; $e < $effects; $e++) { - $this->drawLine($image, $width, $height); - } - } - } - - // Write CAPTCHA text - $color = $this->writePhrase($image, $this->phrase, $font, $width, $height); - - // Apply effects - if (!$this->ignoreAllEffects) { - $square = $width * $height; - $effects = $this->rand($square/3000, $square/2000); - - // set the maximum number of lines to draw in front of the text - if ($this->maxFrontLines != null && $this->maxFrontLines > 0) { - $effects = min($this->maxFrontLines, $effects); - } - - if ($this->maxFrontLines !== 0) { - for ($e = 0; $e < $effects; $e++) { - $this->drawLine($image, $width, $height, $color); - } - } - } - - // Distort the image - if ($this->distortion && !$this->ignoreAllEffects) { - $image = $this->distort($image, $width, $height, $bg); - } - - // Post effects - if (!$this->ignoreAllEffects) { - $this->postEffect($image); - } - - $this->contents = $image; - - return $this; - } - - /** - * Distorts the image - */ - public function distort($image, $width, $height, $bg) - { - $contents = imagecreatetruecolor($width, $height); - $X = $this->rand(0, $width); - $Y = $this->rand(0, $height); - $phase = $this->rand(0, 10); - $scale = 1.1 + $this->rand(0, 10000) / 30000; - for ($x = 0; $x < $width; $x++) { - for ($y = 0; $y < $height; $y++) { - $Vx = $x - $X; - $Vy = $y - $Y; - $Vn = sqrt($Vx * $Vx + $Vy * $Vy); - - if ($Vn != 0) { - $Vn2 = $Vn + 4 * sin($Vn / 30); - $nX = $X + ($Vx * $Vn2 / $Vn); - $nY = $Y + ($Vy * $Vn2 / $Vn); - } else { - $nX = $X; - $nY = $Y; - } - $nY = $nY + $scale * sin($phase + $nX * 0.2); - - if ($this->interpolation) { - $p = $this->interpolate( - $nX - floor($nX), - $nY - floor($nY), - $this->getCol($image, floor($nX), floor($nY), $bg), - $this->getCol($image, ceil($nX), floor($nY), $bg), - $this->getCol($image, floor($nX), ceil($nY), $bg), - $this->getCol($image, ceil($nX), ceil($nY), $bg) - ); - } else { - $p = $this->getCol($image, round($nX), round($nY), $bg); - } - - if ($p == 0) { - $p = $bg; - } - - imagesetpixel($contents, $x, $y, $p); - } - } - - return $contents; - } - - /** - * Saves the Captcha to a jpeg file - */ - public function save($filename, $quality = 90) - { - imagejpeg($this->contents, $filename, $quality); - } - - /** - * Gets the image GD - */ - public function getGd() - { - return $this->contents; - } - - /** - * Gets the image contents - */ - public function get($quality = 90) - { - ob_start(); - $this->output($quality); - - return ob_get_clean(); - } - - /** - * Gets the HTML inline base64 - */ - public function inline($quality = 90) - { - return 'data:image/jpeg;base64,' . base64_encode($this->get($quality)); - } - - /** - * Outputs the image - */ - public function output($quality = 90) - { - imagejpeg($this->contents, null, $quality); - } - - /** - * @return array - */ - public function getFingerprint() - { - return $this->fingerprint; - } - - /** - * Returns a random number or the next number in the - * fingerprint - */ - protected function rand($min, $max) - { - if (!is_array($this->fingerprint)) { - $this->fingerprint = array(); - } - - if ($this->useFingerprint) { - $value = current($this->fingerprint); - next($this->fingerprint); - } else { - $value = mt_rand($min, $max); - $this->fingerprint[] = $value; - } - - return $value; - } - - /** - * @param $x - * @param $y - * @param $nw - * @param $ne - * @param $sw - * @param $se - * - * @return int - */ - protected function interpolate($x, $y, $nw, $ne, $sw, $se) - { - list($r0, $g0, $b0) = $this->getRGB($nw); - list($r1, $g1, $b1) = $this->getRGB($ne); - list($r2, $g2, $b2) = $this->getRGB($sw); - list($r3, $g3, $b3) = $this->getRGB($se); - - $cx = 1.0 - $x; - $cy = 1.0 - $y; - - $m0 = $cx * $r0 + $x * $r1; - $m1 = $cx * $r2 + $x * $r3; - $r = (int) ($cy * $m0 + $y * $m1); - - $m0 = $cx * $g0 + $x * $g1; - $m1 = $cx * $g2 + $x * $g3; - $g = (int) ($cy * $m0 + $y * $m1); - - $m0 = $cx * $b0 + $x * $b1; - $m1 = $cx * $b2 + $x * $b3; - $b = (int) ($cy * $m0 + $y * $m1); - - return ($r << 16) | ($g << 8) | $b; - } - - /** - * @param $image - * @param $x - * @param $y - * - * @return int - */ - protected function getCol($image, $x, $y, $background) - { - $L = imagesx($image); - $H = imagesy($image); - if ($x < 0 || $x >= $L || $y < 0 || $y >= $H) { - return $background; - } - - return imagecolorat($image, $x, $y); - } - - /** - * @param $col - * - * @return array - */ - protected function getRGB($col) - { - return array( - (int) ($col >> 16) & 0xff, - (int) ($col >> 8) & 0xff, - (int) ($col) & 0xff, - ); - } - - /** - * Validate the background image path. Return the image type if valid - * - * @param string $backgroundImage - * @return string - * @throws Exception - */ - protected function validateBackgroundImage($backgroundImage) - { - // check if file exists - if (!file_exists($backgroundImage)) { - $backgroundImageExploded = explode('/', $backgroundImage); - $imageFileName = count($backgroundImageExploded) > 1? $backgroundImageExploded[count($backgroundImageExploded)-1] : $backgroundImage; - - throw new Exception('Invalid background image: ' . $imageFileName); - } - - // check image type - $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension - $imageType = finfo_file($finfo, $backgroundImage); - finfo_close($finfo); - - if (!in_array ($imageType, $this->allowedBackgroundImageTypes)) { - throw new Exception('Invalid background image type! Allowed types are: ' . join(', ', $this->allowedBackgroundImageTypes)); - } - - return $imageType; - } - - /** - * Create background image from type - * - * @param string $backgroundImage - * @param string $imageType - * @return resource - * @throws Exception - */ - protected function createBackgroundImageFromType($backgroundImage, $imageType) - { - switch ($imageType) { - case 'image/jpeg': - $image = imagecreatefromjpeg($backgroundImage); - break; - case 'image/png': - $image = imagecreatefrompng($backgroundImage); - break; - case 'image/gif': - $image = imagecreatefromgif($backgroundImage); - break; - - default: - throw new Exception('Not supported file type for background image!'); - break; - } - - return $image; - } -} diff --git a/vendor/gregwar/captcha/CaptchaBuilderInterface.php b/vendor/gregwar/captcha/CaptchaBuilderInterface.php deleted file mode 100644 index bdebf38f..00000000 --- a/vendor/gregwar/captcha/CaptchaBuilderInterface.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @author Jeremy Livingston - */ -class ImageFileHandler -{ - /** - * Name of folder for captcha images - * @var string - */ - protected $imageFolder; - - /** - * Absolute path to public web folder - * @var string - */ - protected $webPath; - - /** - * Frequency of garbage collection in fractions of 1 - * @var int - */ - protected $gcFreq; - - /** - * Maximum age of images in minutes - * @var int - */ - protected $expiration; - - /** - * @param $imageFolder - * @param $webPath - * @param $gcFreq - * @param $expiration - */ - public function __construct($imageFolder, $webPath, $gcFreq, $expiration) - { - $this->imageFolder = $imageFolder; - $this->webPath = $webPath; - $this->gcFreq = $gcFreq; - $this->expiration = $expiration; - } - - /** - * Saves the provided image content as a file - * - * @param string $contents - * - * @return string - */ - public function saveAsFile($contents) - { - $this->createFolderIfMissing(); - - $filename = md5(uniqid()) . '.jpg'; - $filePath = $this->webPath . '/' . $this->imageFolder . '/' . $filename; - imagejpeg($contents, $filePath, 15); - - return '/' . $this->imageFolder . '/' . $filename; - } - - /** - * Randomly runs garbage collection on the image directory - * - * @return bool - */ - public function collectGarbage() - { - if (!mt_rand(1, $this->gcFreq) == 1) { - return false; - } - - $this->createFolderIfMissing(); - - $finder = new Finder(); - $criteria = sprintf('<= now - %s minutes', $this->expiration); - $finder->in($this->webPath . '/' . $this->imageFolder) - ->date($criteria); - - foreach($finder->files() as $file) { - unlink($file->getPathname()); - } - - return true; - } - - /** - * Creates the folder if it doesn't exist - */ - protected function createFolderIfMissing() - { - if (!file_exists($this->webPath . '/' . $this->imageFolder)) { - mkdir($this->webPath . '/' . $this->imageFolder, 0755); - } - } -} - diff --git a/vendor/gregwar/captcha/LICENSE b/vendor/gregwar/captcha/LICENSE index 7db6ad8e..62f991a6 100644 --- a/vendor/gregwar/captcha/LICENSE +++ b/vendor/gregwar/captcha/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) <2012-2015> Grégoire Passault +Copyright (c) <2012-2017> Grégoire Passault Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/gregwar/captcha/PhraseBuilder.php b/vendor/gregwar/captcha/PhraseBuilder.php deleted file mode 100644 index b94bd61c..00000000 --- a/vendor/gregwar/captcha/PhraseBuilder.php +++ /dev/null @@ -1,34 +0,0 @@ - - */ -class PhraseBuilder implements PhraseBuilderInterface -{ - /** - * Generates random phrase of given length with given charset - */ - public function build($length = 5, $charset = 'abcdefghijklmnpqrstuvwxyz123456789') - { - $phrase = ''; - $chars = str_split($charset); - - for ($i = 0; $i < $length; $i++) { - $phrase .= $chars[array_rand($chars)]; - } - - return $phrase; - } - - /** - * "Niceize" a code - */ - public function niceize($str) - { - return strtr(strtolower($str), '01', 'ol'); - } -} diff --git a/vendor/gregwar/captcha/PhraseBuilderInterface.php b/vendor/gregwar/captcha/PhraseBuilderInterface.php deleted file mode 100644 index 0a4f5361..00000000 --- a/vendor/gregwar/captcha/PhraseBuilderInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - - */ -interface PhraseBuilderInterface -{ - /** - * Generates random phrase of given length with given charset - */ - public function build($length, $charset); - - /** - * "Niceize" a code - */ - public function niceize($str); -} diff --git a/vendor/gregwar/captcha/README.md b/vendor/gregwar/captcha/README.md index 9f6c17a9..9f4d94b1 100644 --- a/vendor/gregwar/captcha/README.md +++ b/vendor/gregwar/captcha/README.md @@ -2,6 +2,7 @@ Captcha ======= ![Captchas examples](http://gregwar.com/captchas.png) +[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YUXRLWHQSWS6L) Installation ============ @@ -96,12 +97,43 @@ You can use theses functions : * **setMaxBehindLines($lines)**, sets the maximum number of lines behind the code * **setMaxFrontLines($lines)**, sets the maximum number of lines on the front of the code -Symfony 2 Bundle +If you want to change the number of character, you can call the phrase builder directly using +extra parameters: + +```php +use Gregwar\Captcha\CaptchaBuilder; +use Gregwar\Captcha\PhraseBuilder; + +// Will build phrases of 3 characters +$phraseBuilder = new PhraseBuilder(4) + +// Will build phrases of 5 characters, only digits +$phraseBuilder = new PhraseBuilder(5, '0123456789'); + +// Pass it as first argument of CaptchaBuilder, passing it the phrase +// builder +$captcha = new CaptchaBuilder(null, $phraseBuilder); +``` + +You can also pass directly the wanted phrase to the builder: + +```php +// Building a Captcha with the "hello" phrase +$captcha = new CaptchaBuilder('hello'); +``` + +Symfony Bundle ================ You can have a look at the following repository to enjoy the Symfony 2 bundle packaging this captcha generator : https://github.com/Gregwar/CaptchaBundle +Yii2 Extension +=============== + +You can use the following extension for integrating with Yii2 Framework : +https://github.com/juliardi/yii2-captcha + License ======= diff --git a/vendor/gregwar/captcha/autoload.php b/vendor/gregwar/captcha/autoload.php deleted file mode 100644 index 8b3fa392..00000000 --- a/vendor/gregwar/captcha/autoload.php +++ /dev/null @@ -1,16 +0,0 @@ -=5.3.0", - "ext-gd": "*" + "ext-gd": "*", + "ext-mbstring": "*", + "symfony/finder": "~3.0" }, "autoload": { "psr-4": { - "Gregwar\\Captcha\\": "/" + "Gregwar\\": "src/Gregwar" } + }, + "require-dev": { + "phpunit/phpunit": "^6.4" } } diff --git a/vendor/gregwar/captcha/demo/demo.php b/vendor/gregwar/captcha/demo/demo.php index 7852745f..87116cd7 100644 --- a/vendor/gregwar/captcha/demo/demo.php +++ b/vendor/gregwar/captcha/demo/demo.php @@ -1,9 +1,6 @@ + + + + + ./tests/ + + + + + + ./src + + + diff --git a/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php b/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php new file mode 100644 index 00000000..6db2f2c3 --- /dev/null +++ b/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php @@ -0,0 +1,721 @@ + + * @author Jeremy Livingston + */ +class CaptchaBuilder implements CaptchaBuilderInterface +{ + /** + * @var array + */ + protected $fingerprint = array(); + + /** + * @var bool + */ + protected $useFingerprint = false; + + /** + * @var array + */ + protected $textColor = null; + + /** + * @var array + */ + protected $backgroundColor = null; + + /** + * @var array + */ + protected $backgroundImages = array(); + + /** + * @var resource + */ + protected $contents = null; + + /** + * @var string + */ + protected $phrase = null; + + /** + * @var PhraseBuilderInterface + */ + protected $builder; + + /** + * @var bool + */ + protected $distortion = true; + + /** + * The maximum number of lines to draw in front of + * the image. null - use default algorithm + */ + protected $maxFrontLines = null; + + /** + * The maximum number of lines to draw behind + * the image. null - use default algorithm + */ + protected $maxBehindLines = null; + + /** + * The maximum angle of char + */ + protected $maxAngle = 8; + + /** + * The maximum offset of char + */ + protected $maxOffset = 5; + + /** + * Is the interpolation enabled ? + * + * @var bool + */ + protected $interpolation = true; + + /** + * Ignore all effects + * + * @var bool + */ + protected $ignoreAllEffects = false; + + /** + * Allowed image types for the background images + * + * @var array + */ + protected $allowedBackgroundImageTypes = array('image/png', 'image/jpeg', 'image/gif'); + + /** + * The image contents + */ + public function getContents() + { + return $this->contents; + } + + /** + * Enable/Disables the interpolation + * + * @param $interpolate bool True to enable, false to disable + * + * @return CaptchaBuilder + */ + public function setInterpolation($interpolate = true) + { + $this->interpolation = $interpolate; + + return $this; + } + + /** + * Temporary dir, for OCR check + */ + public $tempDir = 'temp/'; + + public function __construct($phrase = null, PhraseBuilderInterface $builder = null) + { + if ($builder === null) { + $this->builder = new PhraseBuilder; + } else { + $this->builder = $builder; + } + + if ($phrase === null) { + $phrase = $this->builder->build(); + } + + $this->phrase = $phrase; + } + + /** + * Setting the phrase + */ + public function setPhrase($phrase) + { + $this->phrase = (string) $phrase; + } + + /** + * Enables/disable distortion + */ + public function setDistortion($distortion) + { + $this->distortion = (bool) $distortion; + + return $this; + } + + public function setMaxBehindLines($maxBehindLines) + { + $this->maxBehindLines = $maxBehindLines; + + return $this; + } + + public function setMaxFrontLines($maxFrontLines) + { + $this->maxFrontLines = $maxFrontLines; + + return $this; + } + + public function setMaxAngle($maxAngle) + { + $this->maxAngle = $maxAngle; + + return $this; + } + + public function setMaxOffset($maxOffset) + { + $this->maxOffset = $maxOffset; + + return $this; + } + + /** + * Gets the captcha phrase + */ + public function getPhrase() + { + return $this->phrase; + } + + /** + * Returns true if the given phrase is good + */ + public function testPhrase($phrase) + { + return ($this->builder->niceize($phrase) == $this->builder->niceize($this->getPhrase())); + } + + /** + * Instantiation + */ + public static function create($phrase = null) + { + return new self($phrase); + } + + /** + * Sets the text color to use + */ + public function setTextColor($r, $g, $b) + { + $this->textColor = array($r, $g, $b); + + return $this; + } + + /** + * Sets the background color to use + */ + public function setBackgroundColor($r, $g, $b) + { + $this->backgroundColor = array($r, $g, $b); + + return $this; + } + + /** + * Sets the ignoreAllEffects value + * + * @param bool $ignoreAllEffects + * @return CaptchaBuilder + */ + public function setIgnoreAllEffects($ignoreAllEffects) + { + $this->ignoreAllEffects = $ignoreAllEffects; + + return $this; + } + + /** + * Sets the list of background images to use (one image is randomly selected) + */ + public function setBackgroundImages(array $backgroundImages) + { + $this->backgroundImages = $backgroundImages; + + return $this; + } + + /** + * Draw lines over the image + */ + protected function drawLine($image, $width, $height, $tcol = null) + { + if ($tcol === null) { + $tcol = imagecolorallocate($image, $this->rand(100, 255), $this->rand(100, 255), $this->rand(100, 255)); + } + + if ($this->rand(0, 1)) { // Horizontal + $Xa = $this->rand(0, $width/2); + $Ya = $this->rand(0, $height); + $Xb = $this->rand($width/2, $width); + $Yb = $this->rand(0, $height); + } else { // Vertical + $Xa = $this->rand(0, $width); + $Ya = $this->rand(0, $height/2); + $Xb = $this->rand(0, $width); + $Yb = $this->rand($height/2, $height); + } + imagesetthickness($image, $this->rand(1, 3)); + imageline($image, $Xa, $Ya, $Xb, $Yb, $tcol); + } + + /** + * Apply some post effects + */ + protected function postEffect($image) + { + if (!function_exists('imagefilter')) { + return; + } + + if ($this->backgroundColor != null || $this->textColor != null) { + return; + } + + // Negate ? + if ($this->rand(0, 1) == 0) { + imagefilter($image, IMG_FILTER_NEGATE); + } + + // Edge ? + if ($this->rand(0, 10) == 0) { + imagefilter($image, IMG_FILTER_EDGEDETECT); + } + + // Contrast + imagefilter($image, IMG_FILTER_CONTRAST, $this->rand(-50, 10)); + + // Colorize + if ($this->rand(0, 5) == 0) { + imagefilter($image, IMG_FILTER_COLORIZE, $this->rand(-80, 50), $this->rand(-80, 50), $this->rand(-80, 50)); + } + } + + /** + * Writes the phrase on the image + */ + protected function writePhrase($image, $phrase, $font, $width, $height) + { + $length = mb_strlen($phrase); + if ($length === 0) { + return \imagecolorallocate($image, 0, 0, 0); + } + + // Gets the text size and start position + $size = $width / $length - $this->rand(0, 3) - 1; + $box = \imagettfbbox($size, 0, $font, $phrase); + $textWidth = $box[2] - $box[0]; + $textHeight = $box[1] - $box[7]; + $x = ($width - $textWidth) / 2; + $y = ($height - $textHeight) / 2 + $size; + + if (!$this->textColor) { + $textColor = array($this->rand(0, 150), $this->rand(0, 150), $this->rand(0, 150)); + } else { + $textColor = $this->textColor; + } + $col = \imagecolorallocate($image, $textColor[0], $textColor[1], $textColor[2]); + + // Write the letters one by one, with random angle + for ($i=0; $i<$length; $i++) { + $symbol = mb_substr($phrase, $i, 1); + $box = \imagettfbbox($size, 0, $font, $symbol); + $w = $box[2] - $box[0]; + $angle = $this->rand(-$this->maxAngle, $this->maxAngle); + $offset = $this->rand(-$this->maxOffset, $this->maxOffset); + \imagettftext($image, $size, $angle, $x, $y + $offset, $col, $font, $symbol); + $x += $w; + } + + return $col; + } + + /** + * Try to read the code against an OCR + */ + public function isOCRReadable() + { + if (!is_dir($this->tempDir)) { + @mkdir($this->tempDir, 0755, true); + } + + $tempj = $this->tempDir . uniqid('captcha', true) . '.jpg'; + $tempp = $this->tempDir . uniqid('captcha', true) . '.pgm'; + + $this->save($tempj); + shell_exec("convert $tempj $tempp"); + $value = trim(strtolower(shell_exec("ocrad $tempp"))); + + @unlink($tempj); + @unlink($tempp); + + return $this->testPhrase($value); + } + + /** + * Builds while the code is readable against an OCR + */ + public function buildAgainstOCR($width = 150, $height = 40, $font = null, $fingerprint = null) + { + do { + $this->build($width, $height, $font, $fingerprint); + } while ($this->isOCRReadable()); + } + + /** + * Generate the image + */ + public function build($width = 150, $height = 40, $font = null, $fingerprint = null) + { + if (null !== $fingerprint) { + $this->fingerprint = $fingerprint; + $this->useFingerprint = true; + } else { + $this->fingerprint = array(); + $this->useFingerprint = false; + } + + if ($font === null) { + $font = __DIR__ . '/Font/captcha'.$this->rand(0, 5).'.ttf'; + } + + if (empty($this->backgroundImages)) { + // if background images list is not set, use a color fill as a background + $image = imagecreatetruecolor($width, $height); + if ($this->backgroundColor == null) { + $bg = imagecolorallocate($image, $this->rand(200, 255), $this->rand(200, 255), $this->rand(200, 255)); + } else { + $color = $this->backgroundColor; + $bg = imagecolorallocate($image, $color[0], $color[1], $color[2]); + } + $this->background = $bg; + imagefill($image, 0, 0, $bg); + } else { + // use a random background image + $randomBackgroundImage = $this->backgroundImages[rand(0, count($this->backgroundImages)-1)]; + + $imageType = $this->validateBackgroundImage($randomBackgroundImage); + + $image = $this->createBackgroundImageFromType($randomBackgroundImage, $imageType); + } + + // Apply effects + if (!$this->ignoreAllEffects) { + $square = $width * $height; + $effects = $this->rand($square/3000, $square/2000); + + // set the maximum number of lines to draw in front of the text + if ($this->maxBehindLines != null && $this->maxBehindLines > 0) { + $effects = min($this->maxBehindLines, $effects); + } + + if ($this->maxBehindLines !== 0) { + for ($e = 0; $e < $effects; $e++) { + $this->drawLine($image, $width, $height); + } + } + } + + // Write CAPTCHA text + $color = $this->writePhrase($image, $this->phrase, $font, $width, $height); + + // Apply effects + if (!$this->ignoreAllEffects) { + $square = $width * $height; + $effects = $this->rand($square/3000, $square/2000); + + // set the maximum number of lines to draw in front of the text + if ($this->maxFrontLines != null && $this->maxFrontLines > 0) { + $effects = min($this->maxFrontLines, $effects); + } + + if ($this->maxFrontLines !== 0) { + for ($e = 0; $e < $effects; $e++) { + $this->drawLine($image, $width, $height, $color); + } + } + } + + // Distort the image + if ($this->distortion && !$this->ignoreAllEffects) { + $image = $this->distort($image, $width, $height, $bg); + } + + // Post effects + if (!$this->ignoreAllEffects) { + $this->postEffect($image); + } + + $this->contents = $image; + + return $this; + } + + /** + * Distorts the image + */ + public function distort($image, $width, $height, $bg) + { + $contents = imagecreatetruecolor($width, $height); + $X = $this->rand(0, $width); + $Y = $this->rand(0, $height); + $phase = $this->rand(0, 10); + $scale = 1.1 + $this->rand(0, 10000) / 30000; + for ($x = 0; $x < $width; $x++) { + for ($y = 0; $y < $height; $y++) { + $Vx = $x - $X; + $Vy = $y - $Y; + $Vn = sqrt($Vx * $Vx + $Vy * $Vy); + + if ($Vn != 0) { + $Vn2 = $Vn + 4 * sin($Vn / 30); + $nX = $X + ($Vx * $Vn2 / $Vn); + $nY = $Y + ($Vy * $Vn2 / $Vn); + } else { + $nX = $X; + $nY = $Y; + } + $nY = $nY + $scale * sin($phase + $nX * 0.2); + + if ($this->interpolation) { + $p = $this->interpolate( + $nX - floor($nX), + $nY - floor($nY), + $this->getCol($image, floor($nX), floor($nY), $bg), + $this->getCol($image, ceil($nX), floor($nY), $bg), + $this->getCol($image, floor($nX), ceil($nY), $bg), + $this->getCol($image, ceil($nX), ceil($nY), $bg) + ); + } else { + $p = $this->getCol($image, round($nX), round($nY), $bg); + } + + if ($p == 0) { + $p = $bg; + } + + imagesetpixel($contents, $x, $y, $p); + } + } + + return $contents; + } + + /** + * Saves the Captcha to a jpeg file + */ + public function save($filename, $quality = 90) + { + imagejpeg($this->contents, $filename, $quality); + } + + /** + * Gets the image GD + */ + public function getGd() + { + return $this->contents; + } + + /** + * Gets the image contents + */ + public function get($quality = 90) + { + ob_start(); + $this->output($quality); + + return ob_get_clean(); + } + + /** + * Gets the HTML inline base64 + */ + public function inline($quality = 90) + { + return 'data:image/jpeg;base64,' . base64_encode($this->get($quality)); + } + + /** + * Outputs the image + */ + public function output($quality = 90) + { + imagejpeg($this->contents, null, $quality); + } + + /** + * @return array + */ + public function getFingerprint() + { + return $this->fingerprint; + } + + /** + * Returns a random number or the next number in the + * fingerprint + */ + protected function rand($min, $max) + { + if (!is_array($this->fingerprint)) { + $this->fingerprint = array(); + } + + if ($this->useFingerprint) { + $value = current($this->fingerprint); + next($this->fingerprint); + } else { + $value = mt_rand($min, $max); + $this->fingerprint[] = $value; + } + + return $value; + } + + /** + * @param $x + * @param $y + * @param $nw + * @param $ne + * @param $sw + * @param $se + * + * @return int + */ + protected function interpolate($x, $y, $nw, $ne, $sw, $se) + { + list($r0, $g0, $b0) = $this->getRGB($nw); + list($r1, $g1, $b1) = $this->getRGB($ne); + list($r2, $g2, $b2) = $this->getRGB($sw); + list($r3, $g3, $b3) = $this->getRGB($se); + + $cx = 1.0 - $x; + $cy = 1.0 - $y; + + $m0 = $cx * $r0 + $x * $r1; + $m1 = $cx * $r2 + $x * $r3; + $r = (int) ($cy * $m0 + $y * $m1); + + $m0 = $cx * $g0 + $x * $g1; + $m1 = $cx * $g2 + $x * $g3; + $g = (int) ($cy * $m0 + $y * $m1); + + $m0 = $cx * $b0 + $x * $b1; + $m1 = $cx * $b2 + $x * $b3; + $b = (int) ($cy * $m0 + $y * $m1); + + return ($r << 16) | ($g << 8) | $b; + } + + /** + * @param $image + * @param $x + * @param $y + * + * @return int + */ + protected function getCol($image, $x, $y, $background) + { + $L = imagesx($image); + $H = imagesy($image); + if ($x < 0 || $x >= $L || $y < 0 || $y >= $H) { + return $background; + } + + return imagecolorat($image, $x, $y); + } + + /** + * @param $col + * + * @return array + */ + protected function getRGB($col) + { + return array( + (int) ($col >> 16) & 0xff, + (int) ($col >> 8) & 0xff, + (int) ($col) & 0xff, + ); + } + + /** + * Validate the background image path. Return the image type if valid + * + * @param string $backgroundImage + * @return string + * @throws Exception + */ + protected function validateBackgroundImage($backgroundImage) + { + // check if file exists + if (!file_exists($backgroundImage)) { + $backgroundImageExploded = explode('/', $backgroundImage); + $imageFileName = count($backgroundImageExploded) > 1? $backgroundImageExploded[count($backgroundImageExploded)-1] : $backgroundImage; + + throw new Exception('Invalid background image: ' . $imageFileName); + } + + // check image type + $finfo = finfo_open(FILEINFO_MIME_TYPE); // return mime type ala mimetype extension + $imageType = finfo_file($finfo, $backgroundImage); + finfo_close($finfo); + + if (!in_array($imageType, $this->allowedBackgroundImageTypes)) { + throw new Exception('Invalid background image type! Allowed types are: ' . join(', ', $this->allowedBackgroundImageTypes)); + } + + return $imageType; + } + + /** + * Create background image from type + * + * @param string $backgroundImage + * @param string $imageType + * @return resource + * @throws Exception + */ + protected function createBackgroundImageFromType($backgroundImage, $imageType) + { + switch ($imageType) { + case 'image/jpeg': + $image = imagecreatefromjpeg($backgroundImage); + break; + case 'image/png': + $image = imagecreatefrompng($backgroundImage); + break; + case 'image/gif': + $image = imagecreatefromgif($backgroundImage); + break; + + default: + throw new Exception('Not supported file type for background image!'); + break; + } + + return $image; + } +} diff --git a/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php b/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php new file mode 100644 index 00000000..bebd0704 --- /dev/null +++ b/vendor/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilderInterface.php @@ -0,0 +1,29 @@ + + * @author Jeremy Livingston + */ +class ImageFileHandler +{ + /** + * Name of folder for captcha images + * @var string + */ + protected $imageFolder; + + /** + * Absolute path to public web folder + * @var string + */ + protected $webPath; + + /** + * Frequency of garbage collection in fractions of 1 + * @var int + */ + protected $gcFreq; + + /** + * Maximum age of images in minutes + * @var int + */ + protected $expiration; + + /** + * @param $imageFolder + * @param $webPath + * @param $gcFreq + * @param $expiration + */ + public function __construct($imageFolder, $webPath, $gcFreq, $expiration) + { + $this->imageFolder = $imageFolder; + $this->webPath = $webPath; + $this->gcFreq = $gcFreq; + $this->expiration = $expiration; + } + + /** + * Saves the provided image content as a file + * + * @param string $contents + * + * @return string + */ + public function saveAsFile($contents) + { + $this->createFolderIfMissing(); + + $filename = md5(uniqid()) . '.jpg'; + $filePath = $this->webPath . '/' . $this->imageFolder . '/' . $filename; + imagejpeg($contents, $filePath, 15); + + return '/' . $this->imageFolder . '/' . $filename; + } + + /** + * Randomly runs garbage collection on the image directory + * + * @return bool + */ + public function collectGarbage() + { + if (!mt_rand(1, $this->gcFreq) == 1) { + return false; + } + + $this->createFolderIfMissing(); + + $finder = new Finder(); + $criteria = sprintf('<= now - %s minutes', $this->expiration); + $finder->in($this->webPath . '/' . $this->imageFolder) + ->date($criteria); + + foreach ($finder->files() as $file) { + unlink($file->getPathname()); + } + + return true; + } + + /** + * Creates the folder if it doesn't exist + */ + protected function createFolderIfMissing() + { + if (!file_exists($this->webPath . '/' . $this->imageFolder)) { + mkdir($this->webPath . '/' . $this->imageFolder, 0755); + } + } +} diff --git a/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php b/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php new file mode 100644 index 00000000..5cc938b6 --- /dev/null +++ b/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php @@ -0,0 +1,59 @@ + + */ +class PhraseBuilder implements PhraseBuilderInterface +{ + /** + * @var int + */ + public $length; + + /** + * @var string + */ + public $charset; + /** + * Constructs a PhraseBuilder with given parameters + */ + public function __construct($length = 5, $charset = 'abcdefghijklmnpqrstuvwxyz123456789') + { + $this->length = $length; + $this->charset = $charset; + } + + /** + * Generates random phrase of given length with given charset + */ + public function build($length = null, $charset = null) + { + if ($length !== null) { + $this->length = $length; + } + if ($charset !== null) { + $this->charset = $charset; + } + + $phrase = ''; + $chars = str_split($this->charset); + + for ($i = 0; $i < $this->length; $i++) { + $phrase .= $chars[array_rand($chars)]; + } + + return $phrase; + } + + /** + * "Niceize" a code + */ + public function niceize($str) + { + return strtr(strtolower($str), '01', 'ol'); + } +} diff --git a/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php b/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php new file mode 100644 index 00000000..62ec4b08 --- /dev/null +++ b/vendor/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php @@ -0,0 +1,21 @@ + + */ +interface PhraseBuilderInterface +{ + /** + * Generates random phrase of given length with given charset + */ + public function build(); + + /** + * "Niceize" a code + */ + public function niceize($str); +} diff --git a/vendor/gregwar/captcha/tests/CaptchaBuilderTest.php b/vendor/gregwar/captcha/tests/CaptchaBuilderTest.php new file mode 100644 index 00000000..5325a9c1 --- /dev/null +++ b/vendor/gregwar/captcha/tests/CaptchaBuilderTest.php @@ -0,0 +1,30 @@ +build() + ->save('out.jpg') + ; + + $this->assertTrue(file_exists(__DIR__.'/../out.jpg')); + } + + public function testFingerPrint() + { + $int = count(CaptchaBuilder::create() + ->build() + ->getFingerprint() + ); + + $this->assertTrue(is_int($int)); + } +} \ No newline at end of file diff --git a/vendor/paragonie/random_compat/CHANGELOG.md b/vendor/paragonie/random_compat/CHANGELOG.md deleted file mode 100644 index 247deace..00000000 --- a/vendor/paragonie/random_compat/CHANGELOG.md +++ /dev/null @@ -1,260 +0,0 @@ -### Version 2.0.2 - 2016-04-03 - -Added a consistency check (discovered by Taylor Hornby in his -[PHP encryption library](https://github.com/defuse/php-encryption)). It -wasn't likely causing any trouble for us. - -### Version 2.0.1 - 2016-03-18 - -Update comment in random.php - -### Version 2.0.0 - 2016-03-18 - -Due to downstream errors, the OpenSSL removal now belongs in version -2.0.0. - -### Version 1.3.1 - 2016-03-18 - -* Add more possible values to `open_baseir` check. - -### Version 1.3.0 - 2016-03-17 - -* Removed `openssl_random_pseudo_bytes()` entirely. If you are using - random_compat in PHP on a Unix-like OS but cannot access - `/dev/urandom`, version 1.3+ will throw an `Exception`. If you want to - trust OpenSSL, feel free to write your own fallback code. e.g. - - ```php - try { - $bytes = random_bytes(32); - } catch (Exception $ex) { - $strong = false; - $bytes = openssl_random_pseudo_bytes(32, $strong); - if (!$strong) { - throw $ex; - } - } - ``` - -### Version 1.2.2 - 2016-03-11 - -* To prevent applications from hanging, if `/dev/urandom` is not - accessible to PHP, skip mcrypt (which just fails before giving OpenSSL - a chance and was morally equivalent to not offering OpenSSL at all). - -### Version 1.2.1 - 2016-02-29 - -* PHP 5.6.10 - 5.6.12 will hang when mcrypt is used on Unix-based operating - systems ([PHP bug 69833](https://bugs.php.net/bug.php?id=69833)). If you are - running one of these versions, please upgrade (or make sure `/dev/urandom` is - readable) otherwise you're relying on OpenSSL. - -### Version 1.2.0 - 2016-02-05 - -* Whitespace and other cosmetic changes -* Added a changelog. -* We now ship with a command line utility to build a PHP Archive from the - command line. - - Every time we publish a new release, we will also upload a .phar - to Github. Our public key is signed by our GPG key. - -### Version 1.1.6 - 2016-01-29 - -* Eliminate `open_basedir` warnings by detecting this configuration setting. - (Thanks [@oucil](https://github.com/oucil) for reporting this.) -* Added install instructions to the README. -* Documentation cleanup (there is, in fact, no `MCRYPT_CREATE_IV` constant, I - meant to write `MCRYPT_DEV_URANDOM`) - -### Version 1.1.5 - 2016-01-06 - -Prevent fatal errors on platforms with older versions of libsodium. - -### Version 1.1.4 - 2015-12-10 - -Thanks [@narfbg](https://github.com/narfbg) for [critiquing the previous patch](https://github.com/paragonie/random_compat/issues/79#issuecomment-163590589) -and suggesting a fix. - -### Version 1.1.3 - 2015-12-09 - -The test for COM in disabled_classes is now case-insensitive. - -### Version 1.1.2 - 2015-12-09 - -Don't instantiate COM if it's a disabled class. Removes the E_WARNING on Windows. - -### Version 1.1.1 - 2015-11-30 - -Fix a performance issue with `/dev/urandom` buffering. - -### Version 1.1.0 - 2015-11-09 - -Fix performance issues with ancient versions of PHP on Windows, but dropped -support for PHP < 5.4.1 without mcrypt on Windows 7+ in the process. Since this - is a BC break, semver dictates a minor version bump. - -### Version 1.0.10 - 2015-10-23 - -* Avoid a performance killer with OpenSSL on Windows PHP 5.3.0 - 5.3.3 that was - affecting [WordPress users](https://core.trac.wordpress.org/ticket/34409). -* Use `$var = null` instead of `unset($var)` to avoid triggering the garbage - collector and slowing things down. - -### Version 1.0.9 - 2015-10-20 - -There is an outstanding issue `mcrypt_create_iv()` and PHP 7's `random_bytes()` -on Windows reported by [@nicolas-grekas](https://github.com/nicolas-grekas) caused by `proc_open()` and environment -variable handling (discovered by Appveyor when developing Symfony). - -Since the break is consistent, it's not our responsibility to fix it, but we -should fail the same way PHP 7 will (i.e. throw an `Exception` rather than raise -an error and then throw an `Exception`). - -### Version 1.0.8 - 2015-10-18 - -* Fix usability issues with Windows (`new COM('CAPICOM.Utilities.1')` is not - always available). -* You can now test all the possible drivers by running `phpunit.sh each` in the - `tests` directory. - -### Version 1.0.7 - 2015-10-16 - -Several large integer handling bugfixes were contributed by [@oittaa](https://github.com/oittaa). - -### Version 1.0.6 - 2015-10-15 - -Don't let the version number fool you, this was a pretty significant change. - -1. Added support for ext-libsodium, if it exists on the system. This is morally - equivalent to adding `getrandom(2)` support without having to expose the - syscall interface in PHP-land. -2. Relaxed open_basedir restrictions. In previous versions, if open_basedir was - set, PHP wouldn't even try to read from `/dev/urandom`. Now it will still do - so if you can. -3. Fixed integer casting inconsistencies between random_compat and PHP 7. -4. Handle edge cases where an integer overflow turns one of the parameters into - a float. - -One change that we discussed was making `random_bytes()` and `random_int()` -strict typed; meaning you could *only* pass integers to either function. While -most veteran programmers are probably only doing this already (we strongly -encourage it), it wouldn't be consistent with how these functions behave in PHP -7. Please use these functions responsibly. - -We've had even more of the PHP community involved in this release; the -contributors list has been updated. If I forgot anybody, I promise you it's not -because your contributions (either code or ideas) aren't valued, it's because -I'm a bit overloaded with information at the moment. Please let me know -immediately and I will correct my oversight. - -Thanks everyone for helping make random_compat better. - -### Version 1.0.5 - 2015-10-08 - -Got rid of the methods in the `Throwable` interface, which was causing problems -on PHP 5.2. While we would normally not care about 5.2 (since [5.4 and earlier are EOL'd](https://secure.php.net/supported-versions.php)), -we do want to encourage widespread adoption (e.g. [Wordpress](https://core.trac.wordpress.org/ticket/28633)). - -### Version 1.0.4 - 2015-10-02 - -Removed redundant `if()` checks, since `lib/random.php` is the entrypoint people -should use. - -### Version 1.0.3 - 2015-10-02 - -This release contains bug fixes contributed by the community. - -* Avoid a PHP Notice when PHP is running without the mbstring extension -* Use a compatible version of PHPUnit for testing on older versions of PHP - -Although none of these bugs were outright security-affecting, updating ASAP is -still strongly encouraged. - -### Version 1.0.2 - 2015-09-23 - -Less strict input validation on `random_int()` parameters. PHP 7's `random_int()` -accepts strings and floats that look like numbers, so we should too. - -Thanks [@dd32](https://github.com/@dd32) for correcting this oversight. - -### Version 1.0.1 - 2015-09-10 - -Instead of throwing an Exception immediately on insecure platforms, only do so -when `random_bytes()` is invoked. - -### Version 1.0.0 - 2015-09-07 - -Our API is now stable and forward-compatible with the CSPRNG features in PHP 7 -(as of 7.0.0 RC3). - -A lot of great people have contributed their time and expertise to make this -compatibility library possible. That this library has reached a stable release -is more a reflection on the community than it is on PIE. - -We are confident that random_compat will serve as the simplest and most secure -CSPRNG interface available for PHP5 projects. - -### Version 0.9.7 (pre-release) - 2015-09-01 - -An attempt to achieve compatibility with Error/TypeError in the RFC. - -This should be identical to 1.0.0 sans any last-minute changes or performance enhancements. - -### Version 0.9.6 (pre-release) - 2015-08-06 - -* Split the implementations into their own file (for ease of auditing) -* Corrected the file type check after `/dev/urandom` has been opened (thanks - [@narfbg](https://github.com/narfbg) and [@jedisct1](https://github.com/jedisct1)) - -### Version 0.9.5 (pre-release) - 2015-07-31 - -* Validate that `/dev/urandom` is a character device - * Reported by [@lokdnet](https://twitter.com/lokdnet) - * Investigated by [@narfbg](https://github.com/narfbg) and [frymaster](http://stackoverflow.com/users/1226810/frymaster) on [StackOverflow](http://stackoverflow.com/q/31631066/2224584) -* Remove support for `/dev/arandom` which is an old OpenBSD feature, thanks [@jedisct1](https://github.com/jedisct1) -* Prevent race conditions on the `filetype()` check, thanks [@jedisct1](https://github.com/jedisct1) -* Buffer file reads to 8 bytes (performance optimization; PHP defaults to 8192 bytes) - -### Version 0.9.4 (pre-release) - 2015-07-27 - -* Add logic to verify that `/dev/arandom` and `/dev/urandom` are actually devices. -* Some clean-up in the comments - -### Version 0.9.3 (pre-release) - 2015-07-22 - -Unless the Exceptions change to PHP 7 fails, this should be the last pre-release -version. If need be, we'll make one more pre-release version with compatible -behavior. - -Changes since 0.9.2: - -* Prioritize `/dev/arandom` and `/dev/urandom` over mcrypt. -[@oittaa](https://github.com/oittaa) removed the -1 and +1 juggling on `$range` calculations for `random_int()` -* Whitespace and comment clean-up, plus better variable names -* Actually put a description in the composer.json file... - -### Version 0.9.2 (pre-release) - 2015-07-16 - -* Consolidated `$range > PHP_INT_MAX` logic with `$range <= PHP_INT_MAX` (thanks - [@oittaa](https://github.com/oittaa) and [@CodesInChaos](https://github.com/CodesInChaos)) -* `tests/phpunit.sh` now also runs the tests with `mbstring.func_overload` and - `open_basedir` -* Style consistency, whitespace cleanup, more meaningful variable names - -### Version 0.9.1 (pre-release) - 2015-07-09 - -* Return random values on integer ranges > `PHP_INT_MAX` (thanks [@CodesInChaos](https://github.com/CodesInChaos)) -* Determined CSPRNG preference: - 1. `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` - 2. `/dev/arandom` - 3. `/dev/urandom` - 4. `openssl_random_pseudo_bytes()` -* Optimized backend selection (thanks [@lt](https://github.com/lt)) -* Fix #3 (thanks [@scottchiefbaker](https://github.com/scottchiefbaker)) - -### Version 0.9.0 (pre-release) - 2015-07-07 - -This should be a sane polyfill for PHP 7's `random_bytes()` and `random_int()`. -We hesitate to call it production ready until it has received sufficient third -party review. \ No newline at end of file diff --git a/vendor/paragonie/random_compat/ERRATA.md b/vendor/paragonie/random_compat/ERRATA.md deleted file mode 100644 index 0561630d..00000000 --- a/vendor/paragonie/random_compat/ERRATA.md +++ /dev/null @@ -1,34 +0,0 @@ -## Errata (Design Decisions) - -### Reasoning Behind the Order of Preferred Random Data Sources - -The order is: - - 1. `libsodium if available` - 2. `fread() /dev/urandom if available` - 3. `mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM)` - 4. `COM('CAPICOM.Utilities.1')->GetRandom()` - -If libsodium is available, we get random data from it. This is the preferred -method on all OSes, but libsodium is not very widely installed, so other -fallbacks are available. - -Next, we read `/dev/urandom` (if it exists). This is the preferred file to read -for random data for cryptographic purposes for BSD and Linux. - -Despite [strongly urging people not to use mcrypt in their projects](https://paragonie.com/blog/2015/05/if-you-re-typing-word-mcrypt-into-your-code-you-re-doing-it-wrong), -because libmcrypt is abandonware and the API puts too much responsibility on the -implementor, we prioritize `mcrypt_create_iv()` with `MCRYPT_DEV_URANDOM` above -the remaining implementations. - -The reason is simple: `mcrypt_create_iv()` is part of PHP's `ext/mcrypt` code, -and is not part `libmcrypt`. It actually does the right thing: - - * On Unix-based operating systems, it reads from `/dev/urandom`, which unlike `/dev/random` - is the sane and correct thing to do. - * On Windows, it reads from `CryptGenRandom`, which is an exclusively Windows - way to get random bytes. - -If we're on Windows and don't have access to `mcrypt`, we use `CAPICOM.Utilities.1`. - -As of random_compat 1.3, we no longer fall through to OpenSSL. diff --git a/vendor/paragonie/random_compat/README.md b/vendor/paragonie/random_compat/README.md deleted file mode 100644 index 80560862..00000000 --- a/vendor/paragonie/random_compat/README.md +++ /dev/null @@ -1,176 +0,0 @@ -# random_compat - -[![Build Status](https://travis-ci.org/paragonie/random_compat.svg?branch=master)](https://travis-ci.org/paragonie/random_compat) -[![Scrutinizer](https://scrutinizer-ci.com/g/paragonie/random_compat/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/paragonie/random_compat) - -PHP 5.x polyfill for `random_bytes()` and `random_int()` created and maintained -by [Paragon Initiative Enterprises](https://paragonie.com). - -Although this library *should* function in earlier versions of PHP, we will only -consider issues relevant to [supported PHP versions](https://secure.php.net/supported-versions.php). -**If you are using an unsupported version of PHP, please upgrade as soon as possible.** - -## Important - -Although this library has been examined by some security experts in the PHP -community, there will always be a chance that we overlooked something. Please -ask your favorite trusted hackers to hammer it for implementation errors and -bugs before even thinking about deploying it in production. - -**Do not use the master branch, use a [stable release](https://github.com/paragonie/random_compat/releases/latest).** - -For the background of this library, please refer to our blog post on -[Generating Random Integers and Strings in PHP](https://paragonie.com/blog/2015/07/how-safely-generate-random-strings-and-integers-in-php). - -### Usability Notice - -If PHP cannot safely generate random data, this library will throw an `Exception`. -It will never fall back to insecure random data. If this keeps happening, upgrade -to a newer version of PHP immediately. - -## Installing - -**With [Composer](https://getcomposer.org):** - - composer require paragonie/random_compat - -**Signed PHP Archive:** - -As of version 1.2.0, we also ship an ECDSA-signed PHP Archive with each stable -release on Github. - -1. Download [the `.phar`, `.phar.pubkey`, and `.phar.pubkey.asc`](https://github.com/paragonie/random_compat/releases/latest) files. -2. (**Recommended** but not required) Verify the PGP signature of `.phar.pubkey` - (contained within the `.asc` file) using the [PGP public key for Paragon Initiative Enterprises](https://paragonie.com/static/gpg-public-key.txt). -3. Extract both `.phar` and `.phar.pubkey` files to the same directory. -4. `require_once "/path/to/random_compat.phar";` -5. When a new version is released, you only need to replace the `.phar` file; - the `.pubkey` will not change (unless our signing key is ever compromised). - -**Manual Installation:** - -1. Download [a stable release](https://github.com/paragonie/random_compat/releases/latest). -2. Extract the files into your project. -3. `require_once "/path/to/random_compat/lib/random.php";` - -## Usage - -This library exposes the [CSPRNG functions added in PHP 7](https://secure.php.net/manual/en/ref.csprng.php) -for use in PHP 5 projects. Their behavior should be identical. - -### Generate a string of random bytes - -```php -try { - $string = random_bytes(32); -} catch (TypeError $e) { - // Well, it's an integer, so this IS unexpected. - die("An unexpected error has occurred"); -} catch (Error $e) { - // This is also unexpected because 32 is a reasonable integer. - die("An unexpected error has occurred"); -} catch (Exception $e) { - // If you get this message, the CSPRNG failed hard. - die("Could not generate a random string. Is our OS secure?"); -} - -var_dump(bin2hex($string)); -// string(64) "5787c41ae124b3b9363b7825104f8bc8cf27c4c3036573e5f0d4a91ad2eeac6f" -``` - -### Generate a random integer between two given integers (inclusive) - -```php -try { - $int = random_int(0,255); - -} catch (TypeError $e) { - // Well, it's an integer, so this IS unexpected. - die("An unexpected error has occurred"); -} catch (Error $e) { - // This is also unexpected because 0 and 255 are both reasonable integers. - die("An unexpected error has occurred"); -} catch (Exception $e) { - // If you get this message, the CSPRNG failed hard. - die("Could not generate a random string. Is our OS secure?"); -} - -var_dump($int); -// int(47) -``` - -### Exception handling - -When handling exceptions and errors you must account for differences between -PHP 5 and PHP7. - -The differences: - -* Catching `Error` works, so long as it is caught before `Exception`. -* Catching `Exception` has different behavior, without previously catching `Error`. -* There is *no* portable way to catch all errors/exceptions. - -#### Our recommendation - -**Always** catch `Error` before `Exception`. - -#### Example - -```php -try { - return random_int(1, $userInput); -} catch (TypeError $e) { - // This is okay, so long as `Error` is caught before `Exception`. - throw new Exception('Please enter a number!'); -} catch (Error $e) { - // This is required, if you do not need to do anything just rethrow. - throw $e; -} catch (Exception $e) { - // This is optional and maybe omitted if you do not want to handle errors - // during generation. - throw new InternalServerErrorException( - 'Oops, our server is bust and cannot generate any random data.', - 500, - $e - ); -} -``` - -## Contributors - -This project would not be anywhere near as excellent as it is today if it -weren't for the contributions of the following individuals: - -* [@AndrewCarterUK (Andrew Carter)](https://github.com/AndrewCarterUK) -* [@asgrim (James Titcumb)](https://github.com/asgrim) -* [@bcremer (Benjamin Cremer)](https://github.com/bcremer) -* [@CodesInChaos (Christian Winnerlein)](https://github.com/CodesInChaos) -* [@chriscct7 (Chris Christoff)](https://github.com/chriscct7) -* [@cs278 (Chris Smith)](https://github.com/cs278) -* [@cweagans (Cameron Eagans)](https://github.com/cweagans) -* [@dd32 (Dion Hulse)](https://github.com/dd32) -* [@geggleto (Glenn Eggleton)](https://github.com/geggleto) -* [@ircmaxell (Anthony Ferrara)](https://github.com/ircmaxell) -* [@jedisct1 (Frank Denis)](https://github.com/jedisct1) -* [@juliangut (Julián Gutiérrez)](https://github.com/juliangut) -* [@kelunik (Niklas Keller)](https://github.com/kelunik) -* [@lt (Leigh)](https://github.com/lt) -* [@MasonM (Mason Malone)](https://github.com/MasonM) -* [@mmeyer2k (Michael M)](https://github.com/mmeyer2k) -* [@narfbg (Andrey Andreev)](https://github.com/narfbg) -* [@nicolas-grekas (Nicolas Grekas)](https://github.com/nicolas-grekas) -* [@oittaa](https://github.com/oittaa) -* [@oucil (Kevin Farley)](https://github.com/oucil) -* [@redragonx (Stephen Chavez)](https://github.com/redragonx) -* [@rchouinard (Ryan Chouinard)](https://github.com/rchouinard) -* [@SammyK (Sammy Kaye Powers)](https://github.com/SammyK) -* [@scottchiefbaker (Scott Baker)](https://github.com/scottchiefbaker) -* [@skyosev (Stoyan Kyosev)](https://github.com/skyosev) -* [@stof (Christophe Coevoet)](https://github.com/stof) -* [@teohhanhui (Teoh Han Hui)](https://github.com/teohhanhui) -* [@tom-- (Tom Worster)](https://github.com/tom--) -* [@tsyr2ko](https://github.com/tsyr2ko) -* [@trowski (Aaron Piotrowski)](https://github.com/trowski) -* [@twistor (Chris Lepannen)](https://github.com/twistor) -* [@voku (Lars Moelleken)](https://github.com/voku) -* [@xabbuh (Christian Flothmann)](https://github.com/xabbuh) diff --git a/vendor/paragonie/random_compat/SECURITY.md b/vendor/paragonie/random_compat/SECURITY.md deleted file mode 100644 index 8f731b38..00000000 --- a/vendor/paragonie/random_compat/SECURITY.md +++ /dev/null @@ -1,108 +0,0 @@ -# An Invitation to Security Researchers - -Every company says they take security "very seriously." Rather than bore anyone -with banal boilerplate, here are some quick answers followed by detailed -elaboration. If you have any questions about our policies, please email them to -`scott@paragonie.com`. - -## Quick Answers - -* There is no compulsion to disclose vulnerabilities privately, but we - appreciate a head's up. -* `security@paragonie.com` will get your reports to the right person. Our GPG - fingerprint, should you decide to encrypt your report, is - `7F52 D5C6 1D12 55C7 3136 2E82 6B97 A1C2 8264 04DA`. - -* **YES**, we will reward security researchers who disclose vulnerabilities in - our software. -* In most cases, **No Proof-of-Concept Required.** - -## How to Report a Security Bug to Paragon Initiative Enterprises - -### There is no compulsion to disclose privately. - -We believe vulnerability disclosure style is a personal choice and enjoy working -with a diverse community. We understand and appreciate the importance of Full -Disclosure in the history and practice of security research. - -We would *like* to know about high-severity bugs before they become public -knowledge, so we can fix them in a timely manner, but **we do not believe in -threatening researchers or trying to enforce vulnerability embargoes**. - -Ultimately, if you discover a security-affecting vulnerability, what you do with -it is your choice. We would like to work with people, and to celebrate and -reward their skill, experience, and dedication. We appreciate being informed of -our mistakes so we can learn from them and build a better product. Our goal is -to empower the community. - -### Where to Send Security Vulnerabilities - -Our security email address is `security@paragonie.com`. Also feel free to open a -new issue on Github if you want to disclose publicly. - -``` ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG - -mQENBFUgwRUBCADcIpqNwyYc5UmY/tpx1sF/rQ3knR1YNXYZThzFV+Gmqhp1fDH5 -qBs9foh1xwI6O7knWmQngnf/nBumI3x6xj7PuOdEZUh2FwCG/VWnglW8rKmoHzHA -ivjiu9SLnPIPAgHSHeh2XD7q3Ndm3nenbjAiRFNl2iXcwA2cTQp9Mmfw9vVcw0G0 -z1o0G3s8cC8ZS6flFySIervvfSRWj7A1acI5eE3+AH/qXJRdEJ+9J8OB65p1JMfk -6+fWgOB1XZxMpz70S0rW6IX38WDSRhEK2fXyZJAJjyt+YGuzjZySNSoQR/V6vNYn -syrNPCJ2i5CgZQxAkyBBcr7koV9RIhPRzct/ABEBAAG0IVNlY3VyaXR5IDxzZWN1 -cml0eUBwYXJhZ29uaWUuY29tPokBOQQTAQIAIwUCVSDBFQIbAwcLCQgHAwIBBhUI -AgkKCwQWAgMBAh4BAheAAAoJEGuXocKCZATat2YIAIoejNFEQ2c1iaOEtSuB7Pn/ -WLbsDsHNLDKOV+UnfaCjv/vL7D+5NMChFCi2frde/NQb2TsjqmIH+V+XbnJtlrXD -Vj7yvMVal+Jqjwj7v4eOEWcKVcFZk+9cfUgh7t92T2BMX58RpgZF0IQZ6Z1R3FfC -9Ub4X6ykW+te1q0/4CoRycniwmlQi6iGSr99LQ5pfJq2Qlmz/luTZ0UX0h575T7d -cp2T1sX/zFRk/fHeANWSksipdDBjAXR7NMnYZgw2HghEdFk/xRDY7K1NRWNZBf05 -WrMHmh6AIVJiWZvI175URxEe268hh+wThBhXQHMhFNJM1qPIuzb4WogxM3UUD7m5 -AQ0EVSDBFQEIALNkpzSuJsHAHh79sc0AYWztdUe2MzyofQbbOnOCpWZebYsC3EXU -335fIg59k0m6f+O7GmEZzzIv5v0i99GS1R8CJm6FvhGqtH8ZqmOGbc71WdJSiNVE -0kpQoJlVzRbig6ZyyjzrggbM1eh5OXOk5pw4+23FFEdw7JWU0HJS2o71r1hwp05Z -vy21kcUEobz/WWQQyGS0Neo7PJn+9KS6wOxXul/UE0jct/5f7KLMdWMJ1VgniQmm -hjvkHLPSICteqCI04RfcmMseW9gueHQXeUu1SNIvsWa2MhxjeBej3pDnrZWszKwy -gF45GO9/v4tkIXNMy5J1AtOyRgQ3IUMqp8EAEQEAAYkBHwQYAQIACQUCVSDBFQIb -DAAKCRBrl6HCgmQE2jnIB/4/xFz8InpM7eybnBOAir3uGcYfs3DOmaKn7qWVtGzv -rKpQPYnVtlU2i6Z5UO4c4jDLT/8Xm1UDz3Lxvqt4xCaDwJvBZexU5BMK8l5DvOzH -6o6P2L1UDu6BvmPXpVZz7/qUhOnyf8VQg/dAtYF4/ax19giNUpI5j5o5mX5w80Rx -qSXV9NdSL4fdjeG1g/xXv2luhoV53T1bsycI3wjk/x5tV+M2KVhZBvvuOm/zhJje -oLWp0saaESkGXIXqurj6gZoujJvSvzl0n9F9VwqMEizDUfrXgtD1siQGhP0sVC6q -ha+F/SAEJ0jEquM4TfKWWU2S5V5vgPPpIQSYRnhQW4b1 -=xJPW ------END PGP PUBLIC KEY BLOCK----- -``` - -### We Will Reward Security Researchers - -**This process has not been formalized; nor have dollar amounts been -discussed.** - -However, if you report a valid security-affecting bug, we will compensate you -for the time spent finding the vulnerability and reward you for being a good -neighbor. - -#### What does a "valid" bug mean? - -There are two sides to this: - -1. Some have spammed projects with invalid bug reports hoping to collect - bounties for pressing a button and running an automated analysis tool. This - is not cool. -2. There is a potential for the developers of a project to declare all security - bug reports as invalid to save money. - -Our team members have an established history of reporting vulnerabilities to -large open source projects. **We aren't in the business of ripping people off.** -When in doubt, our policy is to err on the side of generosity. - -### No Proof-of-Concept Required - -We might ask for one if we feel we do not understand some of the details -pertaining to a specific vulnerability. We certainly appreciate them if you -include them in your report, but we believe **the burden lies with the developer -to prove their software *is* secure** rather than with the researcher to prove -that it isn't. - -In our experience, most bugs are simpler to fix than they are to exploit. - diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json index d363f4c8..1c5978c6 100644 --- a/vendor/paragonie/random_compat/composer.json +++ b/vendor/paragonie/random_compat/composer.json @@ -1,35 +1,37 @@ { - "name": "paragonie/random_compat", - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "random", - "pseudorandom" - ], - "license": "MIT", - "type": "library", - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "support": { - "issues": "https://github.com/paragonie/random_compat/issues", - "email": "info@paragonie.com", - "source": "https://github.com/paragonie/random_compat" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "autoload": { - "files": ["lib/random.php"] + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "autoload": { + "files": [ + "lib/random.php" + ] + } } diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php index dec5d306..3de86b22 100644 --- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,7 @@ * SOFTWARE. */ -if (!function_exists('RandomCompat_strlen')) { +if (!is_callable('RandomCompat_strlen')) { if ( defined('MB_OVERLOAD_STRING') && ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING @@ -51,7 +51,7 @@ if (!function_exists('RandomCompat_strlen')) { ); } - return mb_strlen($binary_string, '8bit'); + return (int) mb_strlen($binary_string, '8bit'); } } else { @@ -73,12 +73,12 @@ if (!function_exists('RandomCompat_strlen')) { 'RandomCompat_strlen() expects a string' ); } - return strlen($binary_string); + return (int) strlen($binary_string); } } } -if (!function_exists('RandomCompat_substr')) { +if (!is_callable('RandomCompat_substr')) { if ( defined('MB_OVERLOAD_STRING') @@ -118,7 +118,7 @@ if (!function_exists('RandomCompat_substr')) { * mb_substr($str, 0, NULL, '8bit') returns an empty string on * PHP 5.3, so we have to find the length ourselves. */ - $length = RandomCompat_strlen($length) - $start; + $length = RandomCompat_strlen($binary_string) - $start; } elseif (!is_int($length)) { throw new TypeError( 'RandomCompat_substr(): Third argument should be an integer, or omitted' @@ -130,10 +130,10 @@ if (!function_exists('RandomCompat_substr')) { return ''; } if ($start > RandomCompat_strlen($binary_string)) { - return false; + return ''; } - return mb_substr($binary_string, $start, $length, '8bit'); + return (string) mb_substr($binary_string, $start, $length, '8bit'); } } else { @@ -172,10 +172,10 @@ if (!function_exists('RandomCompat_substr')) { ); } - return substr($binary_string, $start, $length); + return (string) substr($binary_string, $start, $length); } - return substr($binary_string, $start); + return (string) substr($binary_string, $start); } } } diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index f441c5d9..9a4fab99 100644 --- a/vendor/paragonie/random_compat/lib/cast_to_int.php +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,7 @@ * SOFTWARE. */ -if (!function_exists('RandomCompat_intval')) { +if (!is_callable('RandomCompat_intval')) { /** * Cast to an integer if we can, safely. @@ -38,15 +38,18 @@ if (!function_exists('RandomCompat_intval')) { * through. * * @param int|float $number The number we want to convert to an int - * @param boolean $fail_open Set to true to not throw an exception + * @param bool $fail_open Set to true to not throw an exception * - * @return int (or float if $fail_open) + * @return float|int + * @psalm-suppress InvalidReturnType * * @throws TypeError */ function RandomCompat_intval($number, $fail_open = false) { - if (is_numeric($number)) { + if (is_int($number) || is_float($number)) { + $number += 0; + } elseif (is_numeric($number)) { $number += 0; } @@ -60,12 +63,13 @@ if (!function_exists('RandomCompat_intval')) { $number = (int) $number; } - if (is_int($number) || $fail_open) { - return $number; + if (is_int($number)) { + return (int) $number; + } elseif (!$fail_open) { + throw new TypeError( + 'Expected an integer.' + ); } - - throw new TypeError( - 'Expected an integer.' - ); + return $number; } } diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php index 57cfefdc..6a91990c 100644 --- a/vendor/paragonie/random_compat/lib/error_polyfill.php +++ b/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -4,8 +4,8 @@ * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) - * - * Copyright (c) 2015 Paragon Initiative Enterprises + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -35,8 +35,15 @@ if (!class_exists('Error', false)) { } if (!class_exists('TypeError', false)) { - class TypeError extends Error - { - + if (is_subclass_of('Error', 'Exception')) { + class TypeError extends Error + { + + } + } else { + class TypeError extends Exception + { + + } } } diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php index a8802597..df74c8a4 100644 --- a/vendor/paragonie/random_compat/lib/random.php +++ b/vendor/paragonie/random_compat/lib/random.php @@ -3,12 +3,12 @@ * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * - * @version 2.0.2 - * @released 2016-04-03 + * @version 2.0.10 + * @released 2017-03-13 * * The MIT License (MIT) * - * Copyright (c) 2015 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -31,7 +31,7 @@ if (!defined('PHP_VERSION_ID')) { // This constant was introduced in PHP 5.2.7 - $RandomCompatversion = explode('.', PHP_VERSION); + $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); define( 'PHP_VERSION_ID', $RandomCompatversion[0] * 10000 @@ -41,157 +41,183 @@ if (!defined('PHP_VERSION_ID')) { $RandomCompatversion = null; } -if (PHP_VERSION_ID < 70000) { - - if (!defined('RANDOM_COMPAT_READ_BUFFER')) { - define('RANDOM_COMPAT_READ_BUFFER', 8); - } - - $RandomCompatDIR = dirname(__FILE__); +/** + * PHP 7.0.0 and newer have these functions natively. + */ +if (PHP_VERSION_ID >= 70000) { + return; +} - require_once $RandomCompatDIR.'/byte_safe_strings.php'; - require_once $RandomCompatDIR.'/cast_to_int.php'; - require_once $RandomCompatDIR.'/error_polyfill.php'; +if (!defined('RANDOM_COMPAT_READ_BUFFER')) { + define('RANDOM_COMPAT_READ_BUFFER', 8); +} - if (!function_exists('random_bytes')) { - /** - * PHP 5.2.0 - 5.6.x way to implement random_bytes() - * - * We use conditional statements here to define the function in accordance - * to the operating environment. It's a micro-optimization. - * - * In order of preference: - * 1. Use libsodium if available. - * 2. fread() /dev/urandom if available (never on Windows) - * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) - * 4. COM('CAPICOM.Utilities.1')->GetRandom() - * 5. openssl_random_pseudo_bytes() (absolute last resort) - * - * See ERRATA.md for our reasoning behind this particular order - */ - if (extension_loaded('libsodium')) { - // See random_bytes_libsodium.php - if (PHP_VERSION_ID >= 50300 && function_exists('\\Sodium\\randombytes_buf')) { - require_once $RandomCompatDIR.'/random_bytes_libsodium.php'; - } elseif (method_exists('Sodium', 'randombytes_buf')) { - require_once $RandomCompatDIR.'/random_bytes_libsodium_legacy.php'; - } +$RandomCompatDIR = dirname(__FILE__); + +require_once $RandomCompatDIR . '/byte_safe_strings.php'; +require_once $RandomCompatDIR . '/cast_to_int.php'; +require_once $RandomCompatDIR . '/error_polyfill.php'; + +if (!is_callable('random_bytes')) { + /** + * PHP 5.2.0 - 5.6.x way to implement random_bytes() + * + * We use conditional statements here to define the function in accordance + * to the operating environment. It's a micro-optimization. + * + * In order of preference: + * 1. Use libsodium if available. + * 2. fread() /dev/urandom if available (never on Windows) + * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) + * 4. COM('CAPICOM.Utilities.1')->GetRandom() + * + * See RATIONALE.md for our reasoning behind this particular order + */ + if (extension_loaded('libsodium')) { + // See random_bytes_libsodium.php + if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; + } elseif (method_exists('Sodium', 'randombytes_buf')) { + require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; } + } - /** - * Reading directly from /dev/urandom: - */ - if (DIRECTORY_SEPARATOR === '/') { - // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast - // way to exclude Windows. - $RandomCompatUrandom = true; - $RandomCompat_basedir = ini_get('open_basedir'); - - if (!empty($RandomCompat_basedir)) { - $RandomCompat_open_basedir = explode( - PATH_SEPARATOR, - strtolower($RandomCompat_basedir) - ); - $RandomCompatUrandom = (array() !== array_intersect( - array('/dev', '/dev/', '/dev/urandom'), - $RandomCompat_open_basedir - )); - $RandomCompat_open_basedir = null; - } - - if ( - !function_exists('random_bytes') - && - $RandomCompatUrandom - && - @is_readable('/dev/urandom') - ) { - // Error suppression on is_readable() in case of an open_basedir - // or safe_mode failure. All we care about is whether or not we - // can read it at this point. If the PHP environment is going to - // panic over trying to see if the file can be read in the first - // place, that is not helpful to us here. - - // See random_bytes_dev_urandom.php - require_once $RandomCompatDIR.'/random_bytes_dev_urandom.php'; - } - // Unset variables after use - $RandomCompat_basedir = null; - } else { - $RandomCompatUrandom = false; + /** + * Reading directly from /dev/urandom: + */ + if (DIRECTORY_SEPARATOR === '/') { + // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast + // way to exclude Windows. + $RandomCompatUrandom = true; + $RandomCompat_basedir = ini_get('open_basedir'); + + if (!empty($RandomCompat_basedir)) { + $RandomCompat_open_basedir = explode( + PATH_SEPARATOR, + strtolower($RandomCompat_basedir) + ); + $RandomCompatUrandom = (array() !== array_intersect( + array('/dev', '/dev/', '/dev/urandom'), + $RandomCompat_open_basedir + )); + $RandomCompat_open_basedir = null; } - /** - * mcrypt_create_iv() - */ if ( - !function_exists('random_bytes') - && - PHP_VERSION_ID >= 50307 + !is_callable('random_bytes') && - extension_loaded('mcrypt') + $RandomCompatUrandom && - (DIRECTORY_SEPARATOR !== '/' || $RandomCompatUrandom) + @is_readable('/dev/urandom') ) { - // Prevent this code from hanging indefinitely on non-Windows; - // see https://bugs.php.net/bug.php?id=69833 - if ( - DIRECTORY_SEPARATOR !== '/' || - (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) - ) { - // See random_bytes_mcrypt.php - require_once $RandomCompatDIR.'/random_bytes_mcrypt.php'; - } + // Error suppression on is_readable() in case of an open_basedir + // or safe_mode failure. All we care about is whether or not we + // can read it at this point. If the PHP environment is going to + // panic over trying to see if the file can be read in the first + // place, that is not helpful to us here. + + // See random_bytes_dev_urandom.php + require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; } - $RandomCompatUrandom = null; - - if ( - !function_exists('random_bytes') - && - extension_loaded('com_dotnet') - && - class_exists('COM') - ) { - $RandomCompat_disabled_classes = preg_split( - '#\s*,\s*#', - strtolower(ini_get('disable_classes')) - ); + // Unset variables after use + $RandomCompat_basedir = null; + } else { + $RandomCompatUrandom = false; + } - if (!in_array('com', $RandomCompat_disabled_classes)) { - try { - $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); - if (method_exists($RandomCompatCOMtest, 'GetRandom')) { - // See random_bytes_com_dotnet.php - require_once $RandomCompatDIR.'/random_bytes_com_dotnet.php'; - } - } catch (com_exception $e) { - // Don't try to use it. + /** + * mcrypt_create_iv() + * + * We only want to use mcypt_create_iv() if: + * + * - random_bytes() hasn't already been defined + * - the mcrypt extensions is loaded + * - One of these two conditions is true: + * - We're on Windows (DIRECTORY_SEPARATOR !== '/') + * - We're not on Windows and /dev/urandom is readabale + * (i.e. we're not in a chroot jail) + * - Special case: + * - If we're not on Windows, but the PHP version is between + * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will + * hang indefinitely. This is bad. + * - If we're on Windows, we want to use PHP >= 5.3.7 or else + * we get insufficient entropy errors. + */ + if ( + !is_callable('random_bytes') + && + // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. + (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) + && + // Prevent this code from hanging indefinitely on non-Windows; + // see https://bugs.php.net/bug.php?id=69833 + ( + DIRECTORY_SEPARATOR !== '/' || + (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) + ) + && + extension_loaded('mcrypt') + ) { + // See random_bytes_mcrypt.php + require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; + } + $RandomCompatUrandom = null; + + /** + * This is a Windows-specific fallback, for when the mcrypt extension + * isn't loaded. + */ + if ( + !is_callable('random_bytes') + && + extension_loaded('com_dotnet') + && + class_exists('COM') + ) { + $RandomCompat_disabled_classes = preg_split( + '#\s*,\s*#', + strtolower(ini_get('disable_classes')) + ); + + if (!in_array('com', $RandomCompat_disabled_classes)) { + try { + $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); + if (method_exists($RandomCompatCOMtest, 'GetRandom')) { + // See random_bytes_com_dotnet.php + require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; } + } catch (com_exception $e) { + // Don't try to use it. } - $RandomCompat_disabled_classes = null; - $RandomCompatCOMtest = null; } + $RandomCompat_disabled_classes = null; + $RandomCompatCOMtest = null; + } + /** + * throw new Exception + */ + if (!is_callable('random_bytes')) { /** - * throw new Exception + * We don't have any more options, so let's throw an exception right now + * and hope the developer won't let it fail silently. + * + * @param mixed $length + * @return void + * @throws Exception */ - if (!function_exists('random_bytes')) { - /** - * We don't have any more options, so let's throw an exception right now - * and hope the developer won't let it fail silently. - */ - function random_bytes($length) - { - throw new Exception( - 'There is no suitable CSPRNG installed on your system' - ); - } + function random_bytes($length) + { + unset($length); // Suppress "variable not used" warnings. + throw new Exception( + 'There is no suitable CSPRNG installed on your system' + ); } } +} - if (!function_exists('random_int')) { - require_once $RandomCompatDIR.'/random_int.php'; - } - - $RandomCompatDIR = null; +if (!is_callable('random_int')) { + require_once $RandomCompatDIR . '/random_int.php'; } + +$RandomCompatDIR = null; diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php index 34228254..fc1926e5 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,56 +26,63 @@ * SOFTWARE. */ -/** - * Windows with PHP < 5.3.0 will not have the function - * openssl_random_pseudo_bytes() available, so let's use - * CAPICOM to work around this deficiency. - * - * @param int $bytes - * - * @throws Exception - * - * @return string - */ -function random_bytes($bytes) -{ - try { - $bytes = RandomCompat_intval($bytes); - } catch (TypeError $ex) { - throw new TypeError( - 'random_bytes(): $bytes must be an integer' - ); - } - - if ($bytes < 1) { - throw new Error( - 'Length must be greater than 0' - ); - } - - $buf = ''; - $util = new COM('CAPICOM.Utilities.1'); - $execCount = 0; - +if (!is_callable('random_bytes')) { /** - * Let's not let it loop forever. If we run N times and fail to - * get N bytes of random data, then CAPICOM has failed us. + * Windows with PHP < 5.3.0 will not have the function + * openssl_random_pseudo_bytes() available, so let's use + * CAPICOM to work around this deficiency. + * + * @param int $bytes + * + * @throws Exception + * + * @return string */ - do { - $buf .= base64_decode($util->GetRandom($bytes, 0)); - if (RandomCompat_strlen($buf) >= $bytes) { - /** - * Return our random entropy buffer here: - */ - return RandomCompat_substr($buf, 0, $bytes); + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); } - ++$execCount; - } while ($execCount < $bytes); - /** - * If we reach here, PHP has failed us. - */ - throw new Exception( - 'Could not gather sufficient random data' - ); -} + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + $buf = ''; + if (!class_exists('COM')) { + throw new Error( + 'COM does not exist' + ); + } + $util = new COM('CAPICOM.Utilities.1'); + $execCount = 0; + + /** + * Let's not let it loop forever. If we run N times and fail to + * get N bytes of random data, then CAPICOM has failed us. + */ + do { + $buf .= base64_decode($util->GetRandom($bytes, 0)); + if (RandomCompat_strlen($buf) >= $bytes) { + /** + * Return our random entropy buffer here: + */ + return RandomCompat_substr($buf, 0, $bytes); + } + ++$execCount; + } while ($execCount < $bytes); + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } +} \ No newline at end of file diff --git a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php index db93b075..df5b9152 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php @@ -4,8 +4,8 @@ * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) - * - * Copyright (c) 2015 Paragon Initiative Enterprises + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,119 +30,138 @@ if (!defined('RANDOM_COMPAT_READ_BUFFER')) { define('RANDOM_COMPAT_READ_BUFFER', 8); } -/** - * Unless open_basedir is enabled, use /dev/urandom for - * random numbers in accordance with best practices - * - * Why we use /dev/urandom and not /dev/random - * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers - * - * @param int $bytes - * - * @throws Exception - * - * @return string - */ -function random_bytes($bytes) -{ - static $fp = null; +if (!is_callable('random_bytes')) { /** - * This block should only be run once + * Unless open_basedir is enabled, use /dev/urandom for + * random numbers in accordance with best practices + * + * Why we use /dev/urandom and not /dev/random + * @ref http://sockpuppet.org/blog/2014/02/25/safely-generate-random-numbers + * + * @param int $bytes + * + * @throws Exception + * + * @return string */ - if (empty($fp)) { + function random_bytes($bytes) + { + static $fp = null; /** - * We use /dev/urandom if it is a char device. - * We never fall back to /dev/random + * This block should only be run once */ - $fp = fopen('/dev/urandom', 'rb'); - if (!empty($fp)) { - $st = fstat($fp); - if (($st['mode'] & 0170000) !== 020000) { - fclose($fp); - $fp = false; - } - } - - if (!empty($fp)) { + if (empty($fp)) { /** - * stream_set_read_buffer() does not exist in HHVM - * - * If we don't set the stream's read buffer to 0, PHP will - * internally buffer 8192 bytes, which can waste entropy - * - * stream_set_read_buffer returns 0 on success + * We use /dev/urandom if it is a char device. + * We never fall back to /dev/random */ - if (function_exists('stream_set_read_buffer')) { - stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); + $fp = fopen('/dev/urandom', 'rb'); + if (!empty($fp)) { + $st = fstat($fp); + if (($st['mode'] & 0170000) !== 020000) { + fclose($fp); + $fp = false; + } } - if (function_exists('stream_set_chunk_size')) { - stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); + + if (!empty($fp)) { + /** + * stream_set_read_buffer() does not exist in HHVM + * + * If we don't set the stream's read buffer to 0, PHP will + * internally buffer 8192 bytes, which can waste entropy + * + * stream_set_read_buffer returns 0 on success + */ + if (is_callable('stream_set_read_buffer')) { + stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER); + } + if (is_callable('stream_set_chunk_size')) { + stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER); + } } } - } - try { - $bytes = RandomCompat_intval($bytes); - } catch (TypeError $ex) { - throw new TypeError( - 'random_bytes(): $bytes must be an integer' - ); - } - - if ($bytes < 1) { - throw new Error( - 'Length must be greater than 0' - ); - } + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } - /** - * This if() block only runs if we managed to open a file handle - * - * It does not belong in an else {} block, because the above - * if (empty($fp)) line is logic that should only be run once per - * page load. - */ - if (!empty($fp)) { - $remaining = $bytes; - $buf = ''; + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } /** - * We use fread() in a loop to protect against partial reads + * This if() block only runs if we managed to open a file handle + * + * It does not belong in an else {} block, because the above + * if (empty($fp)) line is logic that should only be run once per + * page load. */ - do { - $read = fread($fp, $remaining); - if ($read === false) { - /** - * We cannot safely read from the file. Exit the - * do-while loop and trigger the exception condition - */ - $buf = false; - break; - } + if (!empty($fp)) { /** - * Decrease the number of bytes returned from remaining + * @var int */ - $remaining -= RandomCompat_strlen($read); - $buf .= $read; - } while ($remaining > 0); - - /** - * Is our result valid? - */ - if ($buf !== false) { - if (RandomCompat_strlen($buf) === $bytes) { + $remaining = $bytes; + + /** + * @var string|bool + */ + $buf = ''; + + /** + * We use fread() in a loop to protect against partial reads + */ + do { + /** + * @var string|bool + */ + $read = fread($fp, $remaining); + if (!is_string($read)) { + if ($read === false) { + /** + * We cannot safely read from the file. Exit the + * do-while loop and trigger the exception condition + * + * @var string|bool + */ + $buf = false; + break; + } + } /** - * Return our random entropy buffer here: + * Decrease the number of bytes returned from remaining */ - return $buf; + $remaining -= RandomCompat_strlen($read); + /** + * @var string|bool + */ + $buf = $buf . $read; + } while ($remaining > 0); + + /** + * Is our result valid? + */ + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { + /** + * Return our random entropy buffer here: + */ + return $buf; + } } } - } - /** - * If we reach here, PHP has failed us. - */ - throw new Exception( - 'Error reading from source device' - ); + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Error reading from source device' + ); + } } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php index f802d4e1..4af1a242 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -4,8 +4,8 @@ * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) - * - * Copyright (c) 2015 Paragon Initiative Enterprises + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,61 +26,63 @@ * SOFTWARE. */ -/** - * If the libsodium PHP extension is loaded, we'll use it above any other - * solution. - * - * libsodium-php project: - * @ref https://github.com/jedisct1/libsodium-php - * - * @param int $bytes - * - * @throws Exception - * - * @return string - */ -function random_bytes($bytes) -{ - try { - $bytes = RandomCompat_intval($bytes); - } catch (TypeError $ex) { - throw new TypeError( - 'random_bytes(): $bytes must be an integer' - ); - } - - if ($bytes < 1) { - throw new Error( - 'Length must be greater than 0' - ); - } - +if (!is_callable('random_bytes')) { /** - * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be - * generated in one invocation. + * If the libsodium PHP extension is loaded, we'll use it above any other + * solution. + * + * libsodium-php project: + * @ref https://github.com/jedisct1/libsodium-php + * + * @param int $bytes + * + * @throws Exception + * + * @return string */ - if ($bytes > 2147483647) { - $buf = ''; - for ($i = 0; $i < $bytes; $i += 1073741824) { - $n = ($bytes - $i) > 1073741824 - ? 1073741824 - : $bytes - $i; - $buf .= \Sodium\randombytes_buf($n); + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); } - } else { - $buf = \Sodium\randombytes_buf($bytes); - } - if ($buf !== false) { - if (RandomCompat_strlen($buf) === $bytes) { - return $buf; + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); } - } - /** - * If we reach here, PHP has failed us. - */ - throw new Exception( - 'Could not gather sufficient random data' - ); + /** + * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be + * generated in one invocation. + */ + if ($bytes > 2147483647) { + $buf = ''; + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= \Sodium\randombytes_buf($n); + } + } else { + $buf = \Sodium\randombytes_buf($bytes); + } + + if ($buf !== false) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } + } + + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php index 44fddbf6..705af526 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -4,8 +4,8 @@ * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) - * - * Copyright (c) 2015 Paragon Initiative Enterprises + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,61 +26,67 @@ * SOFTWARE. */ -/** - * If the libsodium PHP extension is loaded, we'll use it above any other - * solution. - * - * libsodium-php project: - * @ref https://github.com/jedisct1/libsodium-php - * - * @param int $bytes - * - * @throws Exception - * - * @return string - */ -function random_bytes($bytes) -{ - try { - $bytes = RandomCompat_intval($bytes); - } catch (TypeError $ex) { - throw new TypeError( - 'random_bytes(): $bytes must be an integer' - ); - } - - if ($bytes < 1) { - throw new Error( - 'Length must be greater than 0' - ); - } - +if (!is_callable('random_bytes')) { /** - * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be - * generated in one invocation. + * If the libsodium PHP extension is loaded, we'll use it above any other + * solution. + * + * libsodium-php project: + * @ref https://github.com/jedisct1/libsodium-php + * + * @param int $bytes + * + * @throws Exception + * + * @return string */ - if ($bytes > 2147483647) { + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } + + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } + + /** + * @var string + */ $buf = ''; - for ($i = 0; $i < $bytes; $i += 1073741824) { - $n = ($bytes - $i) > 1073741824 - ? 1073741824 - : $bytes - $i; - $buf .= Sodium::randombytes_buf($n); + + /** + * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be + * generated in one invocation. + */ + if ($bytes > 2147483647) { + for ($i = 0; $i < $bytes; $i += 1073741824) { + $n = ($bytes - $i) > 1073741824 + ? 1073741824 + : $bytes - $i; + $buf .= Sodium::randombytes_buf((int) $n); + } + } else { + $buf .= Sodium::randombytes_buf((int) $bytes); } - } else { - $buf = Sodium::randombytes_buf($bytes); - } - if ($buf !== false) { - if (RandomCompat_strlen($buf) === $bytes) { - return $buf; + if (is_string($buf)) { + if (RandomCompat_strlen($buf) === $bytes) { + return $buf; + } } - } - /** - * If we reach here, PHP has failed us. - */ - throw new Exception( - 'Could not gather sufficient random data' - ); + /** + * If we reach here, PHP has failed us. + */ + throw new Exception( + 'Could not gather sufficient random data' + ); + } } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php index 7ac9d910..aac9c013 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -4,8 +4,8 @@ * for using the new PHP 7 random_* API in PHP 5 projects * * The MIT License (MIT) - * - * Copyright (c) 2015 Paragon Initiative Enterprises + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,51 +26,52 @@ * SOFTWARE. */ +if (!is_callable('random_bytes')) { + /** + * Powered by ext/mcrypt (and thankfully NOT libmcrypt) + * + * @ref https://bugs.php.net/bug.php?id=55169 + * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 + * + * @param int $bytes + * + * @throws Exception + * + * @return string + */ + function random_bytes($bytes) + { + try { + $bytes = RandomCompat_intval($bytes); + } catch (TypeError $ex) { + throw new TypeError( + 'random_bytes(): $bytes must be an integer' + ); + } -/** - * Powered by ext/mcrypt (and thankfully NOT libmcrypt) - * - * @ref https://bugs.php.net/bug.php?id=55169 - * @ref https://github.com/php/php-src/blob/c568ffe5171d942161fc8dda066bce844bdef676/ext/mcrypt/mcrypt.c#L1321-L1386 - * - * @param int $bytes - * - * @throws Exception - * - * @return string - */ -function random_bytes($bytes) -{ - try { - $bytes = RandomCompat_intval($bytes); - } catch (TypeError $ex) { - throw new TypeError( - 'random_bytes(): $bytes must be an integer' - ); - } + if ($bytes < 1) { + throw new Error( + 'Length must be greater than 0' + ); + } - if ($bytes < 1) { - throw new Error( - 'Length must be greater than 0' - ); - } + $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); + if ( + $buf !== false + && + RandomCompat_strlen($buf) === $bytes + ) { + /** + * Return our random entropy buffer here: + */ + return $buf; + } - $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); - if ( - $buf !== false - && - RandomCompat_strlen($buf) === $bytes - ) { /** - * Return our random entropy buffer here: + * If we reach here, PHP has failed us. */ - return $buf; + throw new Exception( + 'Could not gather sufficient random data' + ); } - - /** - * If we reach here, PHP has failed us. - */ - throw new Exception( - 'Could not gather sufficient random data' - ); } diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php index fd3ef87a..5b2143a1 100644 --- a/vendor/paragonie/random_compat/lib/random_int.php +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -1,191 +1,190 @@ operators might accidentally let a float - * through. - */ - - try { - $min = RandomCompat_intval($min); - } catch (TypeError $ex) { - throw new TypeError( - 'random_int(): $min must be an integer' - ); - } - try { - $max = RandomCompat_intval($max); - } catch (TypeError $ex) { - throw new TypeError( - 'random_int(): $max must be an integer' - ); - } - +if (!is_callable('random_int')) { /** - * Now that we've verified our weak typing system has given us an integer, - * let's validate the logic then we can move forward with generating random - * integers along a given range. + * Random_* Compatibility Library + * for using the new PHP 7 random_* API in PHP 5 projects + * + * The MIT License (MIT) + * + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * + * 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. */ - if ($min > $max) { - throw new Error( - 'Minimum value must be less than or equal to the maximum value' - ); - } - - if ($max === $min) { - return $min; - } /** - * Initialize variables to 0 - * - * We want to store: - * $bytes => the number of random bytes we need - * $mask => an integer bitmask (for use with the &) operator - * so we can minimize the number of discards + * Fetch a random integer between $min and $max inclusive + * + * @param int $min + * @param int $max + * + * @throws Exception + * + * @return int */ - $attempts = $bits = $bytes = $mask = $valueShift = 0; - - /** - * At this point, $range is a positive number greater than 0. It might - * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to - * a float and we will lose some precision. - */ - $range = $max - $min; - - /** - * Test for integer overflow: - */ - if (!is_int($range)) { - + function random_int($min, $max) + { /** - * Still safely calculate wider ranges. - * Provided by @CodesInChaos, @oittaa - * - * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 - * - * We use ~0 as a mask in this case because it generates all 1s - * - * @ref https://eval.in/400356 (32-bit) - * @ref http://3v4l.org/XX9r5 (64-bit) + * Type and input logic checks + * + * If you pass it a float in the range (~PHP_INT_MAX, PHP_INT_MAX) + * (non-inclusive), it will sanely cast it to an int. If you it's equal to + * ~PHP_INT_MAX or PHP_INT_MAX, we let it fail as not an integer. Floats + * lose precision, so the <= and => operators might accidentally let a float + * through. */ - $bytes = PHP_INT_SIZE; - $mask = ~0; - } else { + try { + $min = RandomCompat_intval($min); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $min must be an integer' + ); + } - /** - * $bits is effectively ceil(log($range, 2)) without dealing with - * type juggling - */ - while ($range > 0) { - if ($bits % 8 === 0) { - ++$bytes; - } - ++$bits; - $range >>= 1; - $mask = $mask << 1 | 1; + try { + $max = RandomCompat_intval($max); + } catch (TypeError $ex) { + throw new TypeError( + 'random_int(): $max must be an integer' + ); } - $valueShift = $min; - } - /** - * Now that we have our parameters set up, let's begin generating - * random integers until one falls between $min and $max - */ - do { /** - * The rejection probability is at most 0.5, so this corresponds - * to a failure probability of 2^-128 for a working RNG + * Now that we've verified our weak typing system has given us an integer, + * let's validate the logic then we can move forward with generating random + * integers along a given range. */ - if ($attempts > 128) { - throw new Exception( - 'random_int: RNG is broken - too many rejections' + if ($min > $max) { + throw new Error( + 'Minimum value must be less than or equal to the maximum value' ); } + if ($max === $min) { + return (int) $min; + } + /** - * Let's grab the necessary number of random bytes + * Initialize variables to 0 + * + * We want to store: + * $bytes => the number of random bytes we need + * $mask => an integer bitmask (for use with the &) operator + * so we can minimize the number of discards */ - $randomByteString = random_bytes($bytes); - if ($randomByteString === false) { - throw new Exception( - 'Random number generator failure' - ); - } + $attempts = $bits = $bytes = $mask = $valueShift = 0; /** - * Let's turn $randomByteString into an integer - * - * This uses bitwise operators (<< and |) to build an integer - * out of the values extracted from ord() - * - * Example: [9F] | [6D] | [32] | [0C] => - * 159 + 27904 + 3276800 + 201326592 => - * 204631455 + * At this point, $range is a positive number greater than 0. It might + * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to + * a float and we will lose some precision. */ - $val = 0; - for ($i = 0; $i < $bytes; ++$i) { - $val |= ord($randomByteString[$i]) << ($i * 8); - } + $range = $max - $min; /** - * Apply mask + * Test for integer overflow: */ - $val &= $mask; - $val += $valueShift; + if (!is_int($range)) { + + /** + * Still safely calculate wider ranges. + * Provided by @CodesInChaos, @oittaa + * + * @ref https://gist.github.com/CodesInChaos/03f9ea0b58e8b2b8d435 + * + * We use ~0 as a mask in this case because it generates all 1s + * + * @ref https://eval.in/400356 (32-bit) + * @ref http://3v4l.org/XX9r5 (64-bit) + */ + $bytes = PHP_INT_SIZE; + $mask = ~0; - ++$attempts; + } else { + + /** + * $bits is effectively ceil(log($range, 2)) without dealing with + * type juggling + */ + while ($range > 0) { + if ($bits % 8 === 0) { + ++$bytes; + } + ++$bits; + $range >>= 1; + $mask = $mask << 1 | 1; + } + $valueShift = $min; + } + + $val = 0; /** - * If $val overflows to a floating point number, - * ... or is larger than $max, - * ... or smaller than $min, - * then try again. + * Now that we have our parameters set up, let's begin generating + * random integers until one falls between $min and $max */ - } while (!is_int($val) || $val > $max || $val < $min); + do { + /** + * The rejection probability is at most 0.5, so this corresponds + * to a failure probability of 2^-128 for a working RNG + */ + if ($attempts > 128) { + throw new Exception( + 'random_int: RNG is broken - too many rejections' + ); + } + + /** + * Let's grab the necessary number of random bytes + */ + $randomByteString = random_bytes($bytes); - return (int) $val; + /** + * Let's turn $randomByteString into an integer + * + * This uses bitwise operators (<< and |) to build an integer + * out of the values extracted from ord() + * + * Example: [9F] | [6D] | [32] | [0C] => + * 159 + 27904 + 3276800 + 201326592 => + * 204631455 + */ + $val &= 0; + for ($i = 0; $i < $bytes; ++$i) { + $val |= ord($randomByteString[$i]) << ($i * 8); + } + + /** + * Apply mask + */ + $val &= $mask; + $val += $valueShift; + + ++$attempts; + /** + * If $val overflows to a floating point number, + * ... or is larger than $max, + * ... or smaller than $min, + * then try again. + */ + } while (!is_int($val) || $val > $max || $val < $min); + + return (int) $val; + } } diff --git a/vendor/paragonie/random_compat/psalm-autoload.php b/vendor/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 00000000..d71d1b81 --- /dev/null +++ b/vendor/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,9 @@ + + + + + + + + + + + + diff --git a/vendor/pimple/pimple/.travis.yml b/vendor/pimple/pimple/.travis.yml index 5f8bb7c9..196f7fc1 100644 --- a/vendor/pimple/pimple/.travis.yml +++ b/vendor/pimple/pimple/.travis.yml @@ -12,21 +12,29 @@ php: - 5.4 - 5.5 - 5.6 - - hhvm + - 7.0 + - 7.1 before_script: - composer self-update - - COMPOSER_ROOT_VERSION=dev-master composer dump-autoload + - COMPOSER_ROOT_VERSION=dev-master composer install - if [ "$PIMPLE_EXT" == "yes" ]; then sh -c "cd ext/pimple && phpize && ./configure && make && sudo make install"; fi - if [ "$PIMPLE_EXT" == "yes" ]; then echo "extension=pimple.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi script: - cd ext/pimple - if [ "$PIMPLE_EXT" == "yes" ]; then yes n | make test | tee output ; grep -E 'Tests failed +. +0' output; fi + - if [ "$PIMPLE_EXT" == "yes" ]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi - cd ../.. - - phpunit + - ./vendor/bin/simple-phpunit matrix: - exclude: + include: - php: hhvm + dist: trusty + env: PIMPLE_EXT=no + exclude: + - php: 7.0 + env: PIMPLE_EXT=yes + - php: 7.1 env: PIMPLE_EXT=yes diff --git a/vendor/pimple/pimple/CHANGELOG b/vendor/pimple/pimple/CHANGELOG index cc679972..f277b969 100644 --- a/vendor/pimple/pimple/CHANGELOG +++ b/vendor/pimple/pimple/CHANGELOG @@ -1,3 +1,23 @@ +* 3.2.2 (2017-07-23) + + * reverted extending a protected closure throws an exception (deprecated it instead) + +* 3.2.1 (2017-07-17) + + * fixed PHP error + +* 3.2.0 (2017-07-17) + + * added a PSR-11 service locator + * added a PSR-11 wrapper + * added ServiceIterator + * fixed extending a protected closure (now throws InvalidServiceIdentifierException) + +* 3.1.0 (2017-07-03) + + * deprecated the C extension + * added support for PSR-11 exceptions + * 3.0.2 (2015-09-11) * refactored the C extension diff --git a/vendor/pimple/pimple/LICENSE b/vendor/pimple/pimple/LICENSE index d7949e2f..e02dc5a7 100644 --- a/vendor/pimple/pimple/LICENSE +++ b/vendor/pimple/pimple/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009-2015 Fabien Potencier +Copyright (c) 2009-2017 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/pimple/pimple/README.rst b/vendor/pimple/pimple/README.rst index 93fb35a8..d27d8aa3 100644 --- a/vendor/pimple/pimple/README.rst +++ b/vendor/pimple/pimple/README.rst @@ -17,18 +17,7 @@ Before using Pimple in your project, add it to your ``composer.json`` file: .. code-block:: bash - $ ./composer.phar require pimple/pimple ~3.0 - -Alternatively, Pimple is also available as a PHP C extension: - -.. code-block:: bash - - $ git clone https://github.com/silexphp/Pimple - $ cd Pimple/ext/pimple - $ phpize - $ ./configure - $ make - $ make install + $ ./composer.phar require pimple/pimple "^3.0" Usage ----- @@ -198,4 +187,140 @@ raw access to this function, you can use the ``raw()`` method: $sessionFunction = $container->raw('session'); +PSR-11 compatibility +-------------------- + +For historical reasons, the ``Container`` class does not implement the PSR-11 +``ContainerInterface``. However, Pimple provides a helper class that will let +you decouple your code from the Pimple container class. + +The PSR-11 container class +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Pimple\Psr11\Container`` class lets you access the content of an +underlying Pimple container using ``Psr\Container\ContainerInterface`` +methods: + +.. code-block:: php + + use Pimple\Container; + use Pimple\Psr11\Container as PsrContainer; + + $container = new Container(); + $container['service'] = function ($c) { + return new Service(); + }; + $psr11 = new PsrContainer($container); + + $controller = function (PsrContainer $container) { + $service = $container->get('service'); + }; + $controller($psr11); + +Using the PSR-11 ServiceLocator +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes, a service needs access to several other services without being sure +that all of them will actually be used. In those cases, you may want the +instantiation of the services to be lazy. + +The traditional solution is to inject the entire service container to get only +the services really needed. However, this is not recommended because it gives +services a too broad access to the rest of the application and it hides their +actual dependencies. + +The ``ServiceLocator`` is intended to solve this problem by giving access to a +set of predefined services while instantiating them only when actually needed. + +It also allows you to make your services available under a different name than +the one used to register them. For instance, you may want to use an object +that expects an instance of ``EventDispatcherInterface`` to be available under +the name ``event_dispatcher`` while your event dispatcher has been +registered under the name ``dispatcher``: + +.. code-block:: php + + use Monolog\Logger; + use Pimple\Psr11\ServiceLocator; + use Psr\Container\ContainerInterface; + use Symfony\Component\EventDispatcher\EventDispatcher; + + class MyService + { + /** + * "logger" must be an instance of Psr\Log\LoggerInterface + * "event_dispatcher" must be an instance of Symfony\Component\EventDispatcher\EventDispatcherInterface + */ + private $services; + + public function __construct(ContainerInterface $services) + { + $this->services = $services; + } + } + + $container['logger'] = function ($c) { + return new Monolog\Logger(); + }; + $container['dispatcher'] = function () { + return new EventDispatcher(); + }; + + $container['service'] = function ($c) { + $locator = new ServiceLocator($c, array('logger', 'event_dispatcher' => 'dispatcher')); + + return new MyService($locator); + }; + +Referencing a Collection of Services Lazily +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Passing a collection of services instances in an array may prove inefficient +if the class that consumes the collection only needs to iterate over it at a +later stage, when one of its method is called. It can also lead to problems +if there is a circular dependency between one of the services stored in the +collection and the class that consumes it. + +The ``ServiceIterator`` class helps you solve these issues. It receives a +list of service names during instantiation and will retrieve the services +when iterated over: + +.. code-block:: php + + use Pimple\Container; + use Pimple\ServiceIterator; + + class AuthorizationService + { + private $voters; + + public function __construct($voters) + { + $this->voters = $voters; + } + + public function canAccess($resource) + { + foreach ($this->voters as $voter) { + if (true === $voter->canAccess($resource) { + return true; + } + } + + return false; + } + } + + $container = new Container(); + + $container['voter1'] = function ($c) { + return new SomeVoter(); + } + $container['voter2'] = function ($c) { + return new SomeOtherVoter($c['auth']); + } + $container['auth'] = function ($c) { + return new AuthorizationService(new ServiceIterator($c, array('voter1', 'voter2')); + } + .. _Pimple 1.x documentation: https://github.com/silexphp/Pimple/tree/1.1 diff --git a/vendor/pimple/pimple/composer.json b/vendor/pimple/pimple/composer.json index a5268f16..dabf190a 100644 --- a/vendor/pimple/pimple/composer.json +++ b/vendor/pimple/pimple/composer.json @@ -12,14 +12,18 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" }, "autoload": { "psr-0": { "Pimple": "src/" } }, "extra": { "branch-alias": { - "dev-master": "3.0.x-dev" + "dev-master": "3.2.x-dev" } } } diff --git a/vendor/pimple/pimple/ext/pimple/config.m4 b/vendor/pimple/pimple/ext/pimple/config.m4 index c9ba17dd..3a6e9aae 100644 --- a/vendor/pimple/pimple/ext/pimple/config.m4 +++ b/vendor/pimple/pimple/ext/pimple/config.m4 @@ -45,7 +45,7 @@ if test "$PHP_PIMPLE" != "no"; then dnl # --with-pimple -> check for lib and symbol presence dnl LIBNAME=pimple # you may want to change this - dnl LIBSYMBOL=pimple # you most likely want to change this + dnl LIBSYMBOL=pimple # you most likely want to change this dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, dnl [ diff --git a/vendor/pimple/pimple/ext/pimple/php_pimple.h b/vendor/pimple/pimple/ext/pimple/php_pimple.h index 49431f08..258f3eea 100644 --- a/vendor/pimple/pimple/ext/pimple/php_pimple.h +++ b/vendor/pimple/pimple/ext/pimple/php_pimple.h @@ -41,17 +41,31 @@ extern zend_module_entry pimple_module_entry; #include "TSRM.h" #endif -#define PIMPLE_VERSION "3.0.2" +#define PIMPLE_VERSION "3.2.2-DEV" + #define PIMPLE_NS "Pimple" +#define PSR_CONTAINER_NS "Psr\\Container" +#define PIMPLE_EXCEPTION_NS "Pimple\\Exception" #define PIMPLE_DEFAULT_ZVAL_CACHE_NUM 5 #define PIMPLE_DEFAULT_ZVAL_VALUES_NUM 10 +#define PIMPLE_DEPRECATE do { \ + int er = EG(error_reporting); \ + EG(error_reporting) = 0;\ + php_error(E_DEPRECATED, "The Pimple C extension is deprecated since version 3.1 and will be removed in 4.0."); \ + EG(error_reporting) = er; \ +} while (0); + zend_module_entry *get_module(void); PHP_MINIT_FUNCTION(pimple); PHP_MINFO_FUNCTION(pimple); +PHP_METHOD(FrozenServiceException, __construct); +PHP_METHOD(InvalidServiceIdentifierException, __construct); +PHP_METHOD(UnknownIdentifierException, __construct); + PHP_METHOD(Pimple, __construct); PHP_METHOD(Pimple, factory); PHP_METHOD(Pimple, protect); @@ -93,6 +107,8 @@ typedef struct _pimple_closure_object { static const char sensiolabs_logo[] = ""; +static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC); + static int pimple_zval_to_pimpleval(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); static int pimple_zval_is_valid_callback(zval *_zval, pimple_bucket_value *_pimple_bucket_value TSRMLS_DC); diff --git a/vendor/pimple/pimple/ext/pimple/pimple.c b/vendor/pimple/pimple/ext/pimple/pimple.c index 239c01d6..c80499b3 100644 --- a/vendor/pimple/pimple/ext/pimple/pimple.c +++ b/vendor/pimple/pimple/ext/pimple/pimple.c @@ -40,6 +40,15 @@ #include "main/php_output.h" #include "SAPI.h" +static zend_class_entry *pimple_ce_PsrContainerInterface; +static zend_class_entry *pimple_ce_PsrContainerExceptionInterface; +static zend_class_entry *pimple_ce_PsrNotFoundExceptionInterface; + +static zend_class_entry *pimple_ce_ExpectedInvokableException; +static zend_class_entry *pimple_ce_FrozenServiceException; +static zend_class_entry *pimple_ce_InvalidServiceIdentifierException; +static zend_class_entry *pimple_ce_UnknownIdentifierException; + static zend_class_entry *pimple_ce; static zend_object_handlers pimple_object_handlers; static zend_class_entry *pimple_closure_ce; @@ -92,6 +101,63 @@ static zend_internal_function pimple_closure_invoker_function; } \ } while(0); + +/* Psr\Container\ContainerInterface */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_get, 0, 0, 1) +ZEND_ARG_INFO(0, id) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_pimple_PsrContainerInterface_has, 0, 0, 1) +ZEND_ARG_INFO(0, id) +ZEND_END_ARG_INFO() + +static const zend_function_entry pimple_ce_PsrContainerInterface_functions[] = { + PHP_ABSTRACT_ME(ContainerInterface, get, arginfo_pimple_PsrContainerInterface_get) + PHP_ABSTRACT_ME(ContainerInterface, has, arginfo_pimple_PsrContainerInterface_has) + PHP_FE_END +}; + +/* Psr\Container\ContainerExceptionInterface */ +static const zend_function_entry pimple_ce_PsrContainerExceptionInterface_functions[] = { + PHP_FE_END +}; + +/* Psr\Container\NotFoundExceptionInterface */ +static const zend_function_entry pimple_ce_PsrNotFoundExceptionInterface_functions[] = { + PHP_FE_END +}; + +/* Pimple\Exception\FrozenServiceException */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_FrozenServiceException___construct, 0, 0, 1) +ZEND_ARG_INFO(0, id) +ZEND_END_ARG_INFO() + +static const zend_function_entry pimple_ce_FrozenServiceException_functions[] = { + PHP_ME(FrozenServiceException, __construct, arginfo_FrozenServiceException___construct, ZEND_ACC_PUBLIC) + PHP_FE_END +}; + +/* Pimple\Exception\InvalidServiceIdentifierException */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_InvalidServiceIdentifierException___construct, 0, 0, 1) +ZEND_ARG_INFO(0, id) +ZEND_END_ARG_INFO() + +static const zend_function_entry pimple_ce_InvalidServiceIdentifierException_functions[] = { + PHP_ME(InvalidServiceIdentifierException, __construct, arginfo_InvalidServiceIdentifierException___construct, ZEND_ACC_PUBLIC) + PHP_FE_END +}; + +/* Pimple\Exception\UnknownIdentifierException */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_UnknownIdentifierException___construct, 0, 0, 1) +ZEND_ARG_INFO(0, id) +ZEND_END_ARG_INFO() + +static const zend_function_entry pimple_ce_UnknownIdentifierException_functions[] = { + PHP_ME(UnknownIdentifierException, __construct, arginfo_UnknownIdentifierException___construct, ZEND_ACC_PUBLIC) + PHP_FE_END +}; + +/* Pimple\Container */ ZEND_BEGIN_ARG_INFO_EX(arginfo___construct, 0, 0, 0) ZEND_ARG_ARRAY_INFO(0, value, 0) ZEND_END_ARG_INFO() @@ -138,10 +204,6 @@ ZEND_ARG_OBJ_INFO(0, provider, Pimple\\ServiceProviderInterface, 0) ZEND_ARG_ARRAY_INFO(0, values, 1) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(arginfo_serviceprovider_register, 0, 0, 1) -ZEND_ARG_OBJ_INFO(0, pimple, Pimple\\Container, 0) -ZEND_END_ARG_INFO() - static const zend_function_entry pimple_ce_functions[] = { PHP_ME(Pimple, __construct, arginfo___construct, ZEND_ACC_PUBLIC) PHP_ME(Pimple, factory, arginfo_factory, ZEND_ACC_PUBLIC) @@ -158,11 +220,54 @@ static const zend_function_entry pimple_ce_functions[] = { PHP_FE_END }; +/* Pimple\ServiceProviderInterface */ +ZEND_BEGIN_ARG_INFO_EX(arginfo_serviceprovider_register, 0, 0, 1) +ZEND_ARG_OBJ_INFO(0, pimple, Pimple\\Container, 0) +ZEND_END_ARG_INFO() + static const zend_function_entry pimple_serviceprovider_iface_ce_functions[] = { PHP_ABSTRACT_ME(ServiceProviderInterface, register, arginfo_serviceprovider_register) PHP_FE_END }; +/* parent::__construct(sprintf("Something with %s", $arg1)) */ +static void pimple_exception_call_parent_constructor(zval *this_ptr, const char *format, const char *arg1 TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(this_ptr); + char *message = NULL; + int message_len; + zval *constructor_arg; + + message_len = spprintf(&message, 0, format, arg1); + ALLOC_INIT_ZVAL(constructor_arg); + ZVAL_STRINGL(constructor_arg, message, message_len, 1); + + zend_call_method_with_1_params(&this_ptr, ce, &ce->parent->constructor, "__construct", NULL, constructor_arg); + + efree(message); + zval_ptr_dtor(&constructor_arg); +} + +/** + * Pass a single string parameter to exception constructor and throw + */ +static void pimple_throw_exception_string(zend_class_entry *ce, const char *message, zend_uint message_len TSRMLS_DC) +{ + zval *exception, *param; + + ALLOC_INIT_ZVAL(exception); + object_init_ex(exception, ce); + + ALLOC_INIT_ZVAL(param); + ZVAL_STRINGL(param, message, message_len, 1); + + zend_call_method_with_1_params(&exception, ce, &ce->constructor, "__construct", NULL, param); + + zend_throw_exception_object(exception TSRMLS_CC); + + zval_ptr_dtor(¶m); +} + static void pimple_closure_free_object_storage(pimple_closure_object *obj TSRMLS_DC) { zend_object_std_dtor(&obj->zobj TSRMLS_CC); @@ -264,7 +369,7 @@ static void pimple_object_write_dimension(zval *object, zval *offset, zval *valu zend_hash_quick_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void **)&found_value); if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) { pimple_free_bucket(&pimple_value); - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot override frozen service \"%s\".", Z_STRVAL_P(offset)); + pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); return; } if (zend_hash_quick_update(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, hash, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) { @@ -284,7 +389,8 @@ static void pimple_object_write_dimension(zval *object, zval *offset, zval *valu zend_hash_index_find(&pimple_obj->values, index, (void **)&found_value); if (found_value && found_value->type == PIMPLE_IS_SERVICE && found_value->initialized == 1) { pimple_free_bucket(&pimple_value); - zend_throw_exception_ex(spl_ce_RuntimeException, 0 TSRMLS_CC, "Cannot override frozen service \"%ld\".", index); + convert_to_string(offset); + pimple_throw_exception_string(pimple_ce_FrozenServiceException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); return; } if (zend_hash_index_update(&pimple_obj->values, index, (void *)&pimple_value, sizeof(pimple_bucket_value), NULL) == FAILURE) { @@ -385,7 +491,8 @@ static zval *pimple_object_read_dimension(zval *object, zval *offset, int type T switch (Z_TYPE_P(offset)) { case IS_STRING: if (zend_symtable_find(&pimple_obj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **)&retval) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset)); + pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); + return EG(uninitialized_zval_ptr); } break; @@ -419,7 +526,7 @@ static zval *pimple_object_read_dimension(zval *object, zval *offset, int type T } if (zend_hash_index_exists(&pimple_obj->factories, retval->handle_num)) { - /* Service is a factory, call it everytime and never cache its result */ + /* Service is a factory, call it every time and never cache its result */ PIMPLE_CALL_CB Z_DELREF_P(retval_ptr_ptr); /* fetch dim addr will increment refcount */ return retval_ptr_ptr; @@ -482,6 +589,39 @@ static void pimple_bucket_dtor(pimple_bucket_value *bucket) pimple_free_bucket(bucket); } +PHP_METHOD(FrozenServiceException, __construct) +{ + char *id = NULL; + int id_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { + return; + } + pimple_exception_call_parent_constructor(getThis(), "Cannot override frozen service \"%s\".", id TSRMLS_CC); +} + +PHP_METHOD(InvalidServiceIdentifierException, __construct) +{ + char *id = NULL; + int id_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { + return; + } + pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" does not contain an object definition.", id TSRMLS_CC); +} + +PHP_METHOD(UnknownIdentifierException, __construct) +{ + char *id = NULL; + int id_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &id_len) == FAILURE) { + return; + } + pimple_exception_call_parent_constructor(getThis(), "Identifier \"%s\" is not defined.", id TSRMLS_CC); +} + PHP_METHOD(Pimple, protect) { zval *protected = NULL; @@ -494,7 +634,7 @@ PHP_METHOD(Pimple, protect) if (pimple_zval_is_valid_callback(protected, &bucket TSRMLS_CC) == FAILURE) { pimple_free_bucket(&bucket); - zend_throw_exception(spl_ce_InvalidArgumentException, "Callable is not a Closure or invokable object.", 0 TSRMLS_CC); + zend_throw_exception(pimple_ce_ExpectedInvokableException, "Callable is not a Closure or invokable object.", 0 TSRMLS_CC); return; } @@ -526,7 +666,7 @@ PHP_METHOD(Pimple, raw) switch (Z_TYPE_P(offset)) { case IS_STRING: if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset)); + pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); RETURN_NULL(); } break; @@ -571,13 +711,20 @@ PHP_METHOD(Pimple, extend) switch (Z_TYPE_P(offset)) { case IS_STRING: if (zend_symtable_find(&pobj->values, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void *)&value) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" is not defined.", Z_STRVAL_P(offset)); + pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); RETURN_NULL(); } + if (value->type != PIMPLE_IS_SERVICE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%s\" does not contain an object definition.", Z_STRVAL_P(offset)); + pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); RETURN_NULL(); } + if (zend_hash_index_exists(&pobj->protected, value->handle_num)) { + int er = EG(error_reporting); + EG(error_reporting) = 0; + php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%s\" should be protected?", Z_STRVAL_P(offset)); + EG(error_reporting) = er; + } break; case IS_DOUBLE: case IS_BOOL: @@ -588,13 +735,21 @@ PHP_METHOD(Pimple, extend) index = Z_LVAL_P(offset); } if (zend_hash_index_find(&pobj->values, index, (void *)&value) == FAILURE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%ld\" is not defined.", index); + convert_to_string(offset); + pimple_throw_exception_string(pimple_ce_UnknownIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); RETURN_NULL(); } if (value->type != PIMPLE_IS_SERVICE) { - zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0 TSRMLS_CC, "Identifier \"%ld\" does not contain an object definition.", index); + convert_to_string(offset); + pimple_throw_exception_string(pimple_ce_InvalidServiceIdentifierException, Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC); RETURN_NULL(); } + if (zend_hash_index_exists(&pobj->protected, value->handle_num)) { + int er = EG(error_reporting); + EG(error_reporting) = 0; + php_error(E_DEPRECATED, "How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure \"%ld\" should be protected?", index); + EG(error_reporting) = er; + } break; case IS_NULL: default: @@ -603,7 +758,7 @@ PHP_METHOD(Pimple, extend) if (pimple_zval_is_valid_callback(callable, &bucket TSRMLS_CC) == FAILURE) { pimple_free_bucket(&bucket); - zend_throw_exception(spl_ce_InvalidArgumentException, "Extension service definition is not a Closure or invokable object.", 0 TSRMLS_CC); + zend_throw_exception(pimple_ce_ExpectedInvokableException, "Extension service definition is not a Closure or invokable object.", 0 TSRMLS_CC); RETURN_NULL(); } pimple_free_bucket(&bucket); @@ -676,7 +831,7 @@ PHP_METHOD(Pimple, factory) if (pimple_zval_is_valid_callback(factory, &bucket TSRMLS_CC) == FAILURE) { pimple_free_bucket(&bucket); - zend_throw_exception(spl_ce_InvalidArgumentException, "Service definition is not a Closure or invokable object.", 0 TSRMLS_CC); + zend_throw_exception(pimple_ce_ExpectedInvokableException, "Service definition is not a Closure or invokable object.", 0 TSRMLS_CC); return; } @@ -782,7 +937,13 @@ PHP_METHOD(Pimple, __construct) zend_uint str_length; ulong num_index; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &values) == FAILURE || !values) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &values) == FAILURE) { + return; + } + + PIMPLE_DEPRECATE + + if (!values) { return; } @@ -857,7 +1018,38 @@ PHP_METHOD(PimpleClosure, invoker) PHP_MINIT_FUNCTION(pimple) { + zend_class_entry tmp_ce_PsrContainerInterface, tmp_ce_PsrContainerExceptionInterface, tmp_ce_PsrNotFoundExceptionInterface; + zend_class_entry tmp_ce_ExpectedInvokableException, tmp_ce_FrozenServiceException, tmp_ce_InvalidServiceIdentifierException, tmp_ce_UnknownIdentifierException; zend_class_entry tmp_pimple_ce, tmp_pimple_closure_ce, tmp_pimple_serviceprovider_iface_ce; + + /* Psr\Container namespace */ + INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerInterface, PSR_CONTAINER_NS, "ContainerInterface", pimple_ce_PsrContainerInterface_functions); + INIT_NS_CLASS_ENTRY(tmp_ce_PsrContainerExceptionInterface, PSR_CONTAINER_NS, "ContainerExceptionInterface", pimple_ce_PsrContainerExceptionInterface_functions); + INIT_NS_CLASS_ENTRY(tmp_ce_PsrNotFoundExceptionInterface, PSR_CONTAINER_NS, "NotFoundExceptionInterface", pimple_ce_PsrNotFoundExceptionInterface_functions); + + pimple_ce_PsrContainerInterface = zend_register_internal_interface(&tmp_ce_PsrContainerInterface TSRMLS_CC); + pimple_ce_PsrContainerExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrContainerExceptionInterface TSRMLS_CC); + pimple_ce_PsrNotFoundExceptionInterface = zend_register_internal_interface(&tmp_ce_PsrNotFoundExceptionInterface TSRMLS_CC); + + zend_class_implements(pimple_ce_PsrNotFoundExceptionInterface TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); + + /* Pimple\Exception namespace */ + INIT_NS_CLASS_ENTRY(tmp_ce_ExpectedInvokableException, PIMPLE_EXCEPTION_NS, "ExpectedInvokableException", NULL); + INIT_NS_CLASS_ENTRY(tmp_ce_FrozenServiceException, PIMPLE_EXCEPTION_NS, "FrozenServiceException", pimple_ce_FrozenServiceException_functions); + INIT_NS_CLASS_ENTRY(tmp_ce_InvalidServiceIdentifierException, PIMPLE_EXCEPTION_NS, "InvalidServiceIdentifierException", pimple_ce_InvalidServiceIdentifierException_functions); + INIT_NS_CLASS_ENTRY(tmp_ce_UnknownIdentifierException, PIMPLE_EXCEPTION_NS, "UnknownIdentifierException", pimple_ce_UnknownIdentifierException_functions); + + pimple_ce_ExpectedInvokableException = zend_register_internal_class_ex(&tmp_ce_ExpectedInvokableException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); + pimple_ce_FrozenServiceException = zend_register_internal_class_ex(&tmp_ce_FrozenServiceException, spl_ce_RuntimeException, NULL TSRMLS_CC); + pimple_ce_InvalidServiceIdentifierException = zend_register_internal_class_ex(&tmp_ce_InvalidServiceIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); + pimple_ce_UnknownIdentifierException = zend_register_internal_class_ex(&tmp_ce_UnknownIdentifierException, spl_ce_InvalidArgumentException, NULL TSRMLS_CC); + + zend_class_implements(pimple_ce_ExpectedInvokableException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); + zend_class_implements(pimple_ce_FrozenServiceException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); + zend_class_implements(pimple_ce_InvalidServiceIdentifierException TSRMLS_CC, 1, pimple_ce_PsrContainerExceptionInterface); + zend_class_implements(pimple_ce_UnknownIdentifierException TSRMLS_CC, 1, pimple_ce_PsrNotFoundExceptionInterface); + + /* Pimple namespace */ INIT_NS_CLASS_ENTRY(tmp_pimple_ce, PIMPLE_NS, "Container", pimple_ce_functions); INIT_NS_CLASS_ENTRY(tmp_pimple_closure_ce, PIMPLE_NS, "ContainerClosure", NULL); INIT_NS_CLASS_ENTRY(tmp_pimple_serviceprovider_iface_ce, PIMPLE_NS, "ServiceProviderInterface", pimple_serviceprovider_iface_ce_functions); diff --git a/vendor/pimple/pimple/src/Pimple/Container.php b/vendor/pimple/pimple/src/Pimple/Container.php index c976431e..e761964b 100644 --- a/vendor/pimple/pimple/src/Pimple/Container.php +++ b/vendor/pimple/pimple/src/Pimple/Container.php @@ -26,10 +26,15 @@ namespace Pimple; +use Pimple\Exception\ExpectedInvokableException; +use Pimple\Exception\FrozenServiceException; +use Pimple\Exception\InvalidServiceIdentifierException; +use Pimple\Exception\UnknownIdentifierException; + /** * Container main class. * - * @author Fabien Potencier + * @author Fabien Potencier */ class Container implements \ArrayAccess { @@ -41,11 +46,11 @@ class Container implements \ArrayAccess private $keys = array(); /** - * Instantiate the container. + * Instantiates the container. * * Objects and parameters can be passed as argument to the constructor. * - * @param array $values The parameters or objects. + * @param array $values The parameters or objects */ public function __construct(array $values = array()) { @@ -69,12 +74,12 @@ class Container implements \ArrayAccess * @param string $id The unique identifier for the parameter or object * @param mixed $value The value of the parameter or a closure to define an object * - * @throws \RuntimeException Prevent override of a frozen service + * @throws FrozenServiceException Prevent override of a frozen service */ public function offsetSet($id, $value) { if (isset($this->frozen[$id])) { - throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); + throw new FrozenServiceException($id); } $this->values[$id] = $value; @@ -88,12 +93,12 @@ class Container implements \ArrayAccess * * @return mixed The value of the parameter or an object * - * @throws \InvalidArgumentException if the identifier is not defined + * @throws UnknownIdentifierException If the identifier is not defined */ public function offsetGet($id) { if (!isset($this->keys[$id])) { - throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); + throw new UnknownIdentifierException($id); } if ( @@ -153,12 +158,12 @@ class Container implements \ArrayAccess * * @return callable The passed callable * - * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object + * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object */ public function factory($callable) { if (!method_exists($callable, '__invoke')) { - throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); + throw new ExpectedInvokableException('Service definition is not a Closure or invokable object.'); } $this->factories->attach($callable); @@ -175,12 +180,12 @@ class Container implements \ArrayAccess * * @return callable The passed callable * - * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object + * @throws ExpectedInvokableException Service definition has to be a closure or an invokable object */ public function protect($callable) { if (!method_exists($callable, '__invoke')) { - throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); + throw new ExpectedInvokableException('Callable is not a Closure or invokable object.'); } $this->protected->attach($callable); @@ -195,12 +200,12 @@ class Container implements \ArrayAccess * * @return mixed The value of the parameter or the closure defining an object * - * @throws \InvalidArgumentException if the identifier is not defined + * @throws UnknownIdentifierException If the identifier is not defined */ public function raw($id) { if (!isset($this->keys[$id])) { - throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); + throw new UnknownIdentifierException($id); } if (isset($this->raw[$id])) { @@ -221,20 +226,31 @@ class Container implements \ArrayAccess * * @return callable The wrapped callable * - * @throws \InvalidArgumentException if the identifier is not defined or not a service definition + * @throws UnknownIdentifierException If the identifier is not defined + * @throws FrozenServiceException If the service is frozen + * @throws InvalidServiceIdentifierException If the identifier belongs to a parameter + * @throws ExpectedInvokableException If the extension callable is not a closure or an invokable object */ public function extend($id, $callable) { if (!isset($this->keys[$id])) { - throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); + throw new UnknownIdentifierException($id); + } + + if (isset($this->frozen[$id])) { + throw new FrozenServiceException($id); } if (!is_object($this->values[$id]) || !method_exists($this->values[$id], '__invoke')) { - throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id)); + throw new InvalidServiceIdentifierException($id); + } + + if (isset($this->protected[$this->values[$id]])) { + @trigger_error(sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), E_USER_DEPRECATED); } if (!is_object($callable) || !method_exists($callable, '__invoke')) { - throw new \InvalidArgumentException('Extension service definition is not a Closure or invokable object.'); + throw new ExpectedInvokableException('Extension service definition is not a Closure or invokable object.'); } $factory = $this->values[$id]; diff --git a/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php b/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php new file mode 100644 index 00000000..7228421b --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php @@ -0,0 +1,38 @@ + + */ +class ExpectedInvokableException extends \InvalidArgumentException implements ContainerExceptionInterface +{ +} diff --git a/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php b/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php new file mode 100644 index 00000000..64b02659 --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php @@ -0,0 +1,45 @@ + + */ +class FrozenServiceException extends \RuntimeException implements ContainerExceptionInterface +{ + /** + * @param string $id Identifier of the frozen service + */ + public function __construct($id) + { + parent::__construct(sprintf('Cannot override frozen service "%s".', $id)); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php b/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php new file mode 100644 index 00000000..9df9c663 --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php @@ -0,0 +1,45 @@ + + */ +class InvalidServiceIdentifierException extends \InvalidArgumentException implements NotFoundExceptionInterface +{ + /** + * @param string $id The invalid identifier + */ + public function __construct($id) + { + parent::__construct(sprintf('Identifier "%s" does not contain an object definition.', $id)); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php b/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php new file mode 100644 index 00000000..28413189 --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php @@ -0,0 +1,45 @@ + + */ +class UnknownIdentifierException extends \InvalidArgumentException implements NotFoundExceptionInterface +{ + /** + * @param string $id The unknown identifier + */ + public function __construct($id) + { + parent::__construct(sprintf('Identifier "%s" is not defined.', $id)); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Psr11/Container.php b/vendor/pimple/pimple/src/Pimple/Psr11/Container.php new file mode 100644 index 00000000..cadbfffa --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Psr11/Container.php @@ -0,0 +1,55 @@ + + */ +final class Container implements ContainerInterface +{ + private $pimple; + + public function __construct(PimpleContainer $pimple) + { + $this->pimple = $pimple; + } + + public function get($id) + { + return $this->pimple[$id]; + } + + public function has($id) + { + return isset($this->pimple[$id]); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php b/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php new file mode 100644 index 00000000..61e49848 --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php @@ -0,0 +1,75 @@ + + */ +class ServiceLocator implements ContainerInterface +{ + private $container; + private $aliases = array(); + + /** + * @param PimpleContainer $container The Container instance used to locate services + * @param array $ids Array of service ids that can be located. String keys can be used to define aliases + */ + public function __construct(PimpleContainer $container, array $ids) + { + $this->container = $container; + + foreach ($ids as $key => $id) { + $this->aliases[is_int($key) ? $id : $key] = $id; + } + } + + /** + * {@inheritdoc} + */ + public function get($id) + { + if (!isset($this->aliases[$id])) { + throw new UnknownIdentifierException($id); + } + + return $this->container[$this->aliases[$id]]; + } + + /** + * {@inheritdoc} + */ + public function has($id) + { + return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/ServiceIterator.php b/vendor/pimple/pimple/src/Pimple/ServiceIterator.php new file mode 100644 index 00000000..744271dd --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/ServiceIterator.php @@ -0,0 +1,69 @@ + + */ +final class ServiceIterator implements \Iterator +{ + private $container; + private $ids; + + public function __construct(Container $container, array $ids) + { + $this->container = $container; + $this->ids = $ids; + } + + public function rewind() + { + reset($this->ids); + } + + public function current() + { + return $this->container[current($this->ids)]; + } + + public function key() + { + return current($this->ids); + } + + public function next() + { + next($this->ids); + } + + public function valid() + { + return null !== key($this->ids); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php b/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php index 918f620d..acb66e00 100644 --- a/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +++ b/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php @@ -29,7 +29,7 @@ namespace Pimple\Tests; use Pimple\Container; /** - * @author Igor Wiedler + * @author Igor Wiedler */ class PimpleTest extends \PHPUnit_Framework_TestCase { @@ -106,7 +106,7 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \InvalidArgumentException + * @expectedException \Pimple\Exception\UnknownIdentifierException * @expectedExceptionMessage Identifier "foo" is not defined. */ public function testOffsetGetValidatesKeyIsPresent() @@ -115,6 +115,17 @@ class PimpleTest extends \PHPUnit_Framework_TestCase echo $pimple['foo']; } + /** + * @group legacy + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Identifier "foo" is not defined. + */ + public function testLegacyOffsetGetValidatesKeyIsPresent() + { + $pimple = new Container(); + echo $pimple['foo']; + } + public function testOffsetGetHonorsNullValues() { $pimple = new Container(); @@ -187,11 +198,11 @@ class PimpleTest extends \PHPUnit_Framework_TestCase public function testFluentRegister() { $pimple = new Container(); - $this->assertSame($pimple, $pimple->register($this->getMock('Pimple\ServiceProviderInterface'))); + $this->assertSame($pimple, $pimple->register($this->getMockBuilder('Pimple\ServiceProviderInterface')->getMock())); } /** - * @expectedException \InvalidArgumentException + * @expectedException \Pimple\Exception\UnknownIdentifierException * @expectedExceptionMessage Identifier "foo" is not defined. */ public function testRawValidatesKeyIsPresent() @@ -200,6 +211,17 @@ class PimpleTest extends \PHPUnit_Framework_TestCase $pimple->raw('foo'); } + /** + * @group legacy + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Identifier "foo" is not defined. + */ + public function testLegacyRawValidatesKeyIsPresent() + { + $pimple = new Container(); + $pimple->raw('foo'); + } + /** * @dataProvider serviceDefinitionProvider */ @@ -251,7 +273,7 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \InvalidArgumentException + * @expectedException \Pimple\Exception\UnknownIdentifierException * @expectedExceptionMessage Identifier "foo" is not defined. */ public function testExtendValidatesKeyIsPresent() @@ -260,6 +282,17 @@ class PimpleTest extends \PHPUnit_Framework_TestCase $pimple->extend('foo', function () {}); } + /** + * @group legacy + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Identifier "foo" is not defined. + */ + public function testLegacyExtendValidatesKeyIsPresent() + { + $pimple = new Container(); + $pimple->extend('foo', function () {}); + } + public function testKeys() { $pimple = new Container(); @@ -289,7 +322,7 @@ class PimpleTest extends \PHPUnit_Framework_TestCase /** * @dataProvider badServiceDefinitionProvider - * @expectedException \InvalidArgumentException + * @expectedException \Pimple\Exception\ExpectedInvokableException * @expectedExceptionMessage Service definition is not a Closure or invokable object. */ public function testFactoryFailsForInvalidServiceDefinitions($service) @@ -299,8 +332,20 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** + * @group legacy * @dataProvider badServiceDefinitionProvider * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Service definition is not a Closure or invokable object. + */ + public function testLegacyFactoryFailsForInvalidServiceDefinitions($service) + { + $pimple = new Container(); + $pimple->factory($service); + } + + /** + * @dataProvider badServiceDefinitionProvider + * @expectedException \Pimple\Exception\ExpectedInvokableException * @expectedExceptionMessage Callable is not a Closure or invokable object. */ public function testProtectFailsForInvalidServiceDefinitions($service) @@ -310,8 +355,20 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** + * @group legacy * @dataProvider badServiceDefinitionProvider * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Callable is not a Closure or invokable object. + */ + public function testLegacyProtectFailsForInvalidServiceDefinitions($service) + { + $pimple = new Container(); + $pimple->protect($service); + } + + /** + * @dataProvider badServiceDefinitionProvider + * @expectedException \Pimple\Exception\InvalidServiceIdentifierException * @expectedExceptionMessage Identifier "foo" does not contain an object definition. */ public function testExtendFailsForKeysNotContainingServiceDefinitions($service) @@ -322,8 +379,39 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** + * @group legacy * @dataProvider badServiceDefinitionProvider * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Identifier "foo" does not contain an object definition. + */ + public function testLegacyExtendFailsForKeysNotContainingServiceDefinitions($service) + { + $pimple = new Container(); + $pimple['foo'] = $service; + $pimple->extend('foo', function () {}); + } + + /** + * @group legacy + * @expectedDeprecation How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "foo" should be protected? + */ + public function testExtendingProtectedClosureDeprecation() + { + $pimple = new Container(); + $pimple['foo'] = $pimple->protect(function () { + return 'bar'; + }); + + $pimple->extend('foo', function ($value) { + return $value.'-baz'; + }); + + $this->assertSame('bar-baz', $pimple['foo']); + } + + /** + * @dataProvider badServiceDefinitionProvider + * @expectedException \Pimple\Exception\ExpectedInvokableException * @expectedExceptionMessage Extension service definition is not a Closure or invokable object. */ public function testExtendFailsForInvalidServiceDefinitions($service) @@ -333,6 +421,49 @@ class PimpleTest extends \PHPUnit_Framework_TestCase $pimple->extend('foo', $service); } + /** + * @group legacy + * @dataProvider badServiceDefinitionProvider + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Extension service definition is not a Closure or invokable object. + */ + public function testLegacyExtendFailsForInvalidServiceDefinitions($service) + { + $pimple = new Container(); + $pimple['foo'] = function () {}; + $pimple->extend('foo', $service); + } + + /** + * @expectedException \Pimple\Exception\FrozenServiceException + * @expectedExceptionMessage Cannot override frozen service "foo". + */ + public function testExtendFailsIfFrozenServiceIsNonInvokable() + { + $pimple = new Container(); + $pimple['foo'] = function () { + return new Fixtures\NonInvokable(); + }; + $foo = $pimple['foo']; + + $pimple->extend('foo', function () {}); + } + + /** + * @expectedException \Pimple\Exception\FrozenServiceException + * @expectedExceptionMessage Cannot override frozen service "foo". + */ + public function testExtendFailsIfFrozenServiceIsInvokable() + { + $pimple = new Container(); + $pimple['foo'] = function () { + return new Fixtures\Invokable(); + }; + $foo = $pimple['foo']; + + $pimple->extend('foo', function () {}); + } + /** * Provider for invalid service definitions. */ @@ -375,7 +506,7 @@ class PimpleTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \RuntimeException + * @expectedException \Pimple\Exception\FrozenServiceException * @expectedExceptionMessage Cannot override frozen service "foo". */ public function testOverridingServiceAfterFreeze() @@ -391,6 +522,24 @@ class PimpleTest extends \PHPUnit_Framework_TestCase }; } + /** + * @group legacy + * @expectedException \RuntimeException + * @expectedExceptionMessage Cannot override frozen service "foo". + */ + public function testLegacyOverridingServiceAfterFreeze() + { + $pimple = new Container(); + $pimple['foo'] = function () { + return 'foo'; + }; + $foo = $pimple['foo']; + + $pimple['foo'] = function () { + return 'bar'; + }; + } + public function testRemovingServiceAfterFreeze() { $pimple = new Container(); diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php new file mode 100644 index 00000000..7ca2d7ff --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php @@ -0,0 +1,77 @@ +assertSame($pimple['service'], $psr->get('service')); + } + + /** + * @expectedException \Psr\Container\NotFoundExceptionInterface + * @expectedExceptionMessage Identifier "service" is not defined. + */ + public function testGetThrowsExceptionIfServiceIsNotFound() + { + $pimple = new Container(); + $psr = new PsrContainer($pimple); + + $psr->get('service'); + } + + public function testHasReturnsTrueIfServiceExists() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Service(); + }; + $psr = new PsrContainer($pimple); + + $this->assertTrue($psr->has('service')); + } + + public function testHasReturnsFalseIfServiceDoesNotExist() + { + $pimple = new Container(); + $psr = new PsrContainer($pimple); + + $this->assertFalse($psr->has('service')); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php new file mode 100644 index 00000000..c9a08125 --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php @@ -0,0 +1,134 @@ + + */ +class ServiceLocatorTest extends TestCase +{ + public function testCanAccessServices() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('service')); + + $this->assertSame($pimple['service'], $locator->get('service')); + } + + public function testCanAccessAliasedServices() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('alias' => 'service')); + + $this->assertSame($pimple['service'], $locator->get('alias')); + } + + /** + * @expectedException \Pimple\Exception\UnknownIdentifierException + * @expectedExceptionMessage Identifier "service" is not defined. + */ + public function testCannotAccessAliasedServiceUsingRealIdentifier() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('alias' => 'service')); + + $service = $locator->get('service'); + } + + /** + * @expectedException \Pimple\Exception\UnknownIdentifierException + * @expectedExceptionMessage Identifier "foo" is not defined. + */ + public function testGetValidatesServiceCanBeLocated() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('alias' => 'service')); + + $service = $locator->get('foo'); + } + + /** + * @expectedException \Pimple\Exception\UnknownIdentifierException + * @expectedExceptionMessage Identifier "invalid" is not defined. + */ + public function testGetValidatesTargetServiceExists() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('alias' => 'invalid')); + + $service = $locator->get('alias'); + } + + public function testHasValidatesServiceCanBeLocated() + { + $pimple = new Container(); + $pimple['service1'] = function () { + return new Fixtures\Service(); + }; + $pimple['service2'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('service1')); + + $this->assertTrue($locator->has('service1')); + $this->assertFalse($locator->has('service2')); + } + + public function testHasChecksIfTargetServiceExists() + { + $pimple = new Container(); + $pimple['service'] = function () { + return new Fixtures\Service(); + }; + $locator = new ServiceLocator($pimple, array('foo' => 'service', 'bar' => 'invalid')); + + $this->assertTrue($locator->has('foo')); + $this->assertFalse($locator->has('bar')); + } +} diff --git a/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php b/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php new file mode 100644 index 00000000..5dd52f0d --- /dev/null +++ b/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php @@ -0,0 +1,52 @@ +assertSame(array('service1' => $pimple['service1'], 'service2' => $pimple['service2']), iterator_to_array($iterator)); + } +} diff --git a/vendor/psr/container/.gitignore b/vendor/psr/container/.gitignore new file mode 100644 index 00000000..b2395aa0 --- /dev/null +++ b/vendor/psr/container/.gitignore @@ -0,0 +1,3 @@ +composer.lock +composer.phar +/vendor/ diff --git a/vendor/psr/container/LICENSE b/vendor/psr/container/LICENSE new file mode 100644 index 00000000..2877a489 --- /dev/null +++ b/vendor/psr/container/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2016 container-interop +Copyright (c) 2016 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/container/README.md b/vendor/psr/container/README.md new file mode 100644 index 00000000..084f6df5 --- /dev/null +++ b/vendor/psr/container/README.md @@ -0,0 +1,5 @@ +# PSR Container + +This repository holds all interfaces/classes/traits related to [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md). + +Note that this is not a container implementation of its own. See the specification for more details. diff --git a/vendor/psr/container/composer.json b/vendor/psr/container/composer.json new file mode 100644 index 00000000..b8ee0126 --- /dev/null +++ b/vendor/psr/container/composer.json @@ -0,0 +1,27 @@ +{ + "name": "psr/container", + "type": "library", + "description": "Common Container Interface (PHP FIG PSR-11)", + "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], + "homepage": "https://github.com/php-fig/container", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/container/src/ContainerExceptionInterface.php b/vendor/psr/container/src/ContainerExceptionInterface.php new file mode 100644 index 00000000..d35c6b4d --- /dev/null +++ b/vendor/psr/container/src/ContainerExceptionInterface.php @@ -0,0 +1,13 @@ +setRules(array( + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => array('syntax' => 'long'), + 'no_unreachable_default_argument_value' => false, + 'braces' => array('allow_single_line_closure' => true), + 'heredoc_to_nowdoc' => false, + 'phpdoc_annotation_without_dot' => false, + )) + ->setRiskyAllowed(true) + ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__)) +; diff --git a/vendor/swiftmailer/swiftmailer/.travis.yml b/vendor/swiftmailer/swiftmailer/.travis.yml index 0adf8d54..fc24d05e 100644 --- a/vendor/swiftmailer/swiftmailer/.travis.yml +++ b/vendor/swiftmailer/swiftmailer/.travis.yml @@ -11,8 +11,7 @@ before_script: - gem install mailcatcher - mailcatcher --smtp-port 4456 -script: - - phpunit --verbose +script: ./vendor/bin/simple-phpunit matrix: include: @@ -21,7 +20,12 @@ matrix: - php: 5.5 - php: 5.6 - php: 7.0 + - php: 7.1 - php: hhvm allow_failures: - php: hhvm fast_finish: true + +cache: + directories: + - .phpunit diff --git a/vendor/swiftmailer/swiftmailer/CHANGES b/vendor/swiftmailer/swiftmailer/CHANGES index 282e89e1..e5b605bd 100644 --- a/vendor/swiftmailer/swiftmailer/CHANGES +++ b/vendor/swiftmailer/swiftmailer/CHANGES @@ -1,10 +1,36 @@ Changelog ========= -5.4.5 (2016-XX-XX) +5.4.8 (2017-05-01) ------------------ - * fixed CVE-2016-10033 and CVE-2016-10045 + * fixed encoding inheritance in addPart() + * fixed sorting MIME children when their types are equal + +5.4.7 (2017-04-20) +------------------ + + * fixed NTLMAuthenticator clobbering bcmath scale + +5.4.6 (2017-02-13) +------------------ + + * removed exceptions thrown in destructors as they lead to fatal errors + * switched to use sha256 by default in DKIM as per the RFC + * fixed an 'Undefined variable: pipes' PHP notice + * fixed long To headers when using the mail transport + * fixed NTLMAuthenticator when no domain is passed with the username + * prevented fatal error during unserialization of a message + * fixed a PHP warning when sending a message that has a length of a multiple of 8192 + +5.4.5 (2016-12-29) +------------------ + + * SECURITY FIX: fixed CVE-2016-10074 by disallowing potentially unsafe shell characters + + Prior to 5.4.5, the mail transport (Swift_Transport_MailTransport) was vulnerable to passing + arbitrary shell arguments if the "From", "ReturnPath" or "Sender" header came + from a non-trusted source, potentially allowing Remote Code Execution * deprecated the mail transport 5.4.4 (2016-11-23) diff --git a/vendor/swiftmailer/swiftmailer/VERSION b/vendor/swiftmailer/swiftmailer/VERSION index e130e22a..6434642b 100644 --- a/vendor/swiftmailer/swiftmailer/VERSION +++ b/vendor/swiftmailer/swiftmailer/VERSION @@ -1 +1 @@ -Swift-5.4.5-DEV +Swift-5.4.8 diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php index 3d5e854a..4267adbc 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader.php @@ -48,8 +48,8 @@ interface Swift_CharacterReader * A value of zero means this is already a valid character. * A value of -1 means this cannot possibly be a valid character. * - * @param integer[] $bytes - * @param int $size + * @param int[] $bytes + * @param int $size * * @return int */ diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php index 7379bda2..22746bd8 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php @@ -19,22 +19,22 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader /** Pre-computed for optimization */ private static $length_map = array( // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N - 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN - 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN - 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN - 4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN + 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // 0xFN ); private static $s_length_map = array( diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php index d695a6e1..7213a40d 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php @@ -155,7 +155,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea * * @param int $length * - * @return integer[] + * @return int[] */ public function readBytes($length) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php index 8c1074a3..befec9ac 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php @@ -48,7 +48,7 @@ class Swift_DependencyContainer /** * Returns a singleton of the DependencyContainer. * - * @return Swift_DependencyContainer + * @return self */ public static function getInstance() { @@ -143,7 +143,7 @@ class Swift_DependencyContainer * * @param string $itemName * - * @return Swift_DependencyContainer + * @return $this */ public function register($itemName) { @@ -160,7 +160,7 @@ class Swift_DependencyContainer * * @param mixed $value * - * @return Swift_DependencyContainer + * @return $this */ public function asValue($value) { @@ -176,7 +176,7 @@ class Swift_DependencyContainer * * @param string $lookup * - * @return Swift_DependencyContainer + * @return $this */ public function asAliasOf($lookup) { @@ -198,7 +198,7 @@ class Swift_DependencyContainer * * @param string $className * - * @return Swift_DependencyContainer + * @return $this */ public function asNewInstanceOf($className) { @@ -216,7 +216,7 @@ class Swift_DependencyContainer * * @param string $className * - * @return Swift_DependencyContainer + * @return $this */ public function asSharedInstanceOf($className) { @@ -236,7 +236,7 @@ class Swift_DependencyContainer * * @param array $lookups * - * @return Swift_DependencyContainer + * @return $this */ public function withDependencies(array $lookups) { @@ -257,7 +257,7 @@ class Swift_DependencyContainer * * @param mixed $value * - * @return Swift_DependencyContainer + * @return $this */ public function addConstructorValue($value) { @@ -278,7 +278,7 @@ class Swift_DependencyContainer * * @param string $lookup * - * @return Swift_DependencyContainer + * @return $this */ public function addConstructorLookup($lookup) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php index 8a81fe39..edec10c5 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php @@ -235,8 +235,8 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder /** * Encode the given byte array into a verbatim QP form. * - * @param integer[] $bytes - * @param int $size + * @param int[] $bytes + * @param int $size * * @return string */ @@ -262,7 +262,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder * * @param int $size number of bytes to read * - * @return integer[] + * @return int[] */ protected function _nextSequence($size = 4) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php index 253977b6..24587870 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php @@ -55,8 +55,6 @@ class Swift_Encoding return self::_lookup('mime.base64contentencoder'); } - // -- Private Static Methods - private static function _lookup($key) { return Swift_DependencyContainer::getInstance()->lookup($key); diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php index 7dc381d9..674e6b5e 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php @@ -25,7 +25,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject /** * An array of codes which a successful response will contain. * - * @var integer[] + * @var int[] */ private $_successCodes = array(); @@ -56,7 +56,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject /** * Get the numeric response codes which indicate success for this command. * - * @return integer[] + * @return int[] */ public function getSuccessCodes() { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php index 53f277da..9951c597 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php @@ -36,7 +36,7 @@ class Swift_FailoverTransport extends Swift_Transport_FailoverTransport * * @param Swift_Transport[] $transports * - * @return Swift_FailoverTransport + * @return self */ public static function newInstance($transports = array()) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php index 25f5f1b6..4213ee27 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php @@ -36,7 +36,7 @@ class Swift_Image extends Swift_EmbeddedFile * @param string $filename * @param string $contentType * - * @return Swift_Image + * @return self */ public static function newInstance($data = null, $filename = null, $contentType = null) { @@ -48,14 +48,10 @@ class Swift_Image extends Swift_EmbeddedFile * * @param string $path * - * @return Swift_Image + * @return self */ public static function fromPath($path) { - $image = self::newInstance()->setFile( - new Swift_ByteStream_FileByteStream($path) - ); - - return $image; + return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path)); } } diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php index fdba9df5..e151b8a9 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php @@ -36,7 +36,7 @@ class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport * * @param array $transports * - * @return Swift_LoadBalancedTransport + * @return self */ public static function newInstance($transports = array()) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php index 994df3ec..18556989 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php @@ -38,7 +38,7 @@ class Swift_MailTransport extends Swift_Transport_MailTransport * * @param string $extraParams To be passed to mail() * - * @return Swift_MailTransport + * @return self */ public static function newInstance($extraParams = '-f%s') { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php index 64115462..8314fe8f 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php @@ -33,7 +33,7 @@ class Swift_Mailer * * @param Swift_Transport $transport * - * @return Swift_Mailer + * @return self */ public static function newInstance(Swift_Transport $transport) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php index a6bb6593..242cbf31 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php @@ -86,9 +86,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage */ public function addPart($body, $contentType = null, $charset = null) { - return $this->attach(Swift_MimePart::newInstance( - $body, $contentType, $charset - )); + return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder())); } /** diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php index 46a5e8da..d5ba14b9 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php @@ -64,7 +64,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity * * @param string $disposition * - * @return Swift_Mime_Attachment + * @return $this */ public function setDisposition($disposition) { @@ -90,7 +90,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity * * @param string $filename * - * @return Swift_Mime_Attachment + * @return $this */ public function setFilename($filename) { @@ -115,7 +115,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity * * @param int $size * - * @return Swift_Mime_Attachment + * @return $this */ public function setSize($size) { @@ -130,7 +130,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity * @param Swift_FileStream $file * @param string $contentType optional * - * @return Swift_Mime_Attachment + * @return $this */ public function setFile(Swift_FileStream $file, $contentType = null) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php index 7390d2c8..1768709e 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php @@ -138,7 +138,7 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver /** * Create a new instance of this HeaderSet. * - * @return Swift_Mime_HeaderSet + * @return self */ public function newInstance(); diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php index fbd9258a..3a6d7b39 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php @@ -219,8 +219,6 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header return $this->toString(); } - // -- Points of extension - /** * Set the name of this Header field. * @@ -449,7 +447,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header */ protected function toTokens($string = null) { - if (is_null($string)) { + if (null === $string) { $string = $this->getFieldBody(); } diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php index 4fd66742..4075cbfa 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php @@ -95,7 +95,7 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader */ public function setTimestamp($timestamp) { - if (!is_null($timestamp)) { + if (null !== $timestamp) { $timestamp = (int) $timestamp; } $this->clearCachedValueIf($this->_timestamp != $timestamp); diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php index e54b1c66..e4567fc8 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php @@ -231,15 +231,13 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader public function getFieldBody() { // Compute the string value of the header only if needed - if (is_null($this->getCachedValue())) { + if (null === $this->getCachedValue()) { $this->setCachedValue($this->createMailboxListString($this->_mailboxes)); } return $this->getCachedValue(); } - // -- Points of extension - /** * Normalizes a user-input list of mailboxes into consistent key=>value pairs. * @@ -323,7 +321,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader foreach ($mailboxes as $email => $name) { $mailboxStr = $email; - if (!is_null($name)) { + if (null !== $name) { $nameStr = $this->createDisplayNameString($name, empty($strings)); $mailboxStr = $nameStr.' <'.$mailboxStr.'>'; } diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php index c506daec..c1777d33 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php @@ -131,7 +131,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct { $body = parent::getFieldBody(); foreach ($this->_params as $name => $value) { - if (!is_null($value)) { + if (null !== $value) { // Add the parameter $body .= '; '.$this->_createParameter($name, $value); } @@ -156,7 +156,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct // Try creating any parameters foreach ($this->_params as $name => $value) { - if (!is_null($value)) { + if (null !== $value) { // Add the semi-colon separator $tokens[count($tokens) - 1] .= ';'; $tokens = array_merge($tokens, $this->generateTokenLines( diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php index 2fffc7b4..4a814b12 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php @@ -80,7 +80,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader */ public function setAddress($address) { - if (is_null($address)) { + if (null === $address) { $this->_address = null; } elseif ('' == $address) { $this->_address = ''; diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php index 50fadfb7..4564fef6 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php @@ -40,7 +40,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity { parent::__construct($headers, $encoder, $cache, $grammar); $this->setContentType('text/plain'); - if (!is_null($charset)) { + if (null !== $charset) { $this->setCharset($charset); } } @@ -53,7 +53,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity * @param string $contentType optional * @param string $charset optional * - * @return Swift_Mime_MimePart + * @return $this */ public function setBody($body, $contentType = null, $charset = null) { @@ -82,7 +82,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity * * @param string $charset * - * @return Swift_Mime_MimePart + * @return $this */ public function setCharset($charset) { @@ -111,7 +111,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity * * @param string $format * - * @return Swift_Mime_MimePart + * @return $this */ public function setFormat($format) { @@ -136,7 +136,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity * * @param bool $delsp * - * @return Swift_Mime_MimePart + * @return $this */ public function setDelSp($delsp = true) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php index e2d0e874..a06ce724 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php @@ -266,7 +266,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet /** * Create a new instance of this HeaderSet. * - * @return Swift_Mime_HeaderSet + * @return self */ public function newInstance() { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php index f169584d..a13f1b23 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php @@ -786,30 +786,33 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity // Sort in order of preference, if there is one if ($shouldSort) { - usort($this->_immediateChildren, array($this, '_childSortAlgorithm')); - } - } + // Group the messages by order of preference + $sorted = array(); + foreach ($this->_immediateChildren as $child) { + $type = $child->getContentType(); + $level = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; - private function _childSortAlgorithm($a, $b) - { - $typePrefs = array(); - $types = array(strtolower($a->getContentType()), strtolower($b->getContentType())); + if (empty($sorted[$level])) { + $sorted[$level] = array(); + } - foreach ($types as $type) { - $typePrefs[] = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; - } + $sorted[$level][] = $child; + } - return $typePrefs[0] >= $typePrefs[1] ? 1 : -1; - } + ksort($sorted); - // -- Destructor + $this->_immediateChildren = array_reduce($sorted, 'array_merge', array()); + } + } /** * Empties it's own contents from the cache. */ public function __destruct() { - $this->_cache->clearAll($this->_cacheKey); + if ($this->_cache instanceof Swift_KeyCache) { + $this->_cache->clearAll($this->_cacheKey); + } } /** diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php index 215f8db3..525b7ec8 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php @@ -50,7 +50,7 @@ class Swift_MimePart extends Swift_Mime_MimePart * @param string $contentType * @param string $charset * - * @return Swift_Mime_MimePart + * @return self */ public static function newInstance($body = null, $contentType = null, $charset = null) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php index b38e1cf7..ddde335c 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php @@ -15,9 +15,6 @@ */ class Swift_NullTransport extends Swift_Transport_NullTransport { - /** - * Create a new NullTransport. - */ public function __construct() { call_user_func_array( @@ -30,7 +27,7 @@ class Swift_NullTransport extends Swift_Transport_NullTransport /** * Create a new NullTransport instance. * - * @return Swift_NullTransport + * @return self */ public static function newInstance() { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php index 7552b67a..58344405 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php @@ -18,7 +18,7 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener /** * The sender to impersonate. * - * @var String + * @var string */ private $_sender; diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php index e622cb37..5ff1d932 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php @@ -16,7 +16,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener { /** - * @var array + * @var Swift_Mime_Message[] */ private $messages; @@ -28,7 +28,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener /** * Get the message list. * - * @return array + * @return Swift_Mime_Message[] */ public function getMessages() { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php index 18abb770..31461526 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php @@ -63,7 +63,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL * @param int $port * @param string $crypto as "tls" or "ssl" * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return self */ public static function newInstance($host, $port = 110, $crypto = null) { @@ -75,7 +75,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL * * @param Swift_Plugins_Pop_Pop3Connection $connection * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection) { @@ -99,7 +99,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL * * @param int $timeout * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setTimeout($timeout) { @@ -113,7 +113,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL * * @param string $username * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setUsername($username) { @@ -127,7 +127,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL * * @param string $password * - * @return Swift_Plugins_PopBeforeSmtpPlugin + * @return $this */ public function setPassword($password) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php index 503db84d..83cbddcd 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php @@ -26,7 +26,7 @@ class Swift_Preferences /** * Gets the instance of Preferences. * - * @return Swift_Preferences + * @return self */ public static function getInstance() { @@ -42,12 +42,11 @@ class Swift_Preferences * * @param string $charset * - * @return Swift_Preferences + * @return $this */ public function setCharset($charset) { - Swift_DependencyContainer::getInstance() - ->register('properties.charset')->asValue($charset); + Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset); return $this; } @@ -57,12 +56,11 @@ class Swift_Preferences * * @param string $dir * - * @return Swift_Preferences + * @return $this */ public function setTempDir($dir) { - Swift_DependencyContainer::getInstance() - ->register('tempdir')->asValue($dir); + Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir); return $this; } @@ -72,12 +70,11 @@ class Swift_Preferences * * @param string $type * - * @return Swift_Preferences + * @return $this */ public function setCacheType($type) { - Swift_DependencyContainer::getInstance() - ->register('cache')->asAliasOf(sprintf('cache.%s', $type)); + Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type)); return $this; } @@ -87,7 +84,7 @@ class Swift_Preferences * * @param bool $dotEscape * - * @return Swift_Preferences + * @return $this */ public function setQPDotEscape($dotEscape) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php index 974b24f2..47ae7a59 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php @@ -36,7 +36,7 @@ class Swift_SendmailTransport extends Swift_Transport_SendmailTransport * * @param string $command * - * @return Swift_SendmailTransport + * @return self */ public static function newInstance($command = '/usr/sbin/sendmail -bs') { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php index 9ffcef39..8e66e18f 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/BodySigner.php @@ -20,7 +20,7 @@ interface Swift_Signers_BodySigner extends Swift_Signer * * @param Swift_Message $message * - * @return Swift_Signers_BodySigner + * @return self */ public function signMessage(Swift_Message $message); diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php index 6ddd4f92..454e84b4 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php @@ -39,9 +39,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * Hash algorithm used. * + * @see RFC6376 3.3: Signers MUST implement and SHOULD sign using rsa-sha256. + * * @var string */ - protected $_hashAlgorithm = 'rsa-sha1'; + protected $_hashAlgorithm = 'rsa-sha256'; /** * Body canon method. @@ -101,7 +103,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * When will the signature expires false means not embedded, if sigTimestamp is auto - * Expiration is relative, otherwhise it's absolute. + * Expiration is relative, otherwise it's absolute. * * @var int */ @@ -123,7 +125,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner protected $_signedHeaders = array(); /** - * If debugHeaders is set store debugDatas here. + * If debugHeaders is set store debugData here. * * @var string */ @@ -174,6 +176,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner $this->_domainName = $domainName; $this->_signerIdentity = '@'.$domainName; $this->_selector = $selector; + + // keep fallback hash algorithm sha1 if php version is lower than 5.4.8 + if (PHP_VERSION_ID < 50408) { + $this->_hashAlgorithm = 'rsa-sha1'; + } } /** @@ -183,7 +190,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * @param string $domainName * @param string $selector * - * @return Swift_Signers_DKIMSigner + * @return self */ public static function newInstance($privateKey, $domainName, $selector) { @@ -223,6 +230,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @return int */ + // TODO fix return public function write($bytes) { $this->_canonicalizeBody($bytes); @@ -234,8 +242,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * For any bytes that are currently buffered inside the stream, force them * off the buffer. - * - * @throws Swift_IoException */ public function commit() { @@ -276,8 +282,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner return; } } - - return; } /** @@ -292,19 +296,28 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner } /** - * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256. + * Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1. * - * @param string $hash + * @param string $hash 'rsa-sha1' or 'rsa-sha256' * - * @return Swift_Signers_DKIMSigner + * @throws Swift_SwiftException + * + * @return $this */ public function setHashAlgorithm($hash) { - // Unable to sign with rsa-sha256 - if ($hash == 'rsa-sha1') { - $this->_hashAlgorithm = 'rsa-sha1'; - } else { - $this->_hashAlgorithm = 'rsa-sha256'; + switch ($hash) { + case 'rsa-sha1': + $this->_hashAlgorithm = 'rsa-sha1'; + break; + case 'rsa-sha256': + $this->_hashAlgorithm = 'rsa-sha256'; + if (!defined('OPENSSL_ALGO_SHA256')) { + throw new Swift_SwiftException('Unable to set sha256 as it is not supported by OpenSSL.'); + } + break; + default: + throw new Swift_SwiftException('Unable to set the hash algorithm, must be one of rsa-sha1 or rsa-sha256 (%s given).', $hash); } return $this; @@ -315,7 +328,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param string $canon * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setBodyCanon($canon) { @@ -333,7 +346,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param string $canon * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setHeaderCanon($canon) { @@ -351,7 +364,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param string $identity * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignerIdentity($identity) { @@ -365,7 +378,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param mixed $len (bool or int) * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setBodySignedLen($len) { @@ -388,7 +401,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param int $time A timestamp * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureTimestamp($time) { @@ -402,7 +415,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner * * @param int $time A timestamp * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureExpiration($time) { @@ -583,7 +596,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner /** * @deprecated This method is currently useless in this class but it must be * kept for BC reasons due to its "protected" scope. This method - * might be overriden by custom client code. + * might be overridden by custom client code. */ protected function _endOfHeaders() { @@ -678,6 +691,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner private function _getEncryptedHash() { $signature = ''; + switch ($this->_hashAlgorithm) { case 'rsa-sha1': $algorithm = OPENSSL_ALGO_SHA1; diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php index 786cee7b..0365363c 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php @@ -131,7 +131,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * @param string $domainName * @param string $selector * - * @return Swift_Signers_DomainKeySigner + * @return self */ public static function newInstance($privateKey, $domainName, $selector) { @@ -141,7 +141,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner /** * Resets internal states. * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function reset() { @@ -169,8 +169,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @throws Swift_IoException * - * @return int - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function write($bytes) { @@ -188,7 +187,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function commit() { @@ -203,7 +202,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function bind(Swift_InputByteStream $is) { @@ -221,7 +220,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function unbind(Swift_InputByteStream $is) { @@ -230,7 +229,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner if ($stream === $is) { unset($this->_bound[$k]); - return; + break; } } @@ -243,7 +242,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function flushBuffers() { @@ -257,7 +256,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param string $hash * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setHashAlgorithm($hash) { @@ -271,7 +270,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param string $canon simple | nofws defaults to simple * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setCanon($canon) { @@ -289,7 +288,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param string $identity * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setSignerIdentity($identity) { @@ -303,7 +302,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param bool $debug * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setDebugHeaders($debug) { @@ -346,7 +345,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param string $header_name * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function ignoreHeader($header_name) { @@ -360,7 +359,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function setHeaders(Swift_Mime_HeaderSet $headers) { @@ -392,7 +391,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_DomainKeySigner + * @return $this */ public function addSignature(Swift_Mime_HeaderSet $headers) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php index c75cb08a..ef8832fd 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php @@ -20,21 +20,21 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream * * @param string $header_name * - * @return Swift_Signers_HeaderSigner + * @return self */ public function ignoreHeader($header_name); /** * Prepare the Signer to get a new Body. * - * @return Swift_Signers_HeaderSigner + * @return self */ public function startBody(); /** * Give the signal that the body has finished streaming. * - * @return Swift_Signers_HeaderSigner + * @return self */ public function endBody(); @@ -43,7 +43,7 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream * * @param Swift_Mime_SimpleHeaderSet $headers * - * @return Swift_Signers_HeaderSigner + * @return self */ public function setHeaders(Swift_Mime_HeaderSet $headers); @@ -52,7 +52,7 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream * * @param Swift_Mime_HeaderSet $headers * - * @return Swift_Signers_HeaderSigner + * @return self */ public function addSignature(Swift_Mime_HeaderSet $headers); diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php index 3a35ad55..8fdbaa43 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php @@ -133,7 +133,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner * * @param int $time * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureTimestamp($time) { @@ -147,7 +147,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner * * @param int $time * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setSignatureExpiration($time) { @@ -161,7 +161,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner * * @param bool $debug * - * @return Swift_Signers_DKIMSigner + * @return $this */ public function setDebugHeaders($debug) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php index b267099a..d13c02e4 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php @@ -74,7 +74,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner * @param string $certificate * @param string $privateKey * - * @return Swift_Signers_SMimeSigner + * @return self */ public static function newInstance($certificate = null, $privateKey = null) { @@ -84,14 +84,14 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner /** * Set the certificate location to use for signing. * - * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php + * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php * * @param string $certificate * @param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead * @param int $signOptions Bitwise operator options for openssl_pkcs7_sign() * @param string $extraCerts A file containing intermediate certificates needed by the signing certificate * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null) { @@ -117,13 +117,13 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner /** * Set the certificate location to use for encryption. * - * @link http://www.php.net/manual/en/openssl.pkcs7.flags.php - * @link http://nl3.php.net/manual/en/openssl.ciphers.php + * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php + * @see http://nl3.php.net/manual/en/openssl.ciphers.php * * @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates. * @param int $cipher * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setEncryptCertificate($recipientCerts, $cipher = null) { @@ -169,7 +169,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner * * @param bool $signThenEncrypt * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function setSignThenEncrypt($signThenEncrypt = true) { @@ -189,7 +189,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner /** * Resets internal states. * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function reset() { @@ -201,7 +201,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner * * @param Swift_Message $message * - * @return Swift_Signers_SMimeSigner + * @return $this */ public function signMessage(Swift_Message $message) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php index 62516114..b97f01e7 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php @@ -49,7 +49,7 @@ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport * @param int $port * @param string $security * - * @return Swift_SmtpTransport + * @return self */ public static function newInstance($host = 'localhost', $port = 25, $security = null) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php index cf9bf78f..79c9b1f0 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php @@ -38,7 +38,7 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport * * @param Swift_Spool $spool * - * @return Swift_SpoolTransport + * @return self */ public static function newInstance(Swift_Spool $spool) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php index 0418750f..9412b1dc 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php @@ -131,7 +131,7 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt // We try to find if the next byte is part of a search pattern for ($j = 0; $j <= $this->_treeMaxLen; ++$j) { // We have a new byte for a search pattern - if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) { + if (isset($buffer[$p = $i + $j]) && isset($search_pos[$buffer[$p]])) { $search_pos = $search_pos[$buffer[$p]]; // We have a complete pattern, save, in case we don't find a better match later if (isset($search_pos[-1]) && $search_pos[-1] < $last_found diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php index d0db8b96..f64144af 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php @@ -42,6 +42,10 @@ class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter */ public function shouldBuffer($buffer) { + if ('' === $buffer) { + return false; + } + $endOfBuffer = substr($buffer, -1); foreach ((array) $this->_search as $needle) { if (false !== strpos($needle, $endOfBuffer)) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php index f4d9967a..60233f96 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php @@ -57,7 +57,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport * * @param string $domain * - * @return Swift_Transport_AbstractSmtpTransport + * @return $this */ public function setLocalDomain($domain) { @@ -396,7 +396,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport do { $line = $this->_buffer->readLine($seq); $response .= $line; - } while (null !== $line && false !== $line && ' ' != $line{3}); + } while (null !== $line && false !== $line && ' ' != $line[3]); } catch (Swift_TransportException $e) { $this->_throwException($e); } catch (Swift_IoException $e) { @@ -491,6 +491,9 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport */ public function __destruct() { - $this->stop(); + try { + $this->stop(); + } catch (Exception $e) { + } } } diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php index eb04acf0..83926585 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php @@ -296,9 +296,14 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es return explode('\\', $name); } - list($user, $domain) = explode('@', $name); + if (false !== strpos($name, '@')) { + list($user, $domain) = explode('@', $name); - return array($domain, $user); + return array($domain, $user); + } + + // no domain passed + return array('', $name); } /** @@ -361,11 +366,9 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es protected function getCorrectTimestamp($time) { // Get our timestamp (tricky!) - bcscale(0); - $time = number_format($time, 0, '.', ''); // save microtime to string - $time = bcadd($time, '11644473600000'); // add epoch time - $time = bcmul($time, 10000); // tenths of a microsecond. + $time = bcadd($time, '11644473600000', 0); // add epoch time + $time = bcmul($time, 10000, 0); // tenths of a microsecond. $binary = $this->si2bin($time, 64); // create 64 bit binary string $timestamp = ''; @@ -459,6 +462,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es } /** HELPER FUNCTIONS */ + /** * Create our security buffer depending on length and offset. * @@ -561,6 +565,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es } /** ENCRYPTION ALGORITHMS */ + /** * DES Encryption. * diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php index 4106df41..156e2cf5 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php @@ -63,7 +63,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param string $host * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setHost($host) { @@ -87,7 +87,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param int $port * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setPort($port) { @@ -111,7 +111,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param int $timeout seconds * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setTimeout($timeout) { @@ -136,7 +136,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param string $encryption * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setEncryption($encryption) { @@ -167,7 +167,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param array $options * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setStreamOptions($options) { @@ -191,7 +191,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param string $source * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setSourceIp($source) { @@ -215,7 +215,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo * * @param Swift_Transport_EsmtpHandler[] $handlers * - * @return Swift_Transport_EsmtpTransport + * @return $this */ public function setExtensionHandlers(array $handlers) { @@ -270,8 +270,6 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo return parent::executeCommand($command, $codes, $failures); } - // -- Mixin invocation code - /** Mixin handling method for ESMTP handlers */ public function __call($method, $args) { @@ -281,7 +279,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo )) { $return = call_user_func_array(array($handler, $method), $args); // Allow fluid method calls - if (is_null($return) && substr($method, 0, 3) == 'set') { + if (null === $return && substr($method, 0, 3) == 'set') { return $this; } else { return $return; diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php index 32a11efa..48ef4a70 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php @@ -77,7 +77,7 @@ class Swift_Transport_MailTransport implements Swift_Transport * * @param string $params * - * @return Swift_Transport_MailTransport + * @return $this */ public function setExtraParams($params) { @@ -164,11 +164,13 @@ class Swift_Transport_MailTransport implements Swift_Transport $headers = str_replace("\r\n", PHP_EOL, $headers); $subject = str_replace("\r\n", PHP_EOL, $subject); $body = str_replace("\r\n", PHP_EOL, $body); + $to = str_replace("\r\n", PHP_EOL, $to); } else { // Windows, using SMTP $headers = str_replace("\r\n.", "\r\n..", $headers); $subject = str_replace("\r\n.", "\r\n..", $subject); $body = str_replace("\r\n.", "\r\n..", $body); + $to = str_replace("\r\n.", "\r\n..", $to); } if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php index 34ac4ce3..6430d5f6 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php @@ -64,7 +64,7 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran * * @param string $command * - * @return Swift_Transport_SendmailTransport + * @return $this */ public function setCommand($command) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php index 55a79924..e4b87f34 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php @@ -35,7 +35,7 @@ class Swift_Transport_SpoolTransport implements Swift_Transport * * @param Swift_Spool $spool * - * @return Swift_Transport_SpoolTransport + * @return $this */ public function setSpool(Swift_Spool $spool) { diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php index 5134ea48..9f2fff4b 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php @@ -84,7 +84,6 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn if ($this->_stream) { stream_set_blocking($this->_stream, 1); } - } } $this->_params[$param] = $value; @@ -292,6 +291,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn 1 => array('pipe', 'w'), 2 => array('pipe', 'w'), ); + $pipes = array(); $this->_stream = proc_open($command, $descriptorSpec, $pipes); stream_set_blocking($pipes[2], 0); if ($err = stream_get_contents($pipes[2])) { diff --git a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php index 56169c92..d575e4f2 100644 --- a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php +++ b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php @@ -117,7 +117,7 @@ Swift_DependencyContainer::getInstance() // As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly. // see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629 ->register('mime.qpcontentencoder') - ->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') + ->asAliasOf(PHP_VERSION_ID >= 50407 ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder') ; unset($swift_mime_types); diff --git a/vendor/swiftmailer/swiftmailer/lib/preferences.php b/vendor/swiftmailer/swiftmailer/lib/preferences.php index e5195014..0b430e67 100644 --- a/vendor/swiftmailer/swiftmailer/lib/preferences.php +++ b/vendor/swiftmailer/swiftmailer/lib/preferences.php @@ -20,6 +20,6 @@ if (@is_writable($tmpDir = sys_get_temp_dir())) { // this should only be done when Swiftmailer won't use the native QP content encoder // see mime_deps.php -if (version_compare(phpversion(), '5.4.7', '<')) { +if (PHP_VERSION_ID < 50407) { $preferences->setQPDotEscape(false); } diff --git a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php index 21d89e83..71c5713b 100644 --- a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php +++ b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php @@ -7,7 +7,7 @@ */ class SwiftMailerSmokeTestCase extends SwiftMailerTestCase { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMOKE_TRANSPORT_TYPE')) { $this->markTestSkipped( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default b/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default index 68902d84..5717c98f 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default @@ -12,13 +12,6 @@ You can fill out only the parts you know and leave the other bits. */ - -/* - Defines: The path to a writable directory (a temporary dir). - Recommended: /tmp - */ -define('SWIFT_TMP_DIR', '/tmp'); - /* Defines: The name and port of a SMTP server you can connect to. Recommended: smtp.gmail.com:25 diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php index 0b5bbef4..49ad20a8 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php @@ -2,24 +2,15 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase { - private $_tmpDir; private $_testFile; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR')) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_tmpDir = SWIFT_TMP_DIR; - $this->_testFile = $this->_tmpDir.'/swift-test-file'.__CLASS__; + $this->_testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__; file_put_contents($this->_testFile, 'abcdefghijklm'); } - public function tearDown() + protected function tearDown() { unlink($this->_testFile); } @@ -50,18 +41,14 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T public function testFileCanBeWrittenTo() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->write('foobar'); $this->assertEquals('foobar', $file->read(8192)); } public function testReadingFromThenWritingToFile() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->write('foobar'); $this->assertEquals('foobar', $file->read(8192)); $file->write('zipbutton'); @@ -70,9 +57,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T public function testWritingToFileWithCanonicalization() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF'); $file->write("foo\r\nbar\r"); $file->write("\nzip\r\ntest\r"); @@ -80,11 +65,18 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T $this->assertEquals("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile)); } + public function testWritingWithFulleMessageLengthOfAMultipleOf8192() + { + $file = $this->_createFileStream($this->_testFile, true); + $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF'); + $file->write(''); + $file->flushBuffers(); + $this->assertEquals('', file_get_contents($this->_testFile)); + } + public function testBindingOtherStreamsMirrorsWriteOperations() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $is1 = $this->_createMockInputStream(); $is2 = $this->_createMockInputStream(); @@ -129,9 +121,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T public function testUnbindingStreamPreventsFurtherWrites() { - $file = $this->_createFileStream( - $this->_testFile, true - ); + $file = $this->_createFileStream($this->_testFile, true); $is1 = $this->_createMockInputStream(); $is2 = $this->_createMockInputStream(); @@ -155,8 +145,6 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T $file->write('y'); } - // -- Creation methods - private function _createFilter($search, $replace) { return new Swift_StreamFilters_StringReplacementFilter($search, $replace); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php index 8ce4a182..c13e5704 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex private $_factory; private $_prefix = 'Swift_CharacterReader_'; - public function setUp() + protected function setUp() { $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); } @@ -14,7 +14,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) { $reader = $this->_factory->getReaderFor($utf8); - $this->assertInstanceof($this->_prefix.'Utf8Reader', $reader); + $this->assertInstanceOf($this->_prefix.'Utf8Reader', $reader); } } @@ -32,7 +32,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -49,7 +49,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -74,7 +74,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -83,7 +83,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('ansi', 'ANSI') as $ansi) { $reader = $this->_factory->getReaderFor($ansi); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -92,7 +92,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('macintosh', 'MACINTOSH') as $mac) { $reader = $this->_factory->getReaderFor($mac); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -109,7 +109,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex foreach ($charsets as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -118,7 +118,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -127,7 +127,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('mik', 'MIK') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -136,7 +136,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('cork', 'CORK', 't1', 'T1') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(1, $reader->getInitialByteSize()); } } @@ -145,7 +145,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(2, $reader->getInitialByteSize()); } } @@ -154,7 +154,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(2, $reader->getInitialByteSize()); } } @@ -163,7 +163,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(4, $reader->getInitialByteSize()); } } @@ -172,7 +172,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex { foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) { $reader = $this->_factory->getReaderFor($charset); - $this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader); + $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader); $this->assertEquals(4, $reader->getInitialByteSize()); } } diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php index d8ba5264..bada5094 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestC private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_encoder = new Swift_Encoder_Base64Encoder(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php index 1da3b837..442d9a94 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php index 043ddf8c..bcb6b957 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_Test private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php index 6b06e2ee..5fab14ce 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php @@ -6,7 +6,7 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test private $_key1 = 'key1'; private $_key2 = 'key2'; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php index 392edde8..0e027c2d 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php @@ -6,21 +6,11 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC private $_key1; private $_key2; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR')) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - $this->_key1 = uniqid(microtime(true), true); $this->_key2 = uniqid(microtime(true), true); - $this->_cache = new Swift_KeyCache_DiskKeyCache( - new Swift_KeyCache_SimpleKeyCacheInputStream(), - SWIFT_TMP_DIR - ); + $this->_cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir()); } public function testStringDataCanBeSetAndFetched() diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php index 9372fbfd..5f4e9835 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php @@ -45,8 +45,6 @@ class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest ); } - // -- Private helpers - protected function _createMessage() { Swift_DependencyContainer::getInstance() diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php index e925367e..7353d9d6 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -109,8 +109,6 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase ); } - // -- Private helpers - protected function _createAttachment() { $entity = new Swift_Mime_Attachment( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php index 2a5c562b..a72f5ff4 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPU private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php index ecd7fcd1..0dfc4e22 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php @@ -9,7 +9,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH */ protected $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder(); @@ -65,7 +65,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH } /** - * @expectedException RuntimeException + * @expectedException \RuntimeException */ public function testCharsetChangeNotImplemented() { diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php index 1541b7ea..5eff4e2f 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php @@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUn private $_samplesDir; private $_encoder; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit'); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php index 84f7e03b..a383b584 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php @@ -5,13 +5,13 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_ private $_samplesDir; private $_factory; - public function setUp() + protected function setUp() { $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets'); $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); } - public function tearDown() + protected function tearDown() { Swift_Preferences::getInstance()->setQPDotEscape(false); } diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php index 8a04df6b..0f7aa728 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -122,8 +122,6 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase ); } - // -- Private helpers - protected function _createEmbeddedFile() { $entity = new Swift_Mime_EmbeddedFile( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php index 304867a4..e3fad6de 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php @@ -4,7 +4,7 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUni { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php index 8232fe63..a7f6fc51 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php @@ -7,7 +7,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase private $_grammar; private $_headers; - public function setUp() + protected function setUp() { $this->_cache = new Swift_KeyCache_ArrayKeyCache( new Swift_KeyCache_SimpleKeyCacheInputStream() @@ -113,8 +113,6 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase ); } - // -- Private helpers - protected function _createMimePart() { $entity = new Swift_Mime_MimePart( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php index cd6d910d..912768ee 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php @@ -2,7 +2,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset(null); //TODO: Test with the charset defined } @@ -1227,8 +1227,6 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase ); } - // -- Private helpers - protected function _createMessage() { return new Swift_Message(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php index dc0d0a1d..21abc131 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php @@ -6,7 +6,7 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e abstract protected function _initializeBuffer(); - public function setUp() + protected function setUp() { if (true == getenv('TRAVIS')) { $this->markTestSkipped( @@ -124,8 +124,6 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e $this->_buffer->write('y'); } - // -- Creation Methods - private function _createMockInputStream() { return $this->getMockBuilder('Swift_InputByteStream')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php index 51c998c6..4c3c7d3a 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php @@ -4,7 +4,7 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMTP_HOST')) { $this->markTestSkipped( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php index 0e2924eb..a37439d7 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php @@ -4,7 +4,7 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { if (!defined('SWIFT_SENDMAIL_PATH')) { $this->markTestSkipped( diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php index d550f818..59362b01 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php @@ -8,7 +8,7 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_ protected $_server; - public function setUp() + protected function setUp() { if (!defined('SWIFT_SMTP_HOST')) { $this->markTestSkipped( @@ -54,11 +54,11 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_ $line = $this->_buffer->readLine(0); } catch (Exception $e) { } - $this->assertInstanceof('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout'); + $this->assertInstanceOf('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout'); $this->assertRegExp('/Connection to .* Timed Out/', $e->getMessage()); } - public function tearDown() + protected function tearDown() { if ($this->_server) { stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR); diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php index 2863f965..32e0fe84 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php @@ -4,7 +4,7 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { $streams = stream_get_transports(); if (!in_array('ssl', $streams)) { diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php index 6fc85057..1053a877 100644 --- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php @@ -4,7 +4,7 @@ require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php'; class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest { - public function setUp() + protected function setUp() { $streams = stream_get_transports(); if (!in_array('tls', $streams)) { diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php index bd10c716..40b5a772 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php @@ -4,7 +4,7 @@ class Swift_Bug118Test extends \PHPUnit_Framework_TestCase { private $_message; - public function setUp() + protected function setUp() { $this->_message = new Swift_Message(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php index fdfa5302..7563f4d3 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php @@ -4,7 +4,7 @@ class Swift_Bug206Test extends \PHPUnit_Framework_TestCase { private $_factory; - public function setUp() + protected function setUp() { $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php index 9c76ceb3..768bf3d8 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php @@ -2,7 +2,7 @@ class Swift_Bug34Test extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset('utf-8'); } diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php index e07ee8f0..98999f04 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php @@ -2,7 +2,7 @@ class Swift_Bug35Test extends \PHPUnit_Framework_TestCase { - public function setUp() + protected function setUp() { Swift_Preferences::getInstance()->setCharset('utf-8'); } diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php index a8a9212c..9deae4f7 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php @@ -6,7 +6,7 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase private $_attFileName; private $_attFileType; - public function setUp() + protected function setUp() { $this->_attFileName = 'data.txt'; $this->_attFileType = 'text/plain'; @@ -181,8 +181,6 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase $this->assertPatternInStream($pattern, $streamB); } - // -- Helpers - public function assertPatternInStream($pattern, $stream, $message = '%s') { $string = ''; diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php index b9c33b09..48074f0e 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php @@ -5,23 +5,16 @@ class Swift_Bug51Test extends \SwiftMailerTestCase private $_attachmentFile; private $_outputFile; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_attachmentFile = SWIFT_TMP_DIR.'/attach.rand.bin'; + $this->_attachmentFile = sys_get_temp_dir().'/attach.rand.bin'; file_put_contents($this->_attachmentFile, ''); - $this->_outputFile = SWIFT_TMP_DIR.'/attach.out.bin'; + $this->_outputFile = sys_get_temp_dir().'/attach.out.bin'; file_put_contents($this->_outputFile, ''); } - public function tearDown() + protected function tearDown() { unlink($this->_attachmentFile); unlink($this->_outputFile); @@ -66,8 +59,6 @@ class Swift_Bug51Test extends \SwiftMailerTestCase } } - // -- Custom Assertions - public function assertAttachmentFromSourceMatches($attachmentData, $source) { $encHeader = 'Content-Transfer-Encoding: base64'; @@ -88,8 +79,6 @@ class Swift_Bug51Test extends \SwiftMailerTestCase $this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64)); } - // -- Creation Methods - private function _fillFileWithRandomBytes($byteCount, $file) { // I was going to use dd with if=/dev/random but this way seems more diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php index 4b804537..d58242fb 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php @@ -4,7 +4,7 @@ class Swift_Bug71Test extends \PHPUnit_Framework_TestCase { private $_message; - public function setUp() + protected function setUp() { $this->_message = new Swift_Message('test'); } diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php index c2b12cb4..899083c0 100644 --- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php @@ -6,25 +6,18 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase private $_outputFile; private $_encoder; - public function setUp() + protected function setUp() { - if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) { - $this->markTestSkipped( - 'Cannot run test without a writable directory to use ('. - 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' - ); - } - - $this->_inputFile = SWIFT_TMP_DIR.'/in.bin'; + $this->_inputFile = sys_get_temp_dir().'/in.bin'; file_put_contents($this->_inputFile, ''); - $this->_outputFile = SWIFT_TMP_DIR.'/out.bin'; + $this->_outputFile = sys_get_temp_dir().'/out.bin'; file_put_contents($this->_outputFile, ''); $this->_encoder = $this->_createEncoder(); } - public function tearDown() + protected function tearDown() { unlink($this->_inputFile); unlink($this->_outputFile); @@ -44,8 +37,6 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase ); } - // -- Custom Assertions - public function assertMaxLineLength($length, $filePath, $message = '%s') { $lines = file($filePath); @@ -54,8 +45,6 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase } } - // -- Creation Methods - private function _fillFileWithRandomBytes($byteCount, $file) { // I was going to use dd with if=/dev/random but this way seems more diff --git a/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php b/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php index e2cf86a5..159c2ae1 100644 --- a/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php +++ b/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php @@ -32,27 +32,35 @@ class MimeEntityFixture implements Swift_Mime_MimeEntity public function getId() { } + public function getHeaders() { } + public function getBody() { } + public function setBody($body, $contentType = null) { } + public function toByteStream(Swift_InputByteStream $is) { } + public function charsetChanged($charset) { } + public function encoderChanged(Swift_Mime_ContentEncoder $encoder) { } + public function getChildren() { } + public function setChildren(array $children) { } diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php index c3b61c39..5a4ccde3 100644 --- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php @@ -7,7 +7,7 @@ class Swift_Smoke_AttachmentSmokeTest extends SwiftMailerSmokeTestCase { private $_attFile; - public function setUp() + protected function setUp() { parent::setup(); // For skip $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php index dca14341..3b13cc5d 100644 --- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php @@ -7,7 +7,7 @@ class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase { private $_attFile; - public function setUp() + protected function setUp() { $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; } diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php index fafd7271..b9ebef52 100644 --- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php @@ -7,7 +7,7 @@ class Swift_Smoke_InternationalSmokeTest extends SwiftMailerSmokeTestCase { private $_attFile; - public function setUp() + protected function setUp() { parent::setup(); // For skip $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php index 2a50b190..60ebb661 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php @@ -194,8 +194,6 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase $bs->write('y'); } - // -- Creation Methods - private function _createArrayStream($input) { return new Swift_ByteStream_ArrayByteStream($input); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php index 41f8f703..0d567360 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php @@ -18,7 +18,7 @@ class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCas private $_reader; - public function setUp() + protected function setUp() { $this->_reader = new Swift_CharacterReader_UsAsciiReader(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php index 34e9c91d..ec17eebe 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php @@ -4,7 +4,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase { private $_reader; - public function setUp() + protected function setUp() { $this->_reader = new Swift_CharacterReader_Utf8Reader(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php index cbd412bd..977051e9 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php @@ -335,8 +335,6 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas $this->assertFalse($stream->read(1)); } - // -- Creation methods - private function _getReader() { return $this->getMockery('Swift_CharacterReader'); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php index 70690e2d..ccd14f6f 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php @@ -4,6 +4,7 @@ class One { public $arg1; public $arg2; + public function __construct($arg1 = null, $arg2 = null) { $this->arg1 = $arg1; @@ -15,7 +16,7 @@ class Swift_DependencyContainerTest extends \PHPUnit_Framework_TestCase { private $_container; - public function setUp() + protected function setUp() { $this->_container = new Swift_DependencyContainer(); } @@ -40,7 +41,7 @@ class Swift_DependencyContainerTest extends \PHPUnit_Framework_TestCase public function testRegisterAndLookupNewInstance() { $this->_container->register('one')->asNewInstanceOf('One'); - $this->assertInstanceof('One', $this->_container->lookup('one')); + $this->assertInstanceOf('One', $this->_container->lookup('one')); } public function testHasReturnsTrueForRegisteredInstance() @@ -60,7 +61,7 @@ class Swift_DependencyContainerTest extends \PHPUnit_Framework_TestCase public function testRegisterAndLookupSharedInstance() { $this->_container->register('one')->asSharedInstanceOf('One'); - $this->assertInstanceof('One', $this->_container->lookup('one')); + $this->assertInstanceOf('One', $this->_container->lookup('one')); } public function testHasReturnsTrueForSharedInstance() diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php index 1e712fe5..b89eb9f5 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php @@ -4,7 +4,7 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Encoder_Base64Encoder(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php index 0bf4d181..6740f22c 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php @@ -385,8 +385,6 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase ); } - // -- Creation methods - private function _createCharStream() { return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php index 3849e09e..a78bc3a3 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php @@ -22,8 +22,6 @@ class Swift_Events_CommandEventTest extends \PHPUnit_Framework_TestCase $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, $command, $successCodes = array()) { return new Swift_Events_CommandEvent($source, $command, $successCodes); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php index 62a91be5..0cfe3caa 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php @@ -25,8 +25,6 @@ class Swift_Events_EventObjectTest extends \PHPUnit_Framework_TestCase $this->assertTrue($evt->bubbleCancelled()); } - // -- Creation Methods - private function _createEvent($source) { return new Swift_Events_EventObject($source); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php index 1028e8e9..6f611acb 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php @@ -26,8 +26,6 @@ class Swift_Events_ResponseEventTest extends \PHPUnit_Framework_TestCase $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, $response, $result) { return new Swift_Events_ResponseEvent($source, $response, $result); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php index 8a3fe92f..c4a6a7ef 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php @@ -79,8 +79,6 @@ class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array(), $evt->getFailedRecipients()); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source, Swift_Mime_Message $message) { diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php index fdc9c138..3f063ff7 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php @@ -4,7 +4,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase { private $_dispatcher; - public function setUp() + protected function setUp() { $this->_dispatcher = new Swift_Events_SimpleEventDispatcher(); } @@ -14,7 +14,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); $evt = $this->_dispatcher->createSendEvent($transport, $message); - $this->assertInstanceof('Swift_Events_SendEvent', $evt); + $this->assertInstanceOf('Swift_Events_SendEvent', $evt); $this->assertSame($message, $evt->getMessage()); $this->assertSame($transport, $evt->getTransport()); } @@ -23,7 +23,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase { $buf = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createCommandEvent($buf, "FOO\r\n", array(250)); - $this->assertInstanceof('Swift_Events_CommandEvent', $evt); + $this->assertInstanceOf('Swift_Events_CommandEvent', $evt); $this->assertSame($buf, $evt->getSource()); $this->assertEquals("FOO\r\n", $evt->getCommand()); $this->assertEquals(array(250), $evt->getSuccessCodes()); @@ -33,7 +33,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase { $buf = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createResponseEvent($buf, "250 Ok\r\n", true); - $this->assertInstanceof('Swift_Events_ResponseEvent', $evt); + $this->assertInstanceOf('Swift_Events_ResponseEvent', $evt); $this->assertSame($buf, $evt->getSource()); $this->assertEquals("250 Ok\r\n", $evt->getResponse()); $this->assertTrue($evt->isValid()); @@ -43,7 +43,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase { $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $evt = $this->_dispatcher->createTransportChangeEvent($transport); - $this->assertInstanceof('Swift_Events_TransportChangeEvent', $evt); + $this->assertInstanceOf('Swift_Events_TransportChangeEvent', $evt); $this->assertSame($transport, $evt->getSource()); } @@ -52,7 +52,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase $transport = $this->getMockBuilder('Swift_Transport')->getMock(); $ex = new Swift_TransportException(''); $evt = $this->_dispatcher->createTransportExceptionEvent($transport, $ex); - $this->assertInstanceof('Swift_Events_TransportExceptionEvent', $evt); + $this->assertInstanceOf('Swift_Events_TransportExceptionEvent', $evt); $this->assertSame($transport, $evt->getSource()); $this->assertSame($ex, $evt->getException()); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php index 8d7b2376..a260ccb5 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php @@ -18,8 +18,6 @@ class Swift_Events_TransportChangeEventTest extends \PHPUnit_Framework_TestCase $this->assertEquals($transport, $ref); } - // -- Creation Methods - private function _createEvent(Swift_Transport $source) { return new Swift_Events_TransportChangeEvent($source); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php index 0324cdb8..731dfad5 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php @@ -24,8 +24,6 @@ class Swift_Events_TransportExceptionEventTest extends \PHPUnit_Framework_TestCa ); } - // -- Creation Methods - private function _createEvent(Swift_Transport $transport, Swift_TransportException $ex) { return new Swift_Events_TransportExceptionEvent($transport, $ex); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php index 634b7ad0..f2ed5dd6 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php @@ -218,8 +218,6 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase $this->assertFalse($cache->hasKey($this->_key1, 'bar')); } - // -- Creation methods - private function _createCache($is) { return new Swift_KeyCache_ArrayKeyCache($is); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php index 389264fb..74951a70 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php @@ -123,8 +123,6 @@ class Swift_MailerTest extends \SwiftMailerTestCase $mailer->registerPlugin($plugin); } - // -- Creation methods - private function _createPlugin() { return $this->getMockery('Swift_Events_EventListener')->shouldIgnoreMissing(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php index 00039f10..35a568c6 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php @@ -54,7 +54,6 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase $this->assertNotEquals($id_1, $id_2, 'Message Ids are the same'); } - // -- Private helpers protected function _recursiveObjectCloningCheck($obj1, $obj2, $obj1_clone) { $obj1_properties = (array) $obj1; diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php index ffe9cd8d..3efe6ec4 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php @@ -740,6 +740,46 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase ); } + public function testOrderingEqualContentTypesMaintainsOriginalOrdering() + { + $firstChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 1', + 'text/plain' + ); + $secondChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 2', + 'text/plain' + ); + $headers = $this->_createHeaderSet(array(), false); + $headers->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n"); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBoundary('xxx'); + $entity->setChildren(array($firstChild, $secondChild)); + + $this->assertEquals( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n". + "\r\n\r\n--xxx\r\n". + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 1'. + "\r\n\r\n--xxx\r\n". + "Content-Type: text/plain\r\n". + "\r\n". + 'PART 2'. + "\r\n\r\n--xxx--\r\n", + $entity->toString() + ); + } + public function testUnsettingChildrenRestoresContentType() { $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); @@ -948,8 +988,6 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase ); } - // -- Private helpers - abstract protected function _createEntity($headers, $encoder, $cache); protected function _createChild($level = null, $string = '', $stub = true) diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php index bd2499c0..2c1e581e 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php @@ -282,8 +282,6 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest ); } - // -- Private helpers - protected function _createEntity($headers, $encoder, $cache) { return $this->_createAttachment($headers, $encoder, $cache); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php index 0442af33..1571fce3 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php @@ -4,7 +4,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes { private $_encoder; - public function setUp() + protected function setUp() { $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php index b523a64c..ca44e11a 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php @@ -154,8 +154,6 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest $this->assertEquals($expected, $collection->content); } - // -- Private helpers - private function _getEncoder($name, $canonical = false) { return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php index 81992891..7762bbe9 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php @@ -491,8 +491,6 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas ); } - // -- Creation Methods - private function _createCharacterStream($stub = false) { return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php index f4c3ac89..3a1fc512 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php @@ -43,8 +43,6 @@ class Swift_Mime_EmbeddedFileTest extends Swift_Mime_AttachmentTest ); } - // -- Private helpers - protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array()) { return $this->_createEmbeddedFile($headers, $encoder, $cache, $mimeTypes); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php index 54a792a6..b5a10fe4 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php @@ -209,8 +209,6 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase $this->assertEquals($output, $encoder->encodeString($input)); } - // -- Creation Methods - private function _createEncoder($charStream) { return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php index 0f3fe145..cd027cc8 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php @@ -371,8 +371,6 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase $this->assertEquals('utf-8', $header->getParameter('charset')); } - // -- Private helper - private function _getHeader($name, $encoder, $paramEncoder) { $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder, diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php index 7e91134f..738ac685 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php @@ -218,8 +218,6 @@ class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest ); } - // -- Private helpers - //abstract protected function _createEntity($headers, $encoder, $cache) { diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php index 4ee62963..6a87abfa 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php @@ -4,7 +4,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase { private $_factory; - public function setUp() + protected function setUp() { $this->_factory = $this->_createFactory(); } @@ -12,7 +12,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testMailboxHeaderIsCorrectType() { $header = $this->_factory->createMailboxHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_MailboxHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_MailboxHeader', $header); } public function testMailboxHeaderHasCorrectName() @@ -32,7 +32,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testDateHeaderHasCorrectType() { $header = $this->_factory->createDateHeader('X-Date'); - $this->assertInstanceof('Swift_Mime_Headers_DateHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_DateHeader', $header); } public function testDateHeaderHasCorrectName() @@ -50,7 +50,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testTextHeaderHasCorrectType() { $header = $this->_factory->createTextHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_UnstructuredHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_UnstructuredHeader', $header); } public function testTextHeaderHasCorrectName() @@ -68,7 +68,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testParameterizedHeaderHasCorrectType() { $header = $this->_factory->createParameterizedHeader('X-Foo'); - $this->assertInstanceof('Swift_Mime_Headers_ParameterizedHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_ParameterizedHeader', $header); } public function testParameterizedHeaderHasCorrectName() @@ -94,7 +94,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testIdHeaderHasCorrectType() { $header = $this->_factory->createIdHeader('X-ID'); - $this->assertInstanceof('Swift_Mime_Headers_IdentificationHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_IdentificationHeader', $header); } public function testIdHeaderHasCorrectName() @@ -112,7 +112,7 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase public function testPathHeaderHasCorrectType() { $header = $this->_factory->createPathHeader('X-Path'); - $this->assertInstanceof('Swift_Mime_Headers_PathHeader', $header); + $this->assertInstanceOf('Swift_Mime_Headers_PathHeader', $header); } public function testPathHeaderHasCorrectName() @@ -143,8 +143,6 @@ class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase $factory->charsetChanged('utf-8'); } - // -- Creation methods - private function _createFactory($encoder = null, $paramEncoder = null) { return new Swift_Mime_SimpleHeaderFactory( diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php index 9682f37e..bed1c137 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php @@ -500,7 +500,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase { $set = $this->_createSet($this->_createFactory()); $instance = $set->newInstance(); - $this->assertInstanceof('Swift_Mime_HeaderSet', $instance); + $this->assertInstanceOf('Swift_Mime_HeaderSet', $instance); } public function testToStringJoinsHeadersTogether() @@ -709,8 +709,6 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase $set->setCharset('utf-8'); } - // -- Creation methods - private function _createSet($factory) { return new Swift_Mime_SimpleHeaderSet($factory); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php index 267d2764..e5d225cb 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php @@ -809,8 +809,6 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest ); } - // -- Private helpers - //abstract protected function _createEntity($headers, $encoder, $cache) { diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php index b54d7f87..fa2a8d48 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php @@ -2,8 +2,6 @@ class Swift_Mime_SimpleMimeEntityTest extends Swift_Mime_AbstractMimeEntityTest { - // -- Private helpers - protected function _createEntity($headerFactory, $encoder, $cache) { return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, new Swift_Mime_Grammar()); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php index 8f014405..463e4ebb 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php @@ -71,8 +71,6 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase } } - // -- Creation Methods - private function _createTransport() { return $this->getMockBuilder('Swift_Transport')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php index bb01a92c..869cfc80 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php @@ -6,7 +6,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa private $_bytes = 0; - public function setUp() + protected function setUp() { $this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin(); } @@ -69,8 +69,6 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa $this->assertEquals(12, $this->_monitor->getBytesOut()); } - // -- Creation Methods - private function _createSendEvent($message) { $evt = $this->getMockBuilder('Swift_Events_SendEvent') diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php index 7f4cdef1..8019dfbd 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php @@ -177,8 +177,6 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase $plugin->sendPerformed($evt); } - // -- Creation methods - private function _createMessage($headers, $to = array(), $from = null, $subject = null, $body = null) { diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php index 15d7014b..bfe4cb70 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php @@ -123,8 +123,6 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase } } - // -- Creation Methods - private function _createLogger() { return $this->getMockBuilder('Swift_Plugins_Logger')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php index d7c55afc..cbd368f3 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php @@ -69,8 +69,6 @@ class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit_Framework_TestCase $plugin->beforeTransportStarted($evt); } - // -- Creation Methods - private function _createTransport() { return $this->getMockBuilder('Swift_Transport')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php index 4cc7e89f..bfd5669c 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php @@ -169,8 +169,6 @@ class Swift_Plugins_RedirectingPluginTest extends \PHPUnit_Framework_TestCase $this->assertEquals($message->getBcc(), array('fabien@example.com' => 'Fabien')); } - // -- Creation Methods - private function _createSendEvent(Swift_Mime_Message $message) { $evt = $this->getMockBuilder('Swift_Events_SendEvent') diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php index 81018830..5ba5d5cc 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php @@ -69,8 +69,6 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase $plugin->sendPerformed($evt); } - // -- Creation Methods - private function _createMessage() { return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php index 33dcc750..20aae571 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php @@ -5,7 +5,7 @@ class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit_Framework_TestCas private $_hitReporter; private $_message; - public function setUp() + protected function setUp() { $this->_hitReporter = new Swift_Plugins_Reporters_HitReporter(); $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php index a6c6a277..fb0bc975 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php @@ -5,7 +5,7 @@ class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit_Framework_TestCa private $_html; private $_message; - public function setUp() + protected function setUp() { $this->_html = new Swift_Plugins_Reporters_HtmlReporter(); $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php index a50f14f9..309f5063 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php @@ -66,8 +66,6 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase } } - // -- Creation Methods - private function _createSleeper() { return $this->getMockery('Swift_Plugins_Sleeper'); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php index 13c1b4c1..5eda2232 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php @@ -2,12 +2,10 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase { - public function setUp() + protected function setUp() { - if (version_compare(phpversion(), '5.4', '<') && !defined('OPENSSL_ALGO_SHA256')) { - $this->markTestSkipped( - 'skipping because of https://bugs.php.net/bug.php?id=61421' - ); + if (PHP_VERSION_ID < 50400 && !defined('OPENSSL_ALGO_SHA256')) { + $this->markTestSkipped('skipping because of https://bugs.php.net/bug.php?id=61421'); } } @@ -29,12 +27,13 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase $signer->addSignature($headers); } - // Default Signing - public function testSigningDefaults() + // SHA1 Signing + public function testSigningSHA1() { $headerSet = $this->_createHeaderSet(); $messageContent = 'Hello World'; $signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector'); + $signer->setHashAlgorithm('rsa-sha1'); $signer->setSignatureTimestamp('1299879181'); $altered = $signer->getAlteredHeaders(); $this->assertEquals(array('DKIM-Signature'), $altered); @@ -147,7 +146,6 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase $this->assertEquals($sig->getValue(), 'v=1; a=rsa-sha256; bh=f+W+hu8dIhf2VAni89o8lF6WKTXi7nViA4RrMdpD5/U=; d=dummy.nxdomain.be; h=; i=@dummy.nxdomain.be; s=dummySelector; c=simple/relaxed; t=1299879181; b=M5eomH/zamyzix9kOes+6YLzQZxuJdBP4x3nP9zF2N26eMLG2/cBKbnNyqiOTDhJdYfWPbLIa 1CWnjST0j5p4CpeOkGYuiE+M4TWEZwhRmRWootlPO3Ii6XpbBJKFk1o9zviS7OmXblUUE4aqb yRSIMDhtLdCK5GlaCneFLN7RQ='); } - // -- Creation Methods private function _createHeaderSet() { $cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream()); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php index 00e48c13..ce99bc63 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/OpenDKIMSignerTest.php @@ -5,7 +5,7 @@ */ class Swift_Signers_OpenDKIMSignerTest extends \SwiftMailerTestCase { - public function setUp() + protected function setUp() { if (!extension_loaded('opendkim')) { $this->markTestSkipped( diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php index df745ef2..5069c1f5 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php @@ -9,7 +9,7 @@ class Swift_Signers_SMimeSignerTest extends \PHPUnit_Framework_TestCase protected $samplesDir; - public function setUp() + protected function setUp() { $this->replacementFactory = Swift_DependencyContainer::getInstance() ->lookup('transport.replacementfactory'); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php index e4d4f48d..c85bdc1e 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php @@ -122,8 +122,6 @@ class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit_Framew ); } - // -- Creation methods - private function _createFilter($search, $replace) { return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php index bd44f5c7..c14d5dc7 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php @@ -5,7 +5,7 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr public function testInstancesOfStringReplacementFilterAreCreated() { $factory = $this->_createFactory(); - $this->assertInstanceof( + $this->assertInstanceOf( 'Swift_StreamFilters_StringReplacementFilter', $factory->createFilter('a', 'b') ); @@ -29,8 +29,6 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr ); } - // -- Creation methods - private function _createFactory() { return new Swift_StreamFilters_StringReplacementFilterFactory(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php index 7a98a2f2..681e2352 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php @@ -46,7 +46,11 @@ class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit_Framework ); } - // -- Creation methods + public function testShouldBufferReturnsFalseOnEmptyBuffer() + { + $filter = $this->_createFilter("\r\n", "\n"); + $this->assertFalse($filter->shouldBuffer('')); + } private function _createFilter($search, $replace) { diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php index 121aaba0..81bda4f0 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php @@ -551,8 +551,6 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp $smtp->start(); } - // -- Creation Methods - protected function _createEventDispatcher($stub = true) { return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php index f64b0716..aca03a92 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \SwiftMailerTe { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -57,8 +57,6 @@ class Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \SwiftMailerTe ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_CramMd5Authenticator(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php index fc6e8069..13f0209a 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest extends \SwiftMailerTest { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -57,8 +57,6 @@ class Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest extends \SwiftMailerTest ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_LoginAuthenticator(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php index 09ace834..911d2585 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php @@ -6,12 +6,10 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC private $_message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000'; private $_message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'; - public function setUp() + protected function setUp() { if (!function_exists('openssl_encrypt') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) { - $this->markTestSkipped( - 'One of the required functions is not available.' - ); + $this->markTestSkipped('One of the required functions is not available.'); } } @@ -26,9 +24,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); $message1 = $this->_invokePrivateMethod('createMessage1', $login); - $this->assertEquals($this->_message1, bin2hex($message1), - '%s: We send the smallest ntlm message which should never fail.' - ); + $this->assertEquals($this->_message1, bin2hex($message1), '%s: We send the smallest ntlm message which should never fail.'); } public function testLMv1Generator() @@ -40,9 +36,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); $lmv1Result = $this->_invokePrivateMethod('createLMPassword', $login, array($password, $this->hex2bin($challenge))); - $this->assertEquals($lmv1, bin2hex($lmv1Result), - '%s: The keys should be the same cause we use the same values to generate them.' - ); + $this->assertEquals($lmv1, bin2hex($lmv1Result), '%s: The keys should be the same cause we use the same values to generate them.'); } public function testLMv2Generator() @@ -56,9 +50,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); $lmv2Result = $this->_invokePrivateMethod('createLMv2Password', $login, array($password, $username, $domain, $this->hex2bin($challenge), $this->hex2bin('ffffff0011223344'))); - $this->assertEquals($lmv2, bin2hex($lmv2Result), - '%s: The keys should be the same cause we use the same values to generate them.' - ); + $this->assertEquals($lmv2, bin2hex($lmv2Result), '%s: The keys should be the same cause we use the same values to generate them.'); } public function testMessage3v1Generator() @@ -73,9 +65,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); - $this->assertEquals($message3T, bin2hex($message3), - '%s: We send the same information as the example is created with so this should be the same' - ); + $this->assertEquals($message3T, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same'); } public function testMessage3v2Generator() @@ -89,9 +79,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse))); - $this->assertEquals($this->_message3, bin2hex($message3), - '%s: We send the same information as the example is created with so this should be the same' - ); + $this->assertEquals($this->_message3, bin2hex($message3), '%s: We send the same information as the example is created with so this should be the same'); } public function testGetDomainAndUsername() @@ -101,12 +89,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('DOMAIN', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithExtension() @@ -116,12 +100,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('domain.com', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithAtSymbol() @@ -131,12 +111,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('DOMAIN', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testGetDomainAndUsernameWithAtSymbolAndExtension() @@ -146,12 +122,19 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $login = $this->_getAuthenticator(); list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); - $this->assertEquals('domain.com', $domain, - '%s: the fetched domain did not match' - ); - $this->assertEquals('user', $user, - '%s: the fetched user did not match' - ); + $this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); + } + + public function testGetDomainAndUsernameWithoutDomain() + { + $username = 'user'; + + $login = $this->_getAuthenticator(); + list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username)); + + $this->assertEquals('', $domain, '%s: the fetched domain did not match'); + $this->assertEquals('user', $user, '%s: the fetched user did not match'); } public function testSuccessfulAuthentication() @@ -174,9 +157,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC $this->_invokePrivateMethod('createMessage3', $ntlm, array($domain, $username, $this->hex2bin('4d0045004d00420045005200'), $this->hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), $this->hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000')) ))."\r\n", array(235)); - $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), - '%s: The buffer accepted all commands authentication should succeed' - ); + $this->assertTrue($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: The buffer accepted all commands authentication should succeed'); } public function testAuthenticationFailureSendRsetAndReturnFalse() @@ -197,12 +178,9 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC ->once() ->with("RSET\r\n", array(250)); - $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), - '%s: Authentication fails, so RSET should be sent' - ); + $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: Authentication fails, so RSET should be sent'); } - // -- Private helpers private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_NTLMAuthenticator(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php index 4fe9db80..73a90627 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTest { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -60,8 +60,6 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTest ); } - // -- Private helpers - private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_PlainAuthenticator(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php index 64327d47..d52328a1 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php @@ -4,7 +4,7 @@ class Swift_Transport_Esmtp_AuthHandlerTest extends \SwiftMailerTestCase { private $_agent; - public function setUp() + protected function setUp() { $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } @@ -148,8 +148,6 @@ class Swift_Transport_Esmtp_AuthHandlerTest extends \SwiftMailerTestCase $auth->afterEhlo($this->_agent); } - // -- Private helpers - private function _createHandler($authenticators) { return new Swift_Transport_Esmtp_AuthHandler($authenticators); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php index 8d6321f3..166e1605 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php @@ -5,6 +5,7 @@ require_once dirname(__DIR__).'/EsmtpTransportTest.php'; interface Swift_Transport_EsmtpHandlerMixin extends Swift_Transport_EsmtpHandler { public function setUsername($user); + public function setPassword($pass); } diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php index 8d80f359..e56e37f4 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php @@ -503,8 +503,6 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase $transport->registerPlugin($plugin); } - // -- Private helpers - private function _getTransport(array $transports) { $transport = new Swift_Transport_FailoverTransport(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php index cc7297b1..f6bb8199 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php @@ -719,7 +719,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase public function varsAreReferences(&$ref1, &$ref2) { if (is_object($ref2)) { - return ($ref1 === $ref2); + return $ref1 === $ref2; } if ($ref1 !== $ref2) { return false; @@ -734,8 +734,6 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase return $isRef; } - // -- Private helpers - private function _getTransport(array $transports) { $transport = new Swift_Transport_LoadBalancedTransport(); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php index 96e9943d..6672a3d1 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php @@ -421,7 +421,7 @@ class Swift_Transport_MailTransportTest extends \SwiftMailerTestCase } /** - * @expectedException Swift_TransportException + * @expectedException \Swift_TransportException * @expectedExceptionMessage Cannot send message without a recipient */ public function testExceptionWhenNoRecipients() @@ -465,8 +465,6 @@ class Swift_Transport_MailTransportTest extends \SwiftMailerTestCase $transport->send($message); } - // -- Creation Methods - private function _createTransport($invoker, $dispatcher) { return new Swift_Transport_MailTransport($invoker, $dispatcher); diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php index 6108a954..5109b56b 100644 --- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php @@ -26,8 +26,6 @@ class Swift_Transport_StreamBufferTest extends \PHPUnit_Framework_TestCase $buffer->setWriteTranslations(array('x' => 'y', 'a' => 'b')); } - // -- Creation methods - private function _createBuffer($replacementFactory) { return new Swift_Transport_StreamBuffer($replacementFactory); diff --git a/vendor/symfony/finder/.gitignore b/vendor/symfony/finder/.gitignore new file mode 100644 index 00000000..c49a5d8d --- /dev/null +++ b/vendor/symfony/finder/.gitignore @@ -0,0 +1,3 @@ +vendor/ +composer.lock +phpunit.xml diff --git a/vendor/symfony/finder/CHANGELOG.md b/vendor/symfony/finder/CHANGELOG.md new file mode 100644 index 00000000..53c34be8 --- /dev/null +++ b/vendor/symfony/finder/CHANGELOG.md @@ -0,0 +1,55 @@ +CHANGELOG +========= + +3.4.0 +----- + + * deprecated `Symfony\Component\Finder\Iterator\FilterIterator` + * added Finder::hasResults() method to check if any results were found + +3.3.0 +----- + + * added double-star matching to Glob::toRegex() + +3.0.0 +----- + + * removed deprecated classes + +2.8.0 +----- + + * deprecated adapters and related classes + +2.5.0 +----- + * added support for GLOB_BRACE in the paths passed to Finder::in() + +2.3.0 +----- + + * added a way to ignore unreadable directories (via Finder::ignoreUnreadableDirs()) + * unified the way subfolders that are not executable are handled by always throwing an AccessDeniedException exception + +2.2.0 +----- + + * added Finder::path() and Finder::notPath() methods + * added finder adapters to improve performance on specific platforms + * added support for wildcard characters (glob patterns) in the paths passed + to Finder::in() + +2.1.0 +----- + + * added Finder::sortByAccessedTime(), Finder::sortByChangedTime(), and + Finder::sortByModifiedTime() + * added Countable to Finder + * added support for an array of directories as an argument to + Finder::exclude() + * added searching based on the file content via Finder::contains() and + Finder::notContains() + * added support for the != operator in the Comparator + * [BC BREAK] filter expressions (used for file name and content) are no more + considered as regexps but glob patterns when they are enclosed in '*' or '?' diff --git a/vendor/symfony/finder/Comparator/Comparator.php b/vendor/symfony/finder/Comparator/Comparator.php new file mode 100644 index 00000000..4f5e1ffe --- /dev/null +++ b/vendor/symfony/finder/Comparator/Comparator.php @@ -0,0 +1,98 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Comparator; + +/** + * Comparator. + * + * @author Fabien Potencier + */ +class Comparator +{ + private $target; + private $operator = '=='; + + /** + * Gets the target value. + * + * @return string The target value + */ + public function getTarget() + { + return $this->target; + } + + /** + * Sets the target value. + * + * @param string $target The target value + */ + public function setTarget($target) + { + $this->target = $target; + } + + /** + * Gets the comparison operator. + * + * @return string The operator + */ + public function getOperator() + { + return $this->operator; + } + + /** + * Sets the comparison operator. + * + * @param string $operator A valid operator + * + * @throws \InvalidArgumentException + */ + public function setOperator($operator) + { + if (!$operator) { + $operator = '=='; + } + + if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) { + throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator)); + } + + $this->operator = $operator; + } + + /** + * Tests against the target. + * + * @param mixed $test A test value + * + * @return bool + */ + public function test($test) + { + switch ($this->operator) { + case '>': + return $test > $this->target; + case '>=': + return $test >= $this->target; + case '<': + return $test < $this->target; + case '<=': + return $test <= $this->target; + case '!=': + return $test != $this->target; + } + + return $test == $this->target; + } +} diff --git a/vendor/symfony/finder/Comparator/DateComparator.php b/vendor/symfony/finder/Comparator/DateComparator.php new file mode 100644 index 00000000..3de43ef4 --- /dev/null +++ b/vendor/symfony/finder/Comparator/DateComparator.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Comparator; + +/** + * DateCompare compiles date comparisons. + * + * @author Fabien Potencier + */ +class DateComparator extends Comparator +{ + /** + * @param string $test A comparison string + * + * @throws \InvalidArgumentException If the test is not understood + */ + public function __construct($test) + { + if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) { + throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test)); + } + + try { + $date = new \DateTime($matches[2]); + $target = $date->format('U'); + } catch (\Exception $e) { + throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2])); + } + + $operator = isset($matches[1]) ? $matches[1] : '=='; + if ('since' === $operator || 'after' === $operator) { + $operator = '>'; + } + + if ('until' === $operator || 'before' === $operator) { + $operator = '<'; + } + + $this->setOperator($operator); + $this->setTarget($target); + } +} diff --git a/vendor/symfony/finder/Comparator/NumberComparator.php b/vendor/symfony/finder/Comparator/NumberComparator.php new file mode 100644 index 00000000..f62c0e57 --- /dev/null +++ b/vendor/symfony/finder/Comparator/NumberComparator.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Comparator; + +/** + * NumberComparator compiles a simple comparison to an anonymous + * subroutine, which you can call with a value to be tested again. + * + * Now this would be very pointless, if NumberCompare didn't understand + * magnitudes. + * + * The target value may use magnitudes of kilobytes (k, ki), + * megabytes (m, mi), or gigabytes (g, gi). Those suffixed + * with an i use the appropriate 2**n version in accordance with the + * IEC standard: http://physics.nist.gov/cuu/Units/binary.html + * + * Based on the Perl Number::Compare module. + * + * @author Fabien Potencier PHP port + * @author Richard Clamp Perl version + * @copyright 2004-2005 Fabien Potencier + * @copyright 2002 Richard Clamp + * + * @see http://physics.nist.gov/cuu/Units/binary.html + */ +class NumberComparator extends Comparator +{ + /** + * @param string|int $test A comparison string or an integer + * + * @throws \InvalidArgumentException If the test is not understood + */ + public function __construct($test) + { + if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) { + throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test)); + } + + $target = $matches[2]; + if (!is_numeric($target)) { + throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target)); + } + if (isset($matches[3])) { + // magnitude + switch (strtolower($matches[3])) { + case 'k': + $target *= 1000; + break; + case 'ki': + $target *= 1024; + break; + case 'm': + $target *= 1000000; + break; + case 'mi': + $target *= 1024 * 1024; + break; + case 'g': + $target *= 1000000000; + break; + case 'gi': + $target *= 1024 * 1024 * 1024; + break; + } + } + + $this->setTarget($target); + $this->setOperator(isset($matches[1]) ? $matches[1] : '=='); + } +} diff --git a/vendor/symfony/finder/Exception/AccessDeniedException.php b/vendor/symfony/finder/Exception/AccessDeniedException.php new file mode 100644 index 00000000..ee195ea8 --- /dev/null +++ b/vendor/symfony/finder/Exception/AccessDeniedException.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Exception; + +/** + * @author Jean-François Simon + */ +class AccessDeniedException extends \UnexpectedValueException +{ +} diff --git a/vendor/symfony/finder/Exception/ExceptionInterface.php b/vendor/symfony/finder/Exception/ExceptionInterface.php new file mode 100644 index 00000000..161e9686 --- /dev/null +++ b/vendor/symfony/finder/Exception/ExceptionInterface.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Exception; + +/** + * @author Jean-François Simon + * + * @deprecated since 3.3, to be removed in 4.0. + */ +interface ExceptionInterface +{ + /** + * @return \Symfony\Component\Finder\Adapter\AdapterInterface + */ + public function getAdapter(); +} diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php new file mode 100644 index 00000000..07dce771 --- /dev/null +++ b/vendor/symfony/finder/Finder.php @@ -0,0 +1,723 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder; + +use Symfony\Component\Finder\Comparator\DateComparator; +use Symfony\Component\Finder\Comparator\NumberComparator; +use Symfony\Component\Finder\Iterator\CustomFilterIterator; +use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; +use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator; +use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator; +use Symfony\Component\Finder\Iterator\FilecontentFilterIterator; +use Symfony\Component\Finder\Iterator\FilenameFilterIterator; +use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; +use Symfony\Component\Finder\Iterator\SortableIterator; + +/** + * Finder allows to build rules to find files and directories. + * + * It is a thin wrapper around several specialized iterator classes. + * + * All rules may be invoked several times. + * + * All methods return the current Finder object to allow easy chaining: + * + * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); + * + * @author Fabien Potencier + */ +class Finder implements \IteratorAggregate, \Countable +{ + const IGNORE_VCS_FILES = 1; + const IGNORE_DOT_FILES = 2; + + private $mode = 0; + private $names = array(); + private $notNames = array(); + private $exclude = array(); + private $filters = array(); + private $depths = array(); + private $sizes = array(); + private $followLinks = false; + private $sort = false; + private $ignore = 0; + private $dirs = array(); + private $dates = array(); + private $iterators = array(); + private $contains = array(); + private $notContains = array(); + private $paths = array(); + private $notPaths = array(); + private $ignoreUnreadableDirs = false; + + private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'); + + public function __construct() + { + $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES; + } + + /** + * Creates a new Finder. + * + * @return static + */ + public static function create() + { + return new static(); + } + + /** + * Restricts the matching to directories only. + * + * @return $this + */ + public function directories() + { + $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES; + + return $this; + } + + /** + * Restricts the matching to files only. + * + * @return $this + */ + public function files() + { + $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES; + + return $this; + } + + /** + * Adds tests for the directory depth. + * + * Usage: + * + * $finder->depth('> 1') // the Finder will start matching at level 1. + * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. + * + * @param string|int $level The depth level expression + * + * @return $this + * + * @see DepthRangeFilterIterator + * @see NumberComparator + */ + public function depth($level) + { + $this->depths[] = new Comparator\NumberComparator($level); + + return $this; + } + + /** + * Adds tests for file dates (last modified). + * + * The date must be something that strtotime() is able to parse: + * + * $finder->date('since yesterday'); + * $finder->date('until 2 days ago'); + * $finder->date('> now - 2 hours'); + * $finder->date('>= 2005-10-15'); + * + * @param string $date A date range string + * + * @return $this + * + * @see strtotime + * @see DateRangeFilterIterator + * @see DateComparator + */ + public function date($date) + { + $this->dates[] = new Comparator\DateComparator($date); + + return $this; + } + + /** + * Adds rules that files must match. + * + * You can use patterns (delimited with / sign), globs or simple strings. + * + * $finder->name('*.php') + * $finder->name('/\.php$/') // same as above + * $finder->name('test.php') + * + * @param string $pattern A pattern (a regexp, a glob, or a string) + * + * @return $this + * + * @see FilenameFilterIterator + */ + public function name($pattern) + { + $this->names[] = $pattern; + + return $this; + } + + /** + * Adds rules that files must not match. + * + * @param string $pattern A pattern (a regexp, a glob, or a string) + * + * @return $this + * + * @see FilenameFilterIterator + */ + public function notName($pattern) + { + $this->notNames[] = $pattern; + + return $this; + } + + /** + * Adds tests that file contents must match. + * + * Strings or PCRE patterns can be used: + * + * $finder->contains('Lorem ipsum') + * $finder->contains('/Lorem ipsum/i') + * + * @param string $pattern A pattern (string or regexp) + * + * @return $this + * + * @see FilecontentFilterIterator + */ + public function contains($pattern) + { + $this->contains[] = $pattern; + + return $this; + } + + /** + * Adds tests that file contents must not match. + * + * Strings or PCRE patterns can be used: + * + * $finder->notContains('Lorem ipsum') + * $finder->notContains('/Lorem ipsum/i') + * + * @param string $pattern A pattern (string or regexp) + * + * @return $this + * + * @see FilecontentFilterIterator + */ + public function notContains($pattern) + { + $this->notContains[] = $pattern; + + return $this; + } + + /** + * Adds rules that filenames must match. + * + * You can use patterns (delimited with / sign) or simple strings. + * + * $finder->path('some/special/dir') + * $finder->path('/some\/special\/dir/') // same as above + * + * Use only / as dirname separator. + * + * @param string $pattern A pattern (a regexp or a string) + * + * @return $this + * + * @see FilenameFilterIterator + */ + public function path($pattern) + { + $this->paths[] = $pattern; + + return $this; + } + + /** + * Adds rules that filenames must not match. + * + * You can use patterns (delimited with / sign) or simple strings. + * + * $finder->notPath('some/special/dir') + * $finder->notPath('/some\/special\/dir/') // same as above + * + * Use only / as dirname separator. + * + * @param string $pattern A pattern (a regexp or a string) + * + * @return $this + * + * @see FilenameFilterIterator + */ + public function notPath($pattern) + { + $this->notPaths[] = $pattern; + + return $this; + } + + /** + * Adds tests for file sizes. + * + * $finder->size('> 10K'); + * $finder->size('<= 1Ki'); + * $finder->size(4); + * + * @param string|int $size A size range string or an integer + * + * @return $this + * + * @see SizeRangeFilterIterator + * @see NumberComparator + */ + public function size($size) + { + $this->sizes[] = new Comparator\NumberComparator($size); + + return $this; + } + + /** + * Excludes directories. + * + * @param string|array $dirs A directory path or an array of directories + * + * @return $this + * + * @see ExcludeDirectoryFilterIterator + */ + public function exclude($dirs) + { + $this->exclude = array_merge($this->exclude, (array) $dirs); + + return $this; + } + + /** + * Excludes "hidden" directories and files (starting with a dot). + * + * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not + * + * @return $this + * + * @see ExcludeDirectoryFilterIterator + */ + public function ignoreDotFiles($ignoreDotFiles) + { + if ($ignoreDotFiles) { + $this->ignore |= static::IGNORE_DOT_FILES; + } else { + $this->ignore &= ~static::IGNORE_DOT_FILES; + } + + return $this; + } + + /** + * Forces the finder to ignore version control directories. + * + * @param bool $ignoreVCS Whether to exclude VCS files or not + * + * @return $this + * + * @see ExcludeDirectoryFilterIterator + */ + public function ignoreVCS($ignoreVCS) + { + if ($ignoreVCS) { + $this->ignore |= static::IGNORE_VCS_FILES; + } else { + $this->ignore &= ~static::IGNORE_VCS_FILES; + } + + return $this; + } + + /** + * Adds VCS patterns. + * + * @see ignoreVCS() + * + * @param string|string[] $pattern VCS patterns to ignore + */ + public static function addVCSPattern($pattern) + { + foreach ((array) $pattern as $p) { + self::$vcsPatterns[] = $p; + } + + self::$vcsPatterns = array_unique(self::$vcsPatterns); + } + + /** + * Sorts files and directories by an anonymous function. + * + * The anonymous function receives two \SplFileInfo instances to compare. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sort(\Closure $closure) + { + $this->sort = $closure; + + return $this; + } + + /** + * Sorts files and directories by name. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sortByName() + { + $this->sort = Iterator\SortableIterator::SORT_BY_NAME; + + return $this; + } + + /** + * Sorts files and directories by type (directories before files), then by name. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sortByType() + { + $this->sort = Iterator\SortableIterator::SORT_BY_TYPE; + + return $this; + } + + /** + * Sorts files and directories by the last accessed time. + * + * This is the time that the file was last accessed, read or written to. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sortByAccessedTime() + { + $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME; + + return $this; + } + + /** + * Sorts files and directories by the last inode changed time. + * + * This is the time that the inode information was last modified (permissions, owner, group or other metadata). + * + * On Windows, since inode is not available, changed time is actually the file creation time. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sortByChangedTime() + { + $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME; + + return $this; + } + + /** + * Sorts files and directories by the last modified time. + * + * This is the last time the actual contents of the file were last modified. + * + * This can be slow as all the matching files and directories must be retrieved for comparison. + * + * @return $this + * + * @see SortableIterator + */ + public function sortByModifiedTime() + { + $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME; + + return $this; + } + + /** + * Filters the iterator with an anonymous function. + * + * The anonymous function receives a \SplFileInfo and must return false + * to remove files. + * + * @return $this + * + * @see CustomFilterIterator + */ + public function filter(\Closure $closure) + { + $this->filters[] = $closure; + + return $this; + } + + /** + * Forces the following of symlinks. + * + * @return $this + */ + public function followLinks() + { + $this->followLinks = true; + + return $this; + } + + /** + * Tells finder to ignore unreadable directories. + * + * By default, scanning unreadable directories content throws an AccessDeniedException. + * + * @param bool $ignore + * + * @return $this + */ + public function ignoreUnreadableDirs($ignore = true) + { + $this->ignoreUnreadableDirs = (bool) $ignore; + + return $this; + } + + /** + * Searches files and directories which match defined rules. + * + * @param string|array $dirs A directory path or an array of directories + * + * @return $this + * + * @throws \InvalidArgumentException if one of the directories does not exist + */ + public function in($dirs) + { + $resolvedDirs = array(); + + foreach ((array) $dirs as $dir) { + if (is_dir($dir)) { + $resolvedDirs[] = $dir; + } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { + $resolvedDirs = array_merge($resolvedDirs, $glob); + } else { + throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); + } + } + + $this->dirs = array_merge($this->dirs, $resolvedDirs); + + return $this; + } + + /** + * Returns an Iterator for the current Finder configuration. + * + * This method implements the IteratorAggregate interface. + * + * @return \Iterator|SplFileInfo[] An iterator + * + * @throws \LogicException if the in() method has not been called + */ + public function getIterator() + { + if (0 === count($this->dirs) && 0 === count($this->iterators)) { + throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.'); + } + + if (1 === count($this->dirs) && 0 === count($this->iterators)) { + return $this->searchInDirectory($this->dirs[0]); + } + + $iterator = new \AppendIterator(); + foreach ($this->dirs as $dir) { + $iterator->append($this->searchInDirectory($dir)); + } + + foreach ($this->iterators as $it) { + $iterator->append($it); + } + + return $iterator; + } + + /** + * Appends an existing set of files/directories to the finder. + * + * The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array. + * + * @param mixed $iterator + * + * @return $this + * + * @throws \InvalidArgumentException when the given argument is not iterable + */ + public function append($iterator) + { + if ($iterator instanceof \IteratorAggregate) { + $this->iterators[] = $iterator->getIterator(); + } elseif ($iterator instanceof \Iterator) { + $this->iterators[] = $iterator; + } elseif ($iterator instanceof \Traversable || is_array($iterator)) { + $it = new \ArrayIterator(); + foreach ($iterator as $file) { + $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file)); + } + $this->iterators[] = $it; + } else { + throw new \InvalidArgumentException('Finder::append() method wrong argument type.'); + } + + return $this; + } + + /** + * Check if the any results were found. + * + * @return bool + */ + public function hasResults() + { + foreach ($this->getIterator() as $_) { + return true; + } + + return false; + } + + /** + * Counts all the results collected by the iterators. + * + * @return int + */ + public function count() + { + return iterator_count($this->getIterator()); + } + + /** + * @param $dir + * + * @return \Iterator + */ + private function searchInDirectory($dir) + { + if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) { + $this->exclude = array_merge($this->exclude, self::$vcsPatterns); + } + + if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) { + $this->notPaths[] = '#(^|/)\..+(/|$)#'; + } + + $minDepth = 0; + $maxDepth = PHP_INT_MAX; + + foreach ($this->depths as $comparator) { + switch ($comparator->getOperator()) { + case '>': + $minDepth = $comparator->getTarget() + 1; + break; + case '>=': + $minDepth = $comparator->getTarget(); + break; + case '<': + $maxDepth = $comparator->getTarget() - 1; + break; + case '<=': + $maxDepth = $comparator->getTarget(); + break; + default: + $minDepth = $maxDepth = $comparator->getTarget(); + } + } + + $flags = \RecursiveDirectoryIterator::SKIP_DOTS; + + if ($this->followLinks) { + $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS; + } + + $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs); + + if ($this->exclude) { + $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude); + } + + $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); + + if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) { + $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth); + } + + if ($this->mode) { + $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode); + } + + if ($this->names || $this->notNames) { + $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames); + } + + if ($this->contains || $this->notContains) { + $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains); + } + + if ($this->sizes) { + $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes); + } + + if ($this->dates) { + $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates); + } + + if ($this->filters) { + $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters); + } + + if ($this->paths || $this->notPaths) { + $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths); + } + + if ($this->sort) { + $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort); + $iterator = $iteratorAggregate->getIterator(); + } + + return $iterator; + } +} diff --git a/vendor/symfony/finder/Glob.php b/vendor/symfony/finder/Glob.php new file mode 100644 index 00000000..df8b86fa --- /dev/null +++ b/vendor/symfony/finder/Glob.php @@ -0,0 +1,116 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder; + +/** + * Glob matches globbing patterns against text. + * + * if match_glob("foo.*", "foo.bar") echo "matched\n"; + * + * // prints foo.bar and foo.baz + * $regex = glob_to_regex("foo.*"); + * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) + * { + * if (/$regex/) echo "matched: $car\n"; + * } + * + * Glob implements glob(3) style matching that can be used to match + * against text, rather than fetching names from a filesystem. + * + * Based on the Perl Text::Glob module. + * + * @author Fabien Potencier PHP port + * @author Richard Clamp Perl version + * @copyright 2004-2005 Fabien Potencier + * @copyright 2002 Richard Clamp + */ +class Glob +{ + /** + * Returns a regexp which is the equivalent of the glob pattern. + * + * @param string $glob The glob pattern + * @param bool $strictLeadingDot + * @param bool $strictWildcardSlash + * @param string $delimiter Optional delimiter + * + * @return string regex The regexp + */ + public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#') + { + $firstByte = true; + $escaping = false; + $inCurlies = 0; + $regex = ''; + $sizeGlob = strlen($glob); + for ($i = 0; $i < $sizeGlob; ++$i) { + $car = $glob[$i]; + if ($firstByte && $strictLeadingDot && '.' !== $car) { + $regex .= '(?=[^\.])'; + } + + $firstByte = '/' === $car; + + if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) { + $car = '[^/]++/'; + if (!isset($glob[$i + 3])) { + $car .= '?'; + } + + if ($strictLeadingDot) { + $car = '(?=[^\.])'.$car; + } + + $car = '/(?:'.$car.')*'; + $i += 2 + isset($glob[$i + 3]); + + if ('/' === $delimiter) { + $car = str_replace('/', '\\/', $car); + } + } + + if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) { + $regex .= "\\$car"; + } elseif ('*' === $car) { + $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*'); + } elseif ('?' === $car) { + $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.'); + } elseif ('{' === $car) { + $regex .= $escaping ? '\\{' : '('; + if (!$escaping) { + ++$inCurlies; + } + } elseif ('}' === $car && $inCurlies) { + $regex .= $escaping ? '}' : ')'; + if (!$escaping) { + --$inCurlies; + } + } elseif (',' === $car && $inCurlies) { + $regex .= $escaping ? ',' : '|'; + } elseif ('\\' === $car) { + if ($escaping) { + $regex .= '\\\\'; + $escaping = false; + } else { + $escaping = true; + } + + continue; + } else { + $regex .= $car; + } + $escaping = false; + } + + return $delimiter.'^'.$regex.'$'.$delimiter; + } +} diff --git a/vendor/symfony/finder/Iterator/CustomFilterIterator.php b/vendor/symfony/finder/Iterator/CustomFilterIterator.php new file mode 100644 index 00000000..399b6a97 --- /dev/null +++ b/vendor/symfony/finder/Iterator/CustomFilterIterator.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * CustomFilterIterator filters files by applying anonymous functions. + * + * The anonymous function receives a \SplFileInfo and must return false + * to remove files. + * + * @author Fabien Potencier + */ +class CustomFilterIterator extends FilterIterator +{ + private $filters = array(); + + /** + * @param \Iterator $iterator The Iterator to filter + * @param callable[] $filters An array of PHP callbacks + * + * @throws \InvalidArgumentException + */ + public function __construct(\Iterator $iterator, array $filters) + { + foreach ($filters as $filter) { + if (!is_callable($filter)) { + throw new \InvalidArgumentException('Invalid PHP callback.'); + } + } + $this->filters = $filters; + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + $fileinfo = $this->current(); + + foreach ($this->filters as $filter) { + if (false === call_user_func($filter, $fileinfo)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php new file mode 100644 index 00000000..b01e5e3f --- /dev/null +++ b/vendor/symfony/finder/Iterator/DateRangeFilterIterator.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +use Symfony\Component\Finder\Comparator\DateComparator; + +/** + * DateRangeFilterIterator filters out files that are not in the given date range (last modified dates). + * + * @author Fabien Potencier + */ +class DateRangeFilterIterator extends FilterIterator +{ + private $comparators = array(); + + /** + * @param \Iterator $iterator The Iterator to filter + * @param DateComparator[] $comparators An array of DateComparator instances + */ + public function __construct(\Iterator $iterator, array $comparators) + { + $this->comparators = $comparators; + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + $fileinfo = $this->current(); + + if (!file_exists($fileinfo->getPathname())) { + return false; + } + + $filedate = $fileinfo->getMTime(); + foreach ($this->comparators as $compare) { + if (!$compare->test($filedate)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php b/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php new file mode 100644 index 00000000..ce9d3aa7 --- /dev/null +++ b/vendor/symfony/finder/Iterator/DepthRangeFilterIterator.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * DepthRangeFilterIterator limits the directory depth. + * + * @author Fabien Potencier + */ +class DepthRangeFilterIterator extends FilterIterator +{ + private $minDepth = 0; + + /** + * @param \RecursiveIteratorIterator $iterator The Iterator to filter + * @param int $minDepth The min depth + * @param int $maxDepth The max depth + */ + public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX) + { + $this->minDepth = $minDepth; + $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + return $this->getInnerIterator()->getDepth() >= $this->minDepth; + } +} diff --git a/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php new file mode 100644 index 00000000..c57128c2 --- /dev/null +++ b/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -0,0 +1,84 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * ExcludeDirectoryFilterIterator filters out directories. + * + * @author Fabien Potencier + */ +class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator +{ + private $iterator; + private $isRecursive; + private $excludedDirs = array(); + private $excludedPattern; + + /** + * @param \Iterator $iterator The Iterator to filter + * @param array $directories An array of directories to exclude + */ + public function __construct(\Iterator $iterator, array $directories) + { + $this->iterator = $iterator; + $this->isRecursive = $iterator instanceof \RecursiveIterator; + $patterns = array(); + foreach ($directories as $directory) { + $directory = rtrim($directory, '/'); + if (!$this->isRecursive || false !== strpos($directory, '/')) { + $patterns[] = preg_quote($directory, '#'); + } else { + $this->excludedDirs[$directory] = true; + } + } + if ($patterns) { + $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#'; + } + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool True if the value should be kept, false otherwise + */ + public function accept() + { + if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) { + return false; + } + + if ($this->excludedPattern) { + $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); + $path = str_replace('\\', '/', $path); + + return !preg_match($this->excludedPattern, $path); + } + + return true; + } + + public function hasChildren() + { + return $this->isRecursive && $this->iterator->hasChildren(); + } + + public function getChildren() + { + $children = new self($this->iterator->getChildren(), array()); + $children->excludedDirs = $this->excludedDirs; + $children->excludedPattern = $this->excludedPattern; + + return $children; + } +} diff --git a/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php b/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php new file mode 100644 index 00000000..e9811d4a --- /dev/null +++ b/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * FileTypeFilterIterator only keeps files, directories, or both. + * + * @author Fabien Potencier + */ +class FileTypeFilterIterator extends FilterIterator +{ + const ONLY_FILES = 1; + const ONLY_DIRECTORIES = 2; + + private $mode; + + /** + * @param \Iterator $iterator The Iterator to filter + * @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES) + */ + public function __construct(\Iterator $iterator, $mode) + { + $this->mode = $mode; + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + $fileinfo = $this->current(); + if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) { + return false; + } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) { + return false; + } + + return true; + } +} diff --git a/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php b/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php new file mode 100644 index 00000000..81594b87 --- /dev/null +++ b/vendor/symfony/finder/Iterator/FilecontentFilterIterator.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * FilecontentFilterIterator filters files by their contents using patterns (regexps or strings). + * + * @author Fabien Potencier + * @author Włodzimierz Gajda + */ +class FilecontentFilterIterator extends MultiplePcreFilterIterator +{ + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + if (!$this->matchRegexps && !$this->noMatchRegexps) { + return true; + } + + $fileinfo = $this->current(); + + if ($fileinfo->isDir() || !$fileinfo->isReadable()) { + return false; + } + + $content = $fileinfo->getContents(); + if (!$content) { + return false; + } + + return $this->isAccepted($content); + } + + /** + * Converts string to regexp if necessary. + * + * @param string $str Pattern: string or regexp + * + * @return string regexp corresponding to a given string or regexp + */ + protected function toRegex($str) + { + return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; + } +} diff --git a/vendor/symfony/finder/Iterator/FilenameFilterIterator.php b/vendor/symfony/finder/Iterator/FilenameFilterIterator.php new file mode 100644 index 00000000..e168cd8f --- /dev/null +++ b/vendor/symfony/finder/Iterator/FilenameFilterIterator.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +use Symfony\Component\Finder\Glob; + +/** + * FilenameFilterIterator filters files by patterns (a regexp, a glob, or a string). + * + * @author Fabien Potencier + */ +class FilenameFilterIterator extends MultiplePcreFilterIterator +{ + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + return $this->isAccepted($this->current()->getFilename()); + } + + /** + * Converts glob to regexp. + * + * PCRE patterns are left unchanged. + * Glob strings are transformed with Glob::toRegex(). + * + * @param string $str Pattern: glob or regexp + * + * @return string regexp corresponding to a given glob or regexp + */ + protected function toRegex($str) + { + return $this->isRegex($str) ? $str : Glob::toRegex($str); + } +} diff --git a/vendor/symfony/finder/Iterator/FilterIterator.php b/vendor/symfony/finder/Iterator/FilterIterator.php new file mode 100644 index 00000000..c16dd8fa --- /dev/null +++ b/vendor/symfony/finder/Iterator/FilterIterator.php @@ -0,0 +1,60 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * This iterator just overrides the rewind method in order to correct a PHP bug, + * which existed before version 5.5.23/5.6.7. + * + * @see https://bugs.php.net/68557 + * + * @author Alex Bogomazov + * + * @deprecated since 3.4, to be removed in 4.0. + */ +abstract class FilterIterator extends \FilterIterator +{ + /** + * This is a workaround for the problem with \FilterIterator leaving inner \FilesystemIterator in wrong state after + * rewind in some cases. + * + * @see FilterIterator::rewind() + */ + public function rewind() + { + if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) { + parent::rewind(); + + return; + } + + $iterator = $this; + while ($iterator instanceof \OuterIterator) { + $innerIterator = $iterator->getInnerIterator(); + + if ($innerIterator instanceof RecursiveDirectoryIterator) { + // this condition is necessary for iterators to work properly with non-local filesystems like ftp + if ($innerIterator->isRewindable()) { + $innerIterator->next(); + $innerIterator->rewind(); + } + } elseif ($innerIterator instanceof \FilesystemIterator) { + $innerIterator->next(); + $innerIterator->rewind(); + } + + $iterator = $innerIterator; + } + + parent::rewind(); + } +} diff --git a/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php b/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php new file mode 100644 index 00000000..fc885404 --- /dev/null +++ b/vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * MultiplePcreFilterIterator filters files using patterns (regexps, globs or strings). + * + * @author Fabien Potencier + */ +abstract class MultiplePcreFilterIterator extends FilterIterator +{ + protected $matchRegexps = array(); + protected $noMatchRegexps = array(); + + /** + * @param \Iterator $iterator The Iterator to filter + * @param array $matchPatterns An array of patterns that need to match + * @param array $noMatchPatterns An array of patterns that need to not match + */ + public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns) + { + foreach ($matchPatterns as $pattern) { + $this->matchRegexps[] = $this->toRegex($pattern); + } + + foreach ($noMatchPatterns as $pattern) { + $this->noMatchRegexps[] = $this->toRegex($pattern); + } + + parent::__construct($iterator); + } + + /** + * Checks whether the string is accepted by the regex filters. + * + * If there is no regexps defined in the class, this method will accept the string. + * Such case can be handled by child classes before calling the method if they want to + * apply a different behavior. + * + * @param string $string The string to be matched against filters + * + * @return bool + */ + protected function isAccepted($string) + { + // should at least not match one rule to exclude + foreach ($this->noMatchRegexps as $regex) { + if (preg_match($regex, $string)) { + return false; + } + } + + // should at least match one rule + if ($this->matchRegexps) { + foreach ($this->matchRegexps as $regex) { + if (preg_match($regex, $string)) { + return true; + } + } + + return false; + } + + // If there is no match rules, the file is accepted + return true; + } + + /** + * Checks whether the string is a regex. + * + * @param string $str + * + * @return bool Whether the given string is a regex + */ + protected function isRegex($str) + { + if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) { + $start = substr($m[1], 0, 1); + $end = substr($m[1], -1); + + if ($start === $end) { + return !preg_match('/[*?[:alnum:] \\\\]/', $start); + } + + foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) { + if ($start === $delimiters[0] && $end === $delimiters[1]) { + return true; + } + } + } + + return false; + } + + /** + * Converts string into regexp. + * + * @param string $str Pattern + * + * @return string regexp corresponding to a given string + */ + abstract protected function toRegex($str); +} diff --git a/vendor/symfony/finder/Iterator/PathFilterIterator.php b/vendor/symfony/finder/Iterator/PathFilterIterator.php new file mode 100644 index 00000000..dadfc8ed --- /dev/null +++ b/vendor/symfony/finder/Iterator/PathFilterIterator.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * PathFilterIterator filters files by path patterns (e.g. some/special/dir). + * + * @author Fabien Potencier + * @author Włodzimierz Gajda + */ +class PathFilterIterator extends MultiplePcreFilterIterator +{ + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + $filename = $this->current()->getRelativePathname(); + + if ('\\' === DIRECTORY_SEPARATOR) { + $filename = str_replace('\\', '/', $filename); + } + + return $this->isAccepted($filename); + } + + /** + * Converts strings to regexp. + * + * PCRE patterns are left unchanged. + * + * Default conversion: + * 'lorem/ipsum/dolor' ==> 'lorem\/ipsum\/dolor/' + * + * Use only / as directory separator (on Windows also). + * + * @param string $str Pattern: regexp or dirname + * + * @return string regexp corresponding to a given string or regexp + */ + protected function toRegex($str) + { + return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/'; + } +} diff --git a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php new file mode 100644 index 00000000..c1c0e2f1 --- /dev/null +++ b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php @@ -0,0 +1,154 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +use Symfony\Component\Finder\Exception\AccessDeniedException; +use Symfony\Component\Finder\SplFileInfo; + +/** + * Extends the \RecursiveDirectoryIterator to support relative paths. + * + * @author Victor Berchet + */ +class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator +{ + /** + * @var bool + */ + private $ignoreUnreadableDirs; + + /** + * @var bool + */ + private $rewindable; + + // these 3 properties take part of the performance optimization to avoid redoing the same work in all iterations + private $rootPath; + private $subPath; + private $directorySeparator = '/'; + + /** + * @param string $path + * @param int $flags + * @param bool $ignoreUnreadableDirs + * + * @throws \RuntimeException + */ + public function __construct($path, $flags, $ignoreUnreadableDirs = false) + { + if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) { + throw new \RuntimeException('This iterator only support returning current as fileinfo.'); + } + + parent::__construct($path, $flags); + $this->ignoreUnreadableDirs = $ignoreUnreadableDirs; + $this->rootPath = $path; + if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) { + $this->directorySeparator = DIRECTORY_SEPARATOR; + } + } + + /** + * Return an instance of SplFileInfo with support for relative paths. + * + * @return SplFileInfo File information + */ + public function current() + { + // the logic here avoids redoing the same work in all iterations + + if (null === $subPathname = $this->subPath) { + $subPathname = $this->subPath = (string) $this->getSubPath(); + } + if ('' !== $subPathname) { + $subPathname .= $this->directorySeparator; + } + $subPathname .= $this->getFilename(); + + return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname); + } + + /** + * @return \RecursiveIterator + * + * @throws AccessDeniedException + */ + public function getChildren() + { + try { + $children = parent::getChildren(); + + if ($children instanceof self) { + // parent method will call the constructor with default arguments, so unreadable dirs won't be ignored anymore + $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs; + + // performance optimization to avoid redoing the same work in all children + $children->rewindable = &$this->rewindable; + $children->rootPath = $this->rootPath; + } + + return $children; + } catch (\UnexpectedValueException $e) { + if ($this->ignoreUnreadableDirs) { + // If directory is unreadable and finder is set to ignore it, a fake empty content is returned. + return new \RecursiveArrayIterator(array()); + } else { + throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e); + } + } + } + + /** + * Do nothing for non rewindable stream. + */ + public function rewind() + { + if (false === $this->isRewindable()) { + return; + } + + // @see https://bugs.php.net/68557 + if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) { + parent::next(); + } + + parent::rewind(); + } + + /** + * Checks if the stream is rewindable. + * + * @return bool true when the stream is rewindable, false otherwise + */ + public function isRewindable() + { + if (null !== $this->rewindable) { + return $this->rewindable; + } + + // workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed + if ('' === $this->getPath()) { + return $this->rewindable = false; + } + + if (false !== $stream = @opendir($this->getPath())) { + $infos = stream_get_meta_data($stream); + closedir($stream); + + if ($infos['seekable']) { + return $this->rewindable = true; + } + } + + return $this->rewindable = false; + } +} diff --git a/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php new file mode 100644 index 00000000..bd1a7fb7 --- /dev/null +++ b/vendor/symfony/finder/Iterator/SizeRangeFilterIterator.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +use Symfony\Component\Finder\Comparator\NumberComparator; + +/** + * SizeRangeFilterIterator filters out files that are not in the given size range. + * + * @author Fabien Potencier + */ +class SizeRangeFilterIterator extends FilterIterator +{ + private $comparators = array(); + + /** + * @param \Iterator $iterator The Iterator to filter + * @param NumberComparator[] $comparators An array of NumberComparator instances + */ + public function __construct(\Iterator $iterator, array $comparators) + { + $this->comparators = $comparators; + + parent::__construct($iterator); + } + + /** + * Filters the iterator values. + * + * @return bool true if the value should be kept, false otherwise + */ + public function accept() + { + $fileinfo = $this->current(); + if (!$fileinfo->isFile()) { + return true; + } + + $filesize = $fileinfo->getSize(); + foreach ($this->comparators as $compare) { + if (!$compare->test($filesize)) { + return false; + } + } + + return true; + } +} diff --git a/vendor/symfony/finder/Iterator/SortableIterator.php b/vendor/symfony/finder/Iterator/SortableIterator.php new file mode 100644 index 00000000..c2f54b93 --- /dev/null +++ b/vendor/symfony/finder/Iterator/SortableIterator.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Iterator; + +/** + * SortableIterator applies a sort on a given Iterator. + * + * @author Fabien Potencier + */ +class SortableIterator implements \IteratorAggregate +{ + const SORT_BY_NAME = 1; + const SORT_BY_TYPE = 2; + const SORT_BY_ACCESSED_TIME = 3; + const SORT_BY_CHANGED_TIME = 4; + const SORT_BY_MODIFIED_TIME = 5; + + private $iterator; + private $sort; + + /** + * @param \Traversable $iterator The Iterator to filter + * @param int|callable $sort The sort type (SORT_BY_NAME, SORT_BY_TYPE, or a PHP callback) + * + * @throws \InvalidArgumentException + */ + public function __construct(\Traversable $iterator, $sort) + { + $this->iterator = $iterator; + + if (self::SORT_BY_NAME === $sort) { + $this->sort = function ($a, $b) { + return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname()); + }; + } elseif (self::SORT_BY_TYPE === $sort) { + $this->sort = function ($a, $b) { + if ($a->isDir() && $b->isFile()) { + return -1; + } elseif ($a->isFile() && $b->isDir()) { + return 1; + } + + return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname()); + }; + } elseif (self::SORT_BY_ACCESSED_TIME === $sort) { + $this->sort = function ($a, $b) { + return $a->getATime() - $b->getATime(); + }; + } elseif (self::SORT_BY_CHANGED_TIME === $sort) { + $this->sort = function ($a, $b) { + return $a->getCTime() - $b->getCTime(); + }; + } elseif (self::SORT_BY_MODIFIED_TIME === $sort) { + $this->sort = function ($a, $b) { + return $a->getMTime() - $b->getMTime(); + }; + } elseif (is_callable($sort)) { + $this->sort = $sort; + } else { + throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); + } + } + + public function getIterator() + { + $array = iterator_to_array($this->iterator, true); + uasort($array, $this->sort); + + return new \ArrayIterator($array); + } +} diff --git a/vendor/symfony/finder/LICENSE b/vendor/symfony/finder/LICENSE new file mode 100644 index 00000000..17d16a13 --- /dev/null +++ b/vendor/symfony/finder/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2004-2017 Fabien Potencier + +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/symfony/finder/README.md b/vendor/symfony/finder/README.md new file mode 100644 index 00000000..0b19c752 --- /dev/null +++ b/vendor/symfony/finder/README.md @@ -0,0 +1,14 @@ +Finder Component +================ + +The Finder component finds files and directories via an intuitive fluent +interface. + +Resources +--------- + + * [Documentation](https://symfony.com/doc/current/components/finder.html) + * [Contributing](https://symfony.com/doc/current/contributing/index.html) + * [Report issues](https://github.com/symfony/symfony/issues) and + [send Pull Requests](https://github.com/symfony/symfony/pulls) + in the [main Symfony repository](https://github.com/symfony/symfony) diff --git a/vendor/symfony/finder/SplFileInfo.php b/vendor/symfony/finder/SplFileInfo.php new file mode 100644 index 00000000..19f95e26 --- /dev/null +++ b/vendor/symfony/finder/SplFileInfo.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder; + +/** + * Extends \SplFileInfo to support relative paths. + * + * @author Fabien Potencier + */ +class SplFileInfo extends \SplFileInfo +{ + private $relativePath; + private $relativePathname; + + /** + * @param string $file The file name + * @param string $relativePath The relative path + * @param string $relativePathname The relative path name + */ + public function __construct($file, $relativePath, $relativePathname) + { + parent::__construct($file); + $this->relativePath = $relativePath; + $this->relativePathname = $relativePathname; + } + + /** + * Returns the relative path. + * + * This path does not contain the file name. + * + * @return string the relative path + */ + public function getRelativePath() + { + return $this->relativePath; + } + + /** + * Returns the relative path name. + * + * This path contains the file name. + * + * @return string the relative path name + */ + public function getRelativePathname() + { + return $this->relativePathname; + } + + /** + * Returns the contents of the file. + * + * @return string the contents of the file + * + * @throws \RuntimeException + */ + public function getContents() + { + $level = error_reporting(0); + $content = file_get_contents($this->getPathname()); + error_reporting($level); + if (false === $content) { + $error = error_get_last(); + throw new \RuntimeException($error['message']); + } + + return $content; + } +} diff --git a/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php new file mode 100644 index 00000000..656fc57a --- /dev/null +++ b/vendor/symfony/finder/Tests/Comparator/ComparatorTest.php @@ -0,0 +1,65 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Comparator; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Finder\Comparator\Comparator; + +class ComparatorTest extends TestCase +{ + public function testGetSetOperator() + { + $comparator = new Comparator(); + try { + $comparator->setOperator('foo'); + $this->fail('->setOperator() throws an \InvalidArgumentException if the operator is not valid.'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '->setOperator() throws an \InvalidArgumentException if the operator is not valid.'); + } + + $comparator = new Comparator(); + $comparator->setOperator('>'); + $this->assertEquals('>', $comparator->getOperator(), '->getOperator() returns the current operator'); + } + + public function testGetSetTarget() + { + $comparator = new Comparator(); + $comparator->setTarget(8); + $this->assertEquals(8, $comparator->getTarget(), '->getTarget() returns the target'); + } + + /** + * @dataProvider getTestData + */ + public function testTest($operator, $target, $match, $noMatch) + { + $c = new Comparator(); + $c->setOperator($operator); + $c->setTarget($target); + + foreach ($match as $m) { + $this->assertTrue($c->test($m), '->test() tests a string against the expression'); + } + + foreach ($noMatch as $m) { + $this->assertFalse($c->test($m), '->test() tests a string against the expression'); + } + } + + public function getTestData() + { + return array( + array('<', '1000', array('500', '999'), array('1000', '1500')), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php new file mode 100644 index 00000000..8a6c1ddf --- /dev/null +++ b/vendor/symfony/finder/Tests/Comparator/DateComparatorTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Comparator; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Finder\Comparator\DateComparator; + +class DateComparatorTest extends TestCase +{ + public function testConstructor() + { + try { + new DateComparator('foobar'); + $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } + + try { + new DateComparator(''); + $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } + } + + /** + * @dataProvider getTestData + */ + public function testTest($test, $match, $noMatch) + { + $c = new DateComparator($test); + + foreach ($match as $m) { + $this->assertTrue($c->test($m), '->test() tests a string against the expression'); + } + + foreach ($noMatch as $m) { + $this->assertFalse($c->test($m), '->test() tests a string against the expression'); + } + } + + public function getTestData() + { + return array( + array('< 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), + array('until 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), + array('before 2005-10-10', array(strtotime('2005-10-09')), array(strtotime('2005-10-15'))), + array('> 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), + array('after 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), + array('since 2005-10-10', array(strtotime('2005-10-15')), array(strtotime('2005-10-09'))), + array('!= 2005-10-10', array(strtotime('2005-10-11')), array(strtotime('2005-10-10'))), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php b/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php new file mode 100644 index 00000000..30a75c73 --- /dev/null +++ b/vendor/symfony/finder/Tests/Comparator/NumberComparatorTest.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Comparator; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Finder\Comparator\NumberComparator; + +class NumberComparatorTest extends TestCase +{ + /** + * @dataProvider getConstructorTestData + */ + public function testConstructor($successes, $failures) + { + foreach ($successes as $s) { + new NumberComparator($s); + } + + foreach ($failures as $f) { + try { + new NumberComparator($f); + $this->fail('__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException if the test expression is not valid.'); + } + } + } + + /** + * @dataProvider getTestData + */ + public function testTest($test, $match, $noMatch) + { + $c = new NumberComparator($test); + + foreach ($match as $m) { + $this->assertTrue($c->test($m), '->test() tests a string against the expression'); + } + + foreach ($noMatch as $m) { + $this->assertFalse($c->test($m), '->test() tests a string against the expression'); + } + } + + public function getTestData() + { + return array( + array('< 1000', array('500', '999'), array('1000', '1500')), + + array('< 1K', array('500', '999'), array('1000', '1500')), + array('<1k', array('500', '999'), array('1000', '1500')), + array(' < 1 K ', array('500', '999'), array('1000', '1500')), + array('<= 1K', array('1000'), array('1001')), + array('> 1K', array('1001'), array('1000')), + array('>= 1K', array('1000'), array('999')), + + array('< 1KI', array('500', '1023'), array('1024', '1500')), + array('<= 1KI', array('1024'), array('1025')), + array('> 1KI', array('1025'), array('1024')), + array('>= 1KI', array('1024'), array('1023')), + + array('1KI', array('1024'), array('1023', '1025')), + array('==1KI', array('1024'), array('1023', '1025')), + + array('==1m', array('1000000'), array('999999', '1000001')), + array('==1mi', array(1024 * 1024), array(1024 * 1024 - 1, 1024 * 1024 + 1)), + + array('==1g', array('1000000000'), array('999999999', '1000000001')), + array('==1gi', array(1024 * 1024 * 1024), array(1024 * 1024 * 1024 - 1, 1024 * 1024 * 1024 + 1)), + + array('!= 1000', array('500', '999'), array('1000')), + ); + } + + public function getConstructorTestData() + { + return array( + array( + array( + '1', '0', + '3.5', '33.55', '123.456', '123456.78', + '.1', '.123', + '.0', '0.0', + '1.', '0.', '123.', + '==1', '!=1', '<1', '>1', '<=1', '>=1', + '==1k', '==1ki', '==1m', '==1mi', '==1g', '==1gi', + '1k', '1ki', '1m', '1mi', '1g', '1gi', + ), + array( + false, null, '', + ' ', 'foobar', + '=1', '===1', + '0 . 1', '123 .45', '234. 567', + '..', '.0.', '0.1.2', + ), + ), + ); + } +} diff --git a/vendor/symfony/finder/Tests/FinderTest.php b/vendor/symfony/finder/Tests/FinderTest.php new file mode 100644 index 00000000..7e75f141 --- /dev/null +++ b/vendor/symfony/finder/Tests/FinderTest.php @@ -0,0 +1,698 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests; + +use Symfony\Component\Finder\Finder; + +class FinderTest extends Iterator\RealIteratorTestCase +{ + public function testCreate() + { + $this->assertInstanceOf('Symfony\Component\Finder\Finder', Finder::create()); + } + + public function testDirectories() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->directories()); + $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->directories(); + $finder->files(); + $finder->directories(); + $this->assertIterator($this->toAbsolute(array('foo', 'toto')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testFiles() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->files()); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->files(); + $finder->directories(); + $finder->files(); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testDepth() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->depth('< 1')); + $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->depth('<= 0')); + $this->assertIterator($this->toAbsolute(array('foo', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->depth('>= 1')); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->depth('< 1')->depth('>= 1'); + $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testName() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->name('*.php')); + $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('test.ph*'); + $finder->name('test.py'); + $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('~^test~i'); + $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('~\\.php$~i'); + $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('test.p{hp,y}'); + $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testNotName() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->notName('*.php')); + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->notName('*.php'); + $finder->notName('*.py'); + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('test.ph*'); + $finder->name('test.py'); + $finder->notName('*.php'); + $finder->notName('*.py'); + $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->name('test.ph*'); + $finder->name('test.py'); + $finder->notName('*.p{hp,y}'); + $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator()); + } + + /** + * @dataProvider getRegexNameTestData + */ + public function testRegexName($regex) + { + $finder = $this->buildFinder(); + $finder->name($regex); + $this->assertIterator($this->toAbsolute(array('test.py', 'test.php')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSize() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->files()->size('< 1K')->size('> 500')); + $this->assertIterator($this->toAbsolute(array('test.php')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testDate() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->files()->date('until last month')); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testExclude() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->exclude('foo')); + $this->assertIterator($this->toAbsolute(array('test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testIgnoreVCS() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->ignoreVCS(false)->ignoreDotFiles(false)); + $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->ignoreVCS(false)->ignoreVCS(false)->ignoreDotFiles(false); + $this->assertIterator($this->toAbsolute(array('.git', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->ignoreVCS(true)->ignoreDotFiles(false)); + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testIgnoreDotFiles() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->ignoreDotFiles(false)->ignoreVCS(false)); + $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $finder->ignoreDotFiles(false)->ignoreDotFiles(false)->ignoreVCS(false); + $this->assertIterator($this->toAbsolute(array('.git', '.bar', '.foo', '.foo/.bar', '.foo/bar', 'foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'toto/.git', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->ignoreDotFiles(true)->ignoreVCS(false)); + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSortByName() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sortByName()); + $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSortByType() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sortByType()); + $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSortByAccessedTime() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sortByAccessedTime()); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSortByChangedTime() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sortByChangedTime()); + $this->assertIterator($this->toAbsolute(array('toto', 'test.py', 'test.php', 'foo/bar.tmp', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSortByModifiedTime() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sortByModifiedTime()); + $this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'toto', 'test.py', 'foo', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testSort() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); })); + $this->assertIterator($this->toAbsolute(array('foo', 'foo bar', 'foo/bar.tmp', 'test.php', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testFilter() + { + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->filter(function (\SplFileInfo $f) { return false !== strpos($f, 'test'); })); + $this->assertIterator($this->toAbsolute(array('test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testFollowLinks() + { + if ('\\' == DIRECTORY_SEPARATOR) { + $this->markTestSkipped('symlinks are not supported on Windows'); + } + + $finder = $this->buildFinder(); + $this->assertSame($finder, $finder->followLinks()); + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.php', 'test.py', 'toto', 'foo bar')), $finder->in(self::$tmpDir)->getIterator()); + } + + public function testIn() + { + $finder = $this->buildFinder(); + $iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator(); + + $expected = array( + self::$tmpDir.DIRECTORY_SEPARATOR.'test.php', + __DIR__.DIRECTORY_SEPARATOR.'FinderTest.php', + __DIR__.DIRECTORY_SEPARATOR.'GlobTest.php', + ); + + $this->assertIterator($expected, $iterator); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testInWithNonExistentDirectory() + { + $finder = new Finder(); + $finder->in('foobar'); + } + + public function testInWithGlob() + { + $finder = $this->buildFinder(); + $finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator(); + + $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function testInWithNonDirectoryGlob() + { + $finder = new Finder(); + $finder->in(__DIR__.'/Fixtures/A/a*'); + } + + public function testInWithGlobBrace() + { + $finder = $this->buildFinder(); + $finder->in(array(__DIR__.'/Fixtures/{A,copy/A}/B/C'))->getIterator(); + + $this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder); + } + + /** + * @expectedException \LogicException + */ + public function testGetIteratorWithoutIn() + { + $finder = Finder::create(); + $finder->getIterator(); + } + + public function testGetIterator() + { + $finder = $this->buildFinder(); + $dirs = array(); + foreach ($finder->directories()->in(self::$tmpDir) as $dir) { + $dirs[] = (string) $dir; + } + + $expected = $this->toAbsolute(array('foo', 'toto')); + + sort($dirs); + sort($expected); + + $this->assertEquals($expected, $dirs, 'implements the \IteratorAggregate interface'); + + $finder = $this->buildFinder(); + $this->assertEquals(2, iterator_count($finder->directories()->in(self::$tmpDir)), 'implements the \IteratorAggregate interface'); + + $finder = $this->buildFinder(); + $a = iterator_to_array($finder->directories()->in(self::$tmpDir)); + $a = array_values(array_map('strval', $a)); + sort($a); + $this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface'); + } + + public function testRelativePath() + { + $finder = $this->buildFinder()->in(self::$tmpDir); + + $paths = array(); + + foreach ($finder as $file) { + $paths[] = $file->getRelativePath(); + } + + $ref = array('', '', '', '', 'foo', ''); + + sort($ref); + sort($paths); + + $this->assertEquals($ref, $paths); + } + + public function testRelativePathname() + { + $finder = $this->buildFinder()->in(self::$tmpDir)->sortByName(); + + $paths = array(); + + foreach ($finder as $file) { + $paths[] = $file->getRelativePathname(); + } + + $ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar'); + + sort($paths); + sort($ref); + + $this->assertEquals($ref, $paths); + } + + public function testAppendWithAFinder() + { + $finder = $this->buildFinder(); + $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + + $finder1 = $this->buildFinder(); + $finder1->directories()->in(self::$tmpDir); + + $finder = $finder->append($finder1); + + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); + } + + public function testAppendWithAnArray() + { + $finder = $this->buildFinder(); + $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + + $finder->append($this->toAbsolute(array('foo', 'toto'))); + + $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->getIterator()); + } + + public function testAppendReturnsAFinder() + { + $this->assertInstanceOf('Symfony\\Component\\Finder\\Finder', Finder::create()->append(array())); + } + + public function testAppendDoesNotRequireIn() + { + $finder = $this->buildFinder(); + $finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + + $finder1 = Finder::create()->append($finder); + + $this->assertIterator(iterator_to_array($finder->getIterator()), $finder1->getIterator()); + } + + public function testCountDirectories() + { + $directory = Finder::create()->directories()->in(self::$tmpDir); + $i = 0; + + foreach ($directory as $dir) { + ++$i; + } + + $this->assertCount($i, $directory); + } + + public function testCountFiles() + { + $files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $i = 0; + + foreach ($files as $file) { + ++$i; + } + + $this->assertCount($i, $files); + } + + /** + * @expectedException \LogicException + */ + public function testCountWithoutIn() + { + $finder = Finder::create()->files(); + count($finder); + } + + public function testHasResults() + { + $finder = $this->buildFinder(); + $finder->in(__DIR__); + $this->assertTrue($finder->hasResults()); + } + + public function testNoResults() + { + $finder = $this->buildFinder(); + $finder->in(__DIR__)->name('DoesNotExist'); + $this->assertFalse($finder->hasResults()); + } + + /** + * @dataProvider getContainsTestData + */ + public function testContains($matchPatterns, $noMatchPatterns, $expected) + { + $finder = $this->buildFinder(); + $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') + ->name('*.txt')->sortByName() + ->contains($matchPatterns) + ->notContains($noMatchPatterns); + + $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); + } + + public function testContainsOnDirectory() + { + $finder = $this->buildFinder(); + $finder->in(__DIR__) + ->directories() + ->name('Fixtures') + ->contains('abc'); + $this->assertIterator(array(), $finder); + } + + public function testNotContainsOnDirectory() + { + $finder = $this->buildFinder(); + $finder->in(__DIR__) + ->directories() + ->name('Fixtures') + ->notContains('abc'); + $this->assertIterator(array(), $finder); + } + + /** + * Searching in multiple locations involves AppendIterator which does an unnecessary rewind which leaves FilterIterator + * with inner FilesystemIterator in an invalid state. + * + * @see https://bugs.php.net/68557 + */ + public function testMultipleLocations() + { + $locations = array( + self::$tmpDir.'/', + self::$tmpDir.'/toto/', + ); + + // it is expected that there are test.py test.php in the tmpDir + $finder = new Finder(); + $finder->in($locations) + // the default flag IGNORE_DOT_FILES fixes the problem indirectly + // so we set it to false for better isolation + ->ignoreDotFiles(false) + ->depth('< 1')->name('test.php'); + + $this->assertCount(1, $finder); + } + + /** + * Searching in multiple locations with sub directories involves + * AppendIterator which does an unnecessary rewind which leaves + * FilterIterator with inner FilesystemIterator in an invalid state. + * + * @see https://bugs.php.net/68557 + */ + public function testMultipleLocationsWithSubDirectories() + { + $locations = array( + __DIR__.'/Fixtures/one', + self::$tmpDir.DIRECTORY_SEPARATOR.'toto', + ); + + $finder = $this->buildFinder(); + $finder->in($locations)->depth('< 10')->name('*.neon'); + + $expected = array( + __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', + __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', + ); + + $this->assertIterator($expected, $finder); + $this->assertIteratorInForeach($expected, $finder); + } + + /** + * Iterator keys must be the file pathname. + */ + public function testIteratorKeys() + { + $finder = $this->buildFinder()->in(self::$tmpDir); + foreach ($finder as $key => $file) { + $this->assertEquals($file->getPathname(), $key); + } + } + + public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag() + { + $finder = $this->buildFinder(); + $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s') + ->path('/^dir/'); + + $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat'); + $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); + } + + public function getContainsTestData() + { + return array( + array('', '', array()), + array('foo', 'bar', array()), + array('', 'foobar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')), + array('lorem ipsum dolor sit amet', 'foobar', array('lorem.txt')), + array('sit', 'bar', array('dolor.txt', 'ipsum.txt', 'lorem.txt')), + array('dolor sit amet', '@^L@m', array('dolor.txt', 'ipsum.txt')), + array('/^lorem ipsum dolor sit amet$/m', 'foobar', array('lorem.txt')), + array('lorem', 'foobar', array('lorem.txt')), + array('', 'lorem', array('dolor.txt', 'ipsum.txt')), + array('ipsum dolor sit amet', '/^IPSUM/m', array('lorem.txt')), + ); + } + + public function getRegexNameTestData() + { + return array( + array('~.+\\.p.+~i'), + array('~t.*s~i'), + ); + } + + /** + * @dataProvider getTestPathData + */ + public function testPath($matchPatterns, $noMatchPatterns, array $expected) + { + $finder = $this->buildFinder(); + $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') + ->path($matchPatterns) + ->notPath($noMatchPatterns); + + $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); + } + + public function getTestPathData() + { + return array( + array('', '', array()), + array('/^A\/B\/C/', '/C$/', + array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'), + ), + array('/^A\/B/', 'foobar', + array( + 'A'.DIRECTORY_SEPARATOR.'B', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + ), + ), + array('A/B/C', 'foobar', + array( + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', + ), + ), + array('A/B', 'foobar', + array( + //dirs + 'A'.DIRECTORY_SEPARATOR.'B', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + //files + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy', + 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', + ), + ), + array('/^with space\//', 'foobar', + array( + 'with space'.DIRECTORY_SEPARATOR.'foo.txt', + ), + ), + ); + } + + public function testAccessDeniedException() + { + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('chmod is not supported on Windows'); + } + + $finder = $this->buildFinder(); + $finder->files()->in(self::$tmpDir); + + // make 'foo' directory non-readable + $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; + chmod($testDir, 0333); + + if (false === $couldRead = is_readable($testDir)) { + try { + $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator()); + $this->fail('Finder should throw an exception when opening a non-readable directory.'); + } catch (\Exception $e) { + $expectedExceptionClass = 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException'; + if ($e instanceof \PHPUnit_Framework_ExpectationFailedException) { + $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString())); + } + + if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) { + $this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString())); + } + + $this->assertInstanceOf($expectedExceptionClass, $e); + } + } + + // restore original permissions + chmod($testDir, 0777); + clearstatcache($testDir); + + if ($couldRead) { + $this->markTestSkipped('could read test files while test requires unreadable'); + } + } + + public function testIgnoredAccessDeniedException() + { + if ('\\' === DIRECTORY_SEPARATOR) { + $this->markTestSkipped('chmod is not supported on Windows'); + } + + $finder = $this->buildFinder(); + $finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir); + + // make 'foo' directory non-readable + $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; + chmod($testDir, 0333); + + if (false === ($couldRead = is_readable($testDir))) { + $this->assertIterator($this->toAbsolute(array('foo bar', 'test.php', 'test.py')), $finder->getIterator()); + } + + // restore original permissions + chmod($testDir, 0777); + clearstatcache($testDir); + + if ($couldRead) { + $this->markTestSkipped('could read test files while test requires unreadable'); + } + } + + protected function buildFinder() + { + return Finder::create(); + } +} diff --git a/vendor/symfony/finder/Tests/Fixtures/.dot/a b/vendor/symfony/finder/Tests/Fixtures/.dot/a new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon b/vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon b/vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat b/vendor/symfony/finder/Tests/Fixtures/A/B/C/abc.dat new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat b/vendor/symfony/finder/Tests/Fixtures/A/B/ab.dat new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/A/a.dat b/vendor/symfony/finder/Tests/Fixtures/A/a.dat new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy b/vendor/symfony/finder/Tests/Fixtures/copy/A/B/C/abc.dat.copy new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy b/vendor/symfony/finder/Tests/Fixtures/copy/A/B/ab.dat.copy new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy b/vendor/symfony/finder/Tests/Fixtures/copy/A/a.dat.copy new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/dolor.txt b/vendor/symfony/finder/Tests/Fixtures/dolor.txt new file mode 100644 index 00000000..658bec69 --- /dev/null +++ b/vendor/symfony/finder/Tests/Fixtures/dolor.txt @@ -0,0 +1,2 @@ +dolor sit amet +DOLOR SIT AMET \ No newline at end of file diff --git a/vendor/symfony/finder/Tests/Fixtures/ipsum.txt b/vendor/symfony/finder/Tests/Fixtures/ipsum.txt new file mode 100644 index 00000000..c7f392d6 --- /dev/null +++ b/vendor/symfony/finder/Tests/Fixtures/ipsum.txt @@ -0,0 +1,2 @@ +ipsum dolor sit amet +IPSUM DOLOR SIT AMET \ No newline at end of file diff --git a/vendor/symfony/finder/Tests/Fixtures/lorem.txt b/vendor/symfony/finder/Tests/Fixtures/lorem.txt new file mode 100644 index 00000000..2991a2ca --- /dev/null +++ b/vendor/symfony/finder/Tests/Fixtures/lorem.txt @@ -0,0 +1,2 @@ +lorem ipsum dolor sit amet +LOREM IPSUM DOLOR SIT AMET \ No newline at end of file diff --git a/vendor/symfony/finder/Tests/Fixtures/one/.dot b/vendor/symfony/finder/Tests/Fixtures/one/.dot new file mode 100644 index 00000000..1028065f --- /dev/null +++ b/vendor/symfony/finder/Tests/Fixtures/one/.dot @@ -0,0 +1 @@ +.dot \ No newline at end of file diff --git a/vendor/symfony/finder/Tests/Fixtures/one/a b/vendor/symfony/finder/Tests/Fixtures/one/a new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/one/b/c.neon b/vendor/symfony/finder/Tests/Fixtures/one/b/c.neon new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/one/b/d.neon b/vendor/symfony/finder/Tests/Fixtures/one/b/d.neon new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat b/vendor/symfony/finder/Tests/Fixtures/r+e.gex[c]a(r)s/dir/bar.dat new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/Fixtures/with space/foo.txt b/vendor/symfony/finder/Tests/Fixtures/with space/foo.txt new file mode 100644 index 00000000..e69de29b diff --git a/vendor/symfony/finder/Tests/GlobTest.php b/vendor/symfony/finder/Tests/GlobTest.php new file mode 100644 index 00000000..d48ac1fc --- /dev/null +++ b/vendor/symfony/finder/Tests/GlobTest.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Finder\Finder; +use Symfony\Component\Finder\Glob; + +class GlobTest extends TestCase +{ + public function testGlobToRegexDelimiters() + { + $this->assertEquals('#^(?=[^\.])\#$#', Glob::toRegex('#')); + $this->assertEquals('#^\.[^/]*$#', Glob::toRegex('.*')); + $this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, '')); + $this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/')); + } + + public function testGlobToRegexDoubleStarStrictDots() + { + $finder = new Finder(); + $finder->ignoreDotFiles(false); + $regex = Glob::toRegex('/**/*.neon'); + + foreach ($finder->in(__DIR__) as $k => $v) { + $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, strlen(__DIR__)))) { + $match[] = substr($k, 10 + strlen(__DIR__)); + } + } + sort($match); + + $this->assertSame(array('one/b/c.neon', 'one/b/d.neon'), $match); + } + + public function testGlobToRegexDoubleStarNonStrictDots() + { + $finder = new Finder(); + $finder->ignoreDotFiles(false); + $regex = Glob::toRegex('/**/*.neon', false); + + foreach ($finder->in(__DIR__) as $k => $v) { + $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, strlen(__DIR__)))) { + $match[] = substr($k, 10 + strlen(__DIR__)); + } + } + sort($match); + + $this->assertSame(array('.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'), $match); + } + + public function testGlobToRegexDoubleStarWithoutLeadingSlash() + { + $finder = new Finder(); + $finder->ignoreDotFiles(false); + $regex = Glob::toRegex('/Fixtures/one/**'); + + foreach ($finder->in(__DIR__) as $k => $v) { + $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, strlen(__DIR__)))) { + $match[] = substr($k, 10 + strlen(__DIR__)); + } + } + sort($match); + + $this->assertSame(array('one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match); + } + + public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot() + { + $finder = new Finder(); + $finder->ignoreDotFiles(false); + $regex = Glob::toRegex('/Fixtures/one/**', false); + + foreach ($finder->in(__DIR__) as $k => $v) { + $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, strlen(__DIR__)))) { + $match[] = substr($k, 10 + strlen(__DIR__)); + } + } + sort($match); + + $this->assertSame(array('one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php new file mode 100644 index 00000000..b036ad13 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/CustomFilterIteratorTest.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\CustomFilterIterator; + +class CustomFilterIteratorTest extends IteratorTestCase +{ + /** + * @expectedException \InvalidArgumentException + */ + public function testWithInvalidFilter() + { + new CustomFilterIterator(new Iterator(), array('foo')); + } + + /** + * @dataProvider getAcceptData + */ + public function testAccept($filters, $expected) + { + $inner = new Iterator(array('test.php', 'test.py', 'foo.php')); + + $iterator = new CustomFilterIterator($inner, $filters); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + return array( + array(array(function (\SplFileInfo $fileinfo) { return false; }), array()), + array(array(function (\SplFileInfo $fileinfo) { return 0 === strpos($fileinfo, 'test'); }), array('test.php', 'test.py')), + array(array('is_dir'), array()), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php new file mode 100644 index 00000000..1ec70518 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; +use Symfony\Component\Finder\Comparator\DateComparator; + +class DateRangeFilterIteratorTest extends RealIteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($size, $expected) + { + $files = self::$files; + $files[] = self::toAbsolute('doesnotexist'); + $inner = new Iterator($files); + + $iterator = new DateRangeFilterIterator($inner, $size); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + $since20YearsAgo = array( + '.git', + 'test.py', + 'foo', + 'foo/bar.tmp', + 'test.php', + 'toto', + 'toto/.git', + '.bar', + '.foo', + '.foo/.bar', + 'foo bar', + '.foo/bar', + ); + + $since2MonthsAgo = array( + '.git', + 'test.py', + 'foo', + 'toto', + 'toto/.git', + '.bar', + '.foo', + '.foo/.bar', + 'foo bar', + '.foo/bar', + ); + + $untilLastMonth = array( + 'foo/bar.tmp', + 'test.php', + ); + + return array( + array(array(new DateComparator('since 20 years ago')), $this->toAbsolute($since20YearsAgo)), + array(array(new DateComparator('since 2 months ago')), $this->toAbsolute($since2MonthsAgo)), + array(array(new DateComparator('until last month')), $this->toAbsolute($untilLastMonth)), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php new file mode 100644 index 00000000..2e901405 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/DepthRangeFilterIteratorTest.php @@ -0,0 +1,83 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator; + +class DepthRangeFilterIteratorTest extends RealIteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($minDepth, $maxDepth, $expected) + { + $inner = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); + + $iterator = new DepthRangeFilterIterator($inner, $minDepth, $maxDepth); + + $actual = array_keys(iterator_to_array($iterator)); + sort($expected); + sort($actual); + $this->assertEquals($expected, $actual); + } + + public function getAcceptData() + { + $lessThan1 = array( + '.git', + 'test.py', + 'foo', + 'test.php', + 'toto', + '.foo', + '.bar', + 'foo bar', + ); + + $lessThanOrEqualTo1 = array( + '.git', + 'test.py', + 'foo', + 'foo/bar.tmp', + 'test.php', + 'toto', + 'toto/.git', + '.foo', + '.foo/.bar', + '.bar', + 'foo bar', + '.foo/bar', + ); + + $graterThanOrEqualTo1 = array( + 'toto/.git', + 'foo/bar.tmp', + '.foo/.bar', + '.foo/bar', + ); + + $equalTo1 = array( + 'toto/.git', + 'foo/bar.tmp', + '.foo/.bar', + '.foo/bar', + ); + + return array( + array(0, 0, $this->toAbsolute($lessThan1)), + array(0, 1, $this->toAbsolute($lessThanOrEqualTo1)), + array(2, PHP_INT_MAX, array()), + array(1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)), + array(1, 1, $this->toAbsolute($equalTo1)), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php new file mode 100644 index 00000000..fa192c31 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/ExcludeDirectoryFilterIteratorTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator; +use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; + +class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($directories, $expected) + { + $inner = new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->toAbsolute(), \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); + + $iterator = new ExcludeDirectoryFilterIterator($inner, $directories); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + $foo = array( + '.bar', + '.foo', + '.foo/.bar', + '.foo/bar', + '.git', + 'test.py', + 'test.php', + 'toto', + 'toto/.git', + 'foo bar', + ); + + $fo = array( + '.bar', + '.foo', + '.foo/.bar', + '.foo/bar', + '.git', + 'test.py', + 'foo', + 'foo/bar.tmp', + 'test.php', + 'toto', + 'toto/.git', + 'foo bar', + ); + + $toto = array( + '.bar', + '.foo', + '.foo/.bar', + '.foo/bar', + '.git', + 'test.py', + 'foo', + 'foo/bar.tmp', + 'test.php', + 'foo bar', + ); + + return array( + array(array('foo'), $this->toAbsolute($foo)), + array(array('fo'), $this->toAbsolute($fo)), + array(array('toto/'), $this->toAbsolute($toto)), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php new file mode 100644 index 00000000..4350b00c --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/FileTypeFilterIteratorTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\FileTypeFilterIterator; + +class FileTypeFilterIteratorTest extends RealIteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($mode, $expected) + { + $inner = new InnerTypeIterator(self::$files); + + $iterator = new FileTypeFilterIterator($inner, $mode); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + $onlyFiles = array( + 'test.py', + 'foo/bar.tmp', + 'test.php', + '.bar', + '.foo/.bar', + '.foo/bar', + 'foo bar', + ); + + $onlyDirectories = array( + '.git', + 'foo', + 'toto', + 'toto/.git', + '.foo', + ); + + return array( + array(FileTypeFilterIterator::ONLY_FILES, $this->toAbsolute($onlyFiles)), + array(FileTypeFilterIterator::ONLY_DIRECTORIES, $this->toAbsolute($onlyDirectories)), + ); + } +} + +class InnerTypeIterator extends \ArrayIterator +{ + public function current() + { + return new \SplFileInfo(parent::current()); + } + + public function isFile() + { + return $this->current()->isFile(); + } + + public function isDir() + { + return $this->current()->isDir(); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php new file mode 100644 index 00000000..744bdae1 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/FilecontentFilterIteratorTest.php @@ -0,0 +1,86 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\FilecontentFilterIterator; + +class FilecontentFilterIteratorTest extends IteratorTestCase +{ + public function testAccept() + { + $inner = new MockFileListIterator(array('test.txt')); + $iterator = new FilecontentFilterIterator($inner, array(), array()); + $this->assertIterator(array('test.txt'), $iterator); + } + + public function testDirectory() + { + $inner = new MockFileListIterator(array('directory')); + $iterator = new FilecontentFilterIterator($inner, array('directory'), array()); + $this->assertIterator(array(), $iterator); + } + + public function testUnreadableFile() + { + $inner = new MockFileListIterator(array('file r-')); + $iterator = new FilecontentFilterIterator($inner, array('file r-'), array()); + $this->assertIterator(array(), $iterator); + } + + /** + * @dataProvider getTestFilterData + */ + public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray) + { + $iterator = new FilecontentFilterIterator($inner, $matchPatterns, $noMatchPatterns); + $this->assertIterator($resultArray, $iterator); + } + + public function getTestFilterData() + { + $inner = new MockFileListIterator(); + + $inner[] = new MockSplFileInfo(array( + 'name' => 'a.txt', + 'contents' => 'Lorem ipsum...', + 'type' => 'file', + 'mode' => 'r+', ) + ); + + $inner[] = new MockSplFileInfo(array( + 'name' => 'b.yml', + 'contents' => 'dolor sit...', + 'type' => 'file', + 'mode' => 'r+', ) + ); + + $inner[] = new MockSplFileInfo(array( + 'name' => 'some/other/dir/third.php', + 'contents' => 'amet...', + 'type' => 'file', + 'mode' => 'r+', ) + ); + + $inner[] = new MockSplFileInfo(array( + 'name' => 'unreadable-file.txt', + 'contents' => false, + 'type' => 'file', + 'mode' => 'r+', ) + ); + + return array( + array($inner, array('.'), array(), array('a.txt', 'b.yml', 'some/other/dir/third.php')), + array($inner, array('ipsum'), array(), array('a.txt')), + array($inner, array('i', 'amet'), array('Lorem', 'amet'), array('b.yml')), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php new file mode 100644 index 00000000..c4b97959 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/FilenameFilterIteratorTest.php @@ -0,0 +1,54 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\FilenameFilterIterator; + +class FilenameFilterIteratorTest extends IteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($matchPatterns, $noMatchPatterns, $expected) + { + $inner = new InnerNameIterator(array('test.php', 'test.py', 'foo.php')); + + $iterator = new FilenameFilterIterator($inner, $matchPatterns, $noMatchPatterns); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + return array( + array(array('test.*'), array(), array('test.php', 'test.py')), + array(array(), array('test.*'), array('foo.php')), + array(array('*.php'), array('test.*'), array('foo.php')), + array(array('*.php', '*.py'), array('foo.*'), array('test.php', 'test.py')), + array(array('/\.php$/'), array(), array('test.php', 'foo.php')), + array(array(), array('/\.php$/'), array('test.py')), + ); + } +} + +class InnerNameIterator extends \ArrayIterator +{ + public function current() + { + return new \SplFileInfo(parent::current()); + } + + public function getFilename() + { + return parent::current(); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php new file mode 100644 index 00000000..8b1a4482 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/FilterIteratorTest.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +/** + * @author Alex Bogomazov + * + * @group legacy + */ +class FilterIteratorTest extends RealIteratorTestCase +{ + public function testFilterFilesystemIterators() + { + $i = new \FilesystemIterator($this->toAbsolute()); + + // it is expected that there are test.py test.php in the tmpDir + $i = $this->getMockForAbstractClass('Symfony\Component\Finder\Iterator\FilterIterator', array($i)); + $i->expects($this->any()) + ->method('accept') + ->will($this->returnCallback(function () use ($i) { + return (bool) preg_match('/\.php/', (string) $i->current()); + }) + ); + + $c = 0; + foreach ($i as $item) { + ++$c; + } + + $this->assertEquals(1, $c); + + $i->rewind(); + + $c = 0; + foreach ($i as $item) { + ++$c; + } + + // This would fail in php older than 5.5.23/5.6.7 with \FilterIterator + // but works with Symfony\Component\Finder\Iterator\FilterIterator + // see https://bugs.php.net/68557 + $this->assertEquals(1, $c); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/Iterator.php b/vendor/symfony/finder/Tests/Iterator/Iterator.php new file mode 100644 index 00000000..849bf081 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/Iterator.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +class Iterator implements \Iterator +{ + protected $values = array(); + + public function __construct(array $values = array()) + { + foreach ($values as $value) { + $this->attach(new \SplFileInfo($value)); + } + $this->rewind(); + } + + public function attach(\SplFileInfo $fileinfo) + { + $this->values[] = $fileinfo; + } + + public function rewind() + { + reset($this->values); + } + + public function valid() + { + return false !== $this->current(); + } + + public function next() + { + next($this->values); + } + + public function current() + { + return current($this->values); + } + + public function key() + { + return key($this->values); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php new file mode 100644 index 00000000..c724a75c --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php @@ -0,0 +1,100 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use PHPUnit\Framework\TestCase; + +abstract class IteratorTestCase extends TestCase +{ + protected function assertIterator($expected, \Traversable $iterator) + { + // set iterator_to_array $use_key to false to avoid values merge + // this made FinderTest::testAppendWithAnArray() fail with GnuFinderAdapter + $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false)); + + $expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected); + + sort($values); + sort($expected); + + $this->assertEquals($expected, array_values($values)); + } + + protected function assertOrderedIterator($expected, \Traversable $iterator) + { + $values = array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator)); + + $this->assertEquals($expected, array_values($values)); + } + + /** + * Same as assertOrderedIterator, but checks the order of groups of + * array elements. + * + * @param array $expected - an array of arrays. For any two subarrays + * $a and $b such that $a goes before $b in $expected, the method + * asserts that any element of $a goes before any element of $b + * in the sequence generated by $iterator + * @param \Traversable $iterator + */ + protected function assertOrderedIteratorForGroups($expected, \Traversable $iterator) + { + $values = array_values(array_map(function (\SplFileInfo $fileinfo) { return $fileinfo->getPathname(); }, iterator_to_array($iterator))); + + foreach ($expected as $subarray) { + $temp = array(); + while (count($values) && count($temp) < count($subarray)) { + $temp[] = array_shift($values); + } + sort($temp); + sort($subarray); + $this->assertEquals($subarray, $temp); + } + } + + /** + * Same as IteratorTestCase::assertIterator with foreach usage. + * + * @param array $expected + * @param \Traversable $iterator + */ + protected function assertIteratorInForeach($expected, \Traversable $iterator) + { + $values = array(); + foreach ($iterator as $file) { + $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file); + $values[] = $file->getPathname(); + } + + sort($values); + sort($expected); + + $this->assertEquals($expected, array_values($values)); + } + + /** + * Same as IteratorTestCase::assertOrderedIterator with foreach usage. + * + * @param array $expected + * @param \Traversable $iterator + */ + protected function assertOrderedIteratorInForeach($expected, \Traversable $iterator) + { + $values = array(); + foreach ($iterator as $file) { + $this->assertInstanceOf('Symfony\\Component\\Finder\\SplFileInfo', $file); + $values[] = $file->getPathname(); + } + + $this->assertEquals($expected, array_values($values)); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php b/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php new file mode 100644 index 00000000..eb0adfad --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/MockFileListIterator.php @@ -0,0 +1,21 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +class MockFileListIterator extends \ArrayIterator +{ + public function __construct(array $filesArray = array()) + { + $files = array_map(function ($file) { return new MockSplFileInfo($file); }, $filesArray); + parent::__construct($files); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php new file mode 100644 index 00000000..cfe31c90 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php @@ -0,0 +1,132 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +class MockSplFileInfo extends \SplFileInfo +{ + const TYPE_DIRECTORY = 1; + const TYPE_FILE = 2; + const TYPE_UNKNOWN = 3; + + private $contents = null; + private $mode = null; + private $type = null; + private $relativePath = null; + private $relativePathname = null; + + public function __construct($param) + { + if (is_string($param)) { + parent::__construct($param); + } elseif (is_array($param)) { + $defaults = array( + 'name' => 'file.txt', + 'contents' => null, + 'mode' => null, + 'type' => null, + 'relativePath' => null, + 'relativePathname' => null, + ); + $defaults = array_merge($defaults, $param); + parent::__construct($defaults['name']); + $this->setContents($defaults['contents']); + $this->setMode($defaults['mode']); + $this->setType($defaults['type']); + $this->setRelativePath($defaults['relativePath']); + $this->setRelativePathname($defaults['relativePathname']); + } else { + throw new \RuntimeException(sprintf('Incorrect parameter "%s"', $param)); + } + } + + public function isFile() + { + if (null === $this->type) { + return false !== strpos($this->getFilename(), 'file'); + } + + return self::TYPE_FILE === $this->type; + } + + public function isDir() + { + if (null === $this->type) { + return false !== strpos($this->getFilename(), 'directory'); + } + + return self::TYPE_DIRECTORY === $this->type; + } + + public function isReadable() + { + if (null === $this->mode) { + return preg_match('/r\+/', $this->getFilename()); + } + + return preg_match('/r\+/', $this->mode); + } + + public function getContents() + { + return $this->contents; + } + + public function setContents($contents) + { + $this->contents = $contents; + } + + public function setMode($mode) + { + $this->mode = $mode; + } + + public function setType($type) + { + if (is_string($type)) { + switch ($type) { + case 'directory': + case 'd': + $this->type = self::TYPE_DIRECTORY; + break; + case 'file': + case 'f': + $this->type = self::TYPE_FILE; + break; + default: + $this->type = self::TYPE_UNKNOWN; + } + } else { + $this->type = $type; + } + } + + public function setRelativePath($relativePath) + { + $this->relativePath = $relativePath; + } + + public function setRelativePathname($relativePathname) + { + $this->relativePathname = $relativePathname; + } + + public function getRelativePath() + { + return $this->relativePath; + } + + public function getRelativePathname() + { + return $this->relativePathname; + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php new file mode 100644 index 00000000..f2c1cd24 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator; + +class MultiplePcreFilterIteratorTest extends TestCase +{ + /** + * @dataProvider getIsRegexFixtures + */ + public function testIsRegex($string, $isRegex, $message) + { + $testIterator = new TestMultiplePcreFilterIterator(); + $this->assertEquals($isRegex, $testIterator->isRegex($string), $message); + } + + public function getIsRegexFixtures() + { + return array( + array('foo', false, 'string'), + array(' foo ', false, '" " is not a valid delimiter'), + array('\\foo\\', false, '"\\" is not a valid delimiter'), + array('afooa', false, '"a" is not a valid delimiter'), + array('//', false, 'the pattern should contain at least 1 character'), + array('/a/', true, 'valid regex'), + array('/foo/', true, 'valid regex'), + array('/foo/i', true, 'valid regex with a single modifier'), + array('/foo/imsxu', true, 'valid regex with multiple modifiers'), + array('#foo#', true, '"#" is a valid delimiter'), + array('{foo}', true, '"{,}" is a valid delimiter pair'), + array('[foo]', true, '"[,]" is a valid delimiter pair'), + array('(foo)', true, '"(,)" is a valid delimiter pair'), + array('', true, '"<,>" is a valid delimiter pair'), + array('*foo.*', false, '"*" is not considered as a valid delimiter'), + array('?foo.?', false, '"?" is not considered as a valid delimiter'), + ); + } +} + +class TestMultiplePcreFilterIterator extends MultiplePcreFilterIterator +{ + public function __construct() + { + } + + public function accept() + { + throw new \BadFunctionCallException('Not implemented'); + } + + public function isRegex($str) + { + return parent::isRegex($str); + } + + public function toRegex($str) + { + throw new \BadFunctionCallException('Not implemented'); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php new file mode 100644 index 00000000..6e10550c --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\PathFilterIterator; + +class PathFilterIteratorTest extends IteratorTestCase +{ + /** + * @dataProvider getTestFilterData + */ + public function testFilter(\Iterator $inner, array $matchPatterns, array $noMatchPatterns, array $resultArray) + { + $iterator = new PathFilterIterator($inner, $matchPatterns, $noMatchPatterns); + $this->assertIterator($resultArray, $iterator); + } + + public function getTestFilterData() + { + $inner = new MockFileListIterator(); + + //PATH: A/B/C/abc.dat + $inner[] = new MockSplFileInfo(array( + 'name' => 'abc.dat', + 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + )); + + //PATH: A/B/ab.dat + $inner[] = new MockSplFileInfo(array( + 'name' => 'ab.dat', + 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + )); + + //PATH: A/a.dat + $inner[] = new MockSplFileInfo(array( + 'name' => 'a.dat', + 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat', + )); + + //PATH: copy/A/B/C/abc.dat.copy + $inner[] = new MockSplFileInfo(array( + 'name' => 'abc.dat.copy', + 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + )); + + //PATH: copy/A/B/ab.dat.copy + $inner[] = new MockSplFileInfo(array( + 'name' => 'ab.dat.copy', + 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + )); + + //PATH: copy/A/a.dat.copy + $inner[] = new MockSplFileInfo(array( + 'name' => 'a.dat.copy', + 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat', + )); + + return array( + array($inner, array('/^A/'), array(), array('abc.dat', 'ab.dat', 'a.dat')), + array($inner, array('/^A\/B/'), array(), array('abc.dat', 'ab.dat')), + array($inner, array('/^A\/B\/C/'), array(), array('abc.dat')), + array($inner, array('/A\/B\/C/'), array(), array('abc.dat', 'abc.dat.copy')), + + array($inner, array('A'), array(), array('abc.dat', 'ab.dat', 'a.dat', 'abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')), + array($inner, array('A/B'), array(), array('abc.dat', 'ab.dat', 'abc.dat.copy', 'ab.dat.copy')), + array($inner, array('A/B/C'), array(), array('abc.dat', 'abc.dat.copy')), + + array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')), + array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')), + array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')), + ); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php new file mode 100644 index 00000000..94253c7e --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php @@ -0,0 +1,110 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +abstract class RealIteratorTestCase extends IteratorTestCase +{ + protected static $tmpDir; + protected static $files; + + public static function setUpBeforeClass() + { + self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; + + self::$files = array( + '.git/', + '.foo/', + '.foo/.bar', + '.foo/bar', + '.bar', + 'test.py', + 'foo/', + 'foo/bar.tmp', + 'test.php', + 'toto/', + 'toto/.git/', + 'foo bar', + ); + + self::$files = self::toAbsolute(self::$files); + + if (is_dir(self::$tmpDir)) { + self::tearDownAfterClass(); + } else { + mkdir(self::$tmpDir); + } + + foreach (self::$files as $file) { + if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { + mkdir($file); + } else { + touch($file); + } + } + + file_put_contents(self::toAbsolute('test.php'), str_repeat(' ', 800)); + file_put_contents(self::toAbsolute('test.py'), str_repeat(' ', 2000)); + + touch(self::toAbsolute('foo/bar.tmp'), strtotime('2005-10-15')); + touch(self::toAbsolute('test.php'), strtotime('2005-10-15')); + } + + public static function tearDownAfterClass() + { + foreach (array_reverse(self::$files) as $file) { + if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { + @rmdir($file); + } else { + @unlink($file); + } + } + } + + protected static function toAbsolute($files = null) + { + /* + * Without the call to setUpBeforeClass() property can be null. + */ + if (!self::$tmpDir) { + self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; + } + + if (is_array($files)) { + $f = array(); + foreach ($files as $file) { + if (is_array($file)) { + $f[] = self::toAbsolute($file); + } else { + $f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file); + } + } + + return $f; + } + + if (is_string($files)) { + return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files); + } + + return self::$tmpDir; + } + + protected static function toAbsoluteFixtures($files) + { + $f = array(); + foreach ($files as $file) { + $f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file); + } + + return $f; + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php new file mode 100644 index 00000000..3a3ddc4d --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator; + +class RecursiveDirectoryIteratorTest extends IteratorTestCase +{ + /** + * @group network + */ + public function testRewindOnFtp() + { + try { + $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + } catch (\UnexpectedValueException $e) { + $this->markTestSkipped('Unsupported stream "ftp".'); + } + + $i->rewind(); + + $this->assertTrue(true); + } + + /** + * @group network + */ + public function testSeekOnFtp() + { + try { + $i = new RecursiveDirectoryIterator('ftp://speedtest.tele2.net/', \RecursiveDirectoryIterator::SKIP_DOTS); + } catch (\UnexpectedValueException $e) { + $this->markTestSkipped('Unsupported stream "ftp".'); + } + + $contains = array( + 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'1000GB.zip', + 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'100GB.zip', + ); + $actual = array(); + + $i->seek(0); + $actual[] = $i->getPathname(); + + $i->seek(1); + $actual[] = $i->getPathname(); + + $this->assertEquals($contains, $actual); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php new file mode 100644 index 00000000..6d75b0f2 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; +use Symfony\Component\Finder\Comparator\NumberComparator; + +class SizeRangeFilterIteratorTest extends RealIteratorTestCase +{ + /** + * @dataProvider getAcceptData + */ + public function testAccept($size, $expected) + { + $inner = new InnerSizeIterator(self::$files); + + $iterator = new SizeRangeFilterIterator($inner, $size); + + $this->assertIterator($expected, $iterator); + } + + public function getAcceptData() + { + $lessThan1KGreaterThan05K = array( + '.foo', + '.git', + 'foo', + 'test.php', + 'toto', + 'toto/.git', + ); + + return array( + array(array(new NumberComparator('< 1K'), new NumberComparator('> 0.5K')), $this->toAbsolute($lessThan1KGreaterThan05K)), + ); + } +} + +class InnerSizeIterator extends \ArrayIterator +{ + public function current() + { + return new \SplFileInfo(parent::current()); + } + + public function getFilename() + { + return parent::current(); + } + + public function isFile() + { + return $this->current()->isFile(); + } + + public function getSize() + { + return $this->current()->getSize(); + } +} diff --git a/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php new file mode 100644 index 00000000..444654a2 --- /dev/null +++ b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php @@ -0,0 +1,183 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Finder\Tests\Iterator; + +use Symfony\Component\Finder\Iterator\SortableIterator; + +class SortableIteratorTest extends RealIteratorTestCase +{ + public function testConstructor() + { + try { + new SortableIterator(new Iterator(array()), 'foobar'); + $this->fail('__construct() throws an \InvalidArgumentException exception if the mode is not valid'); + } catch (\Exception $e) { + $this->assertInstanceOf('InvalidArgumentException', $e, '__construct() throws an \InvalidArgumentException exception if the mode is not valid'); + } + } + + /** + * @dataProvider getAcceptData + */ + public function testAccept($mode, $expected) + { + if (!is_callable($mode)) { + switch ($mode) { + case SortableIterator::SORT_BY_ACCESSED_TIME: + if ('\\' === DIRECTORY_SEPARATOR) { + touch(self::toAbsolute('.git')); + } else { + file_get_contents(self::toAbsolute('.git')); + } + sleep(1); + file_get_contents(self::toAbsolute('.bar')); + break; + case SortableIterator::SORT_BY_CHANGED_TIME: + file_put_contents(self::toAbsolute('test.php'), 'foo'); + sleep(1); + file_put_contents(self::toAbsolute('test.py'), 'foo'); + break; + case SortableIterator::SORT_BY_MODIFIED_TIME: + file_put_contents(self::toAbsolute('test.php'), 'foo'); + sleep(1); + file_put_contents(self::toAbsolute('test.py'), 'foo'); + break; + } + } + + $inner = new Iterator(self::$files); + + $iterator = new SortableIterator($inner, $mode); + + if (SortableIterator::SORT_BY_ACCESSED_TIME === $mode + || SortableIterator::SORT_BY_CHANGED_TIME === $mode + || SortableIterator::SORT_BY_MODIFIED_TIME === $mode + ) { + if ('\\' === DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) { + $this->markTestSkipped('Sorting by atime or ctime is not supported on Windows'); + } + $this->assertOrderedIteratorForGroups($expected, $iterator); + } else { + $this->assertOrderedIterator($expected, $iterator); + } + } + + public function getAcceptData() + { + $sortByName = array( + '.bar', + '.foo', + '.foo/.bar', + '.foo/bar', + '.git', + 'foo', + 'foo bar', + 'foo/bar.tmp', + 'test.php', + 'test.py', + 'toto', + 'toto/.git', + ); + + $sortByType = array( + '.foo', + '.git', + 'foo', + 'toto', + 'toto/.git', + '.bar', + '.foo/.bar', + '.foo/bar', + 'foo bar', + 'foo/bar.tmp', + 'test.php', + 'test.py', + ); + + $customComparison = array( + '.bar', + '.foo', + '.foo/.bar', + '.foo/bar', + '.git', + 'foo', + 'foo bar', + 'foo/bar.tmp', + 'test.php', + 'test.py', + 'toto', + 'toto/.git', + ); + + $sortByAccessedTime = array( + // For these two files the access time was set to 2005-10-15 + array('foo/bar.tmp', 'test.php'), + // These files were created more or less at the same time + array( + '.git', + '.foo', + '.foo/.bar', + '.foo/bar', + 'test.py', + 'foo', + 'toto', + 'toto/.git', + 'foo bar', + ), + // This file was accessed after sleeping for 1 sec + array('.bar'), + ); + + $sortByChangedTime = array( + array( + '.git', + '.foo', + '.foo/.bar', + '.foo/bar', + '.bar', + 'foo', + 'foo/bar.tmp', + 'toto', + 'toto/.git', + 'foo bar', + ), + array('test.php'), + array('test.py'), + ); + + $sortByModifiedTime = array( + array( + '.git', + '.foo', + '.foo/.bar', + '.foo/bar', + '.bar', + 'foo', + 'foo/bar.tmp', + 'toto', + 'toto/.git', + 'foo bar', + ), + array('test.php'), + array('test.py'), + ); + + return array( + array(SortableIterator::SORT_BY_NAME, $this->toAbsolute($sortByName)), + array(SortableIterator::SORT_BY_TYPE, $this->toAbsolute($sortByType)), + array(SortableIterator::SORT_BY_ACCESSED_TIME, $this->toAbsolute($sortByAccessedTime)), + array(SortableIterator::SORT_BY_CHANGED_TIME, $this->toAbsolute($sortByChangedTime)), + array(SortableIterator::SORT_BY_MODIFIED_TIME, $this->toAbsolute($sortByModifiedTime)), + array(function (\SplFileInfo $a, \SplFileInfo $b) { return strcmp($a->getRealPath(), $b->getRealPath()); }, $this->toAbsolute($customComparison)), + ); + } +} diff --git a/vendor/symfony/finder/composer.json b/vendor/symfony/finder/composer.json new file mode 100644 index 00000000..de19826f --- /dev/null +++ b/vendor/symfony/finder/composer.json @@ -0,0 +1,33 @@ +{ + "name": "symfony/finder", + "type": "library", + "description": "Symfony Finder Component", + "keywords": [], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "autoload": { + "psr-4": { "Symfony\\Component\\Finder\\": "" }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + } +} diff --git a/vendor/symfony/finder/phpunit.xml.dist b/vendor/symfony/finder/phpunit.xml.dist new file mode 100644 index 00000000..0e1a8669 --- /dev/null +++ b/vendor/symfony/finder/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + + + + + ./Tests/ + + + + + + ./ + + ./Tests + ./vendor + + + + -- cgit v1.2.3