summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-12-01 20:48:40 +0000
committerGreg Roach <fisharebest@webtrees.net>2018-12-01 20:49:00 +0000
commit8b04670a78742b3f7e8852b5533a6c5e1d47dd73 (patch)
tree86f3eed5c787b65a61d43ab899335b76b48d1b09
parentd8fb195efff574939b79b1e0cc3bb0094b6570c1 (diff)
downloadwebtrees-8b04670a78742b3f7e8852b5533a6c5e1d47dd73.tar.gz
webtrees-8b04670a78742b3f7e8852b5533a6c5e1d47dd73.tar.bz2
webtrees-8b04670a78742b3f7e8852b5533a6c5e1d47dd73.zip
Update swiftmailer from v5 to v6
-rw-r--r--app/Functions/FunctionsEdit.php13
-rw-r--r--app/Http/Controllers/AdminPhpGedViewController.php2
-rw-r--r--app/Http/Controllers/AdminSiteController.php1
-rw-r--r--app/Http/Controllers/MessageController.php2
-rw-r--r--app/Mail.php41
-rw-r--r--composer.json2
-rw-r--r--composer.lock134
-rw-r--r--vendor/composer/autoload_namespaces.php1
-rw-r--r--vendor/composer/autoload_psr4.php1
-rw-r--r--vendor/composer/autoload_static.php19
-rw-r--r--vendor/composer/installed.json138
-rw-r--r--vendor/doctrine/lexer/LICENSE19
-rw-r--r--vendor/doctrine/lexer/README.md5
-rw-r--r--vendor/doctrine/lexer/composer.json24
-rw-r--r--vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php327
-rw-r--r--vendor/egulias/email-validator/EmailValidator/EmailLexer.php221
-rw-r--r--vendor/egulias/email-validator/EmailValidator/EmailParser.php104
-rw-r--r--vendor/egulias/email-validator/EmailValidator/EmailValidator.php67
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/CRLFAtTheEnd.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/CRLFX2.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/CRNoLF.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/CharNotAllowed.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/CommaInDomain.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveAt.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveDot.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/DotAtStart.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDTEXT.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDomainLiteralClose.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php11
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/NoLocalPart.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/UnclosedComment.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/UnclosedQuotedString.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Exception/UnopenedComment.php9
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php368
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php138
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Parser/Parser.php215
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php72
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php34
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/Error/RFCWarnings.php11
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/Error/SpoofEmail.php11
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php26
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php110
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php41
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php49
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php45
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/Comment.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php15
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php15
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php14
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/TLD.php13
-rw-r--r--vendor/egulias/email-validator/EmailValidator/Warning/Warning.php30
-rw-r--r--vendor/egulias/email-validator/LICENSE19
-rw-r--r--vendor/egulias/email-validator/README.md79
-rw-r--r--vendor/egulias/email-validator/composer.json44
-rw-r--r--vendor/egulias/email-validator/phpunit.xml.dist26
-rw-r--r--vendor/swiftmailer/swiftmailer/.gitattributes2
-rw-r--r--vendor/swiftmailer/swiftmailer/.php_cs.dist9
-rw-r--r--vendor/swiftmailer/swiftmailer/.travis.yml10
-rw-r--r--vendor/swiftmailer/swiftmailer/CHANGES61
-rw-r--r--vendor/swiftmailer/swiftmailer/LICENSE2
-rw-r--r--vendor/swiftmailer/swiftmailer/README2
-rw-r--r--vendor/swiftmailer/swiftmailer/VERSION1
-rw-r--r--vendor/swiftmailer/swiftmailer/composer.json15
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/headers.rst390
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/help-resources.rst44
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/including-the-files.rst46
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/index.rst4
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/installing.rst89
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/introduction.rst150
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/japanese.rst7
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/messages.rst768
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/overview.rst159
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/plugins.rst200
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/sending.rst402
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/uml/Encoders.grafflebin3503 -> 0 bytes
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/uml/Mime.grafflebin5575 -> 0 bytes
-rw-r--r--vendor/swiftmailer/swiftmailer/doc/uml/Transports.grafflebin3061 -> 0 bytes
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder.php25
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php69
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/Utf8AddressEncoder.php36
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoderException.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php27
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php65
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php56
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php133
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php68
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php128
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php113
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php138
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php90
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php62
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php19
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php17
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php29
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php63
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php9
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php38
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/IdGenerator.php22
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php5
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php57
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php120
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php47
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php36
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php60
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php35
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php11
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php79
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php42
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php38
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php9
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php176
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php78
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php169
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php163
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php60
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php56
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php57
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php57
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php17
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php54
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Message.php223
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php117
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php68
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php34
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php90
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php151
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php139
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php434
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php36
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php40
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php68
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php115
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php64
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php21
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php7
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php62
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/SignedMessage.php23
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php1
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php332
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php208
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php83
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php428
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php26
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php72
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php5
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php31
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php330
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php136
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php79
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php113
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php107
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php189
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php51
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php67
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php297
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php27
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php42
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php39
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php39
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php192
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php5
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/classes/Swift/Validate.php43
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php87
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php69
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/mime_types.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/preferences.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/swift_init.php28
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/swift_required.php26
-rw-r--r--vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php30
-rwxr-xr-xvendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php25
-rw-r--r--vendor/swiftmailer/swiftmailer/phpunit.xml.dist1
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php58
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php100
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php30
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php132
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php136
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php45
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php30
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php30
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php45
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php49
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php347
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php76
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php34
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php22
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php24
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php28
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php8
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php24
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php40
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php3
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php4
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php67
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php12
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php168
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php141
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php30
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php78
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php6
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php16
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php53
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php50
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php14
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php20
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php150
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php22
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php22
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php60
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php24
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php482
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php169
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php64
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php50
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php126
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php58
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php83
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php97
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php226
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php124
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php50
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php80
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/IdGeneratorTest.php32
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php127
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php77
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php333
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php526
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php7
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php96
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php131
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php76
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php2
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php104
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php52
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php44
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php26
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php57
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php215
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php84
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php10
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php18
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php190
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php537
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php43
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php51
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php105
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php35
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php78
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php154
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php418
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php136
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php159
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php533
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php69
-rw-r--r--vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php26
372 files changed, 11917 insertions, 10547 deletions
diff --git a/app/Functions/FunctionsEdit.php b/app/Functions/FunctionsEdit.php
index 3685ef596e..7fbb6c4a7e 100644
--- a/app/Functions/FunctionsEdit.php
+++ b/app/Functions/FunctionsEdit.php
@@ -241,19 +241,6 @@ class FunctionsEdit
}
/**
- * A list mail transport options (e.g. for an edit control).
- *
- * @return string[]
- */
- public static function optionsMailTransports(): array
- {
- return [
- 'internal' => I18N::translate('Use PHP mail to send messages'),
- 'external' => I18N::translate('Use SMTP to send messages'),
- ];
- }
-
- /**
* A list of temple options (e.g. for an edit control).
*
* @return string[]
diff --git a/app/Http/Controllers/AdminPhpGedViewController.php b/app/Http/Controllers/AdminPhpGedViewController.php
index 3c9b3b42bb..427e67710c 100644
--- a/app/Http/Controllers/AdminPhpGedViewController.php
+++ b/app/Http/Controllers/AdminPhpGedViewController.php
@@ -289,7 +289,7 @@ class AdminPhpGedViewController extends AbstractBaseController
Site::setPreference('USE_REGISTRATION_MODULE', $config['USE_REGISTRATION_MODULE'] ?? '');
Site::setPreference('ALLOW_USER_THEMES', $config['ALLOW_USER_THEMES'] ?? '');
Site::setPreference('ALLOW_CHANGE_GEDCOM', $config['ALLOW_CHANGE_GEDCOM'] ?? '');
- Site::setPreference('SMTP_ACTIVE', ($config['PGV_SMTP_ACTIVE'] ?? '') ? 'external' : 'internal');
+ Site::setPreference('SMTP_ACTIVE', ($config['PGV_SMTP_ACTIVE'] ?? '') ? 'external' : 'sendmail');
Site::setPreference('SMTP_HOST', $config['PGV_SMTP_HOST'] ?? '');
Site::setPreference('SMTP_HELO', $config['PGV_SMTP_HELO'] ?? '');
Site::setPreference('SMTP_PORT', $config['PGV_SMTP_PORT'] ?? '');
diff --git a/app/Http/Controllers/AdminSiteController.php b/app/Http/Controllers/AdminSiteController.php
index d664ec7219..d7fe4e552c 100644
--- a/app/Http/Controllers/AdminSiteController.php
+++ b/app/Http/Controllers/AdminSiteController.php
@@ -662,7 +662,6 @@ class AdminSiteController extends AbstractBaseController
private function mailTransportOptions(): array
{
$options = [
- 'internal' => I18N::translate('Use PHP mail to send messages'),
/* I18N: "sendmail" is the name of some mail software */
'sendmail' => I18N::translate('Use sendmail to send messages'),
'external' => I18N::translate('Use SMTP to send messages'),
diff --git a/app/Http/Controllers/MessageController.php b/app/Http/Controllers/MessageController.php
index 6f9a7dac03..7b45c6d65c 100644
--- a/app/Http/Controllers/MessageController.php
+++ b/app/Http/Controllers/MessageController.php
@@ -183,7 +183,7 @@ class MessageController extends AbstractBaseController
throw new AccessDeniedHttpException('Invalid contact user id');
}
- $errors = $body !== '' && $subject !== '' && $from_email !== '' && $from_name !== '';
+ $errors = $body === '' || $subject === '' || $from_email === '' || $from_name === '';
if (!preg_match('/^[^@]+@([^@]+)$/', $from_email, $match) || !checkdnsrr($match[1])) {
FlashMessages::addMessage(I18N::translate('Please enter a valid email address.'), 'danger');
diff --git a/app/Mail.php b/app/Mail.php
index 39416730fe..3e4cb910ab 100644
--- a/app/Mail.php
+++ b/app/Mail.php
@@ -19,7 +19,6 @@ namespace Fisharebest\Webtrees;
use Exception;
use Swift_Mailer;
-use Swift_MailTransport;
use Swift_Message;
use Swift_NullTransport;
use Swift_Preferences;
@@ -56,15 +55,15 @@ class Mail
$message_text = preg_replace('/\r?\n/', "\r\n", $message_text);
$message_html = preg_replace('/\r?\n/', "\r\n", $message_html);
- $message = Swift_Message::newInstance()
- ->setSubject($subject)
+ $message = (new Swift_Message($subject))
->setFrom($from->getEmail(), $from->getRealName())
->setTo($to->getEmail(), $to->getRealName())
->setReplyTo($reply_to->getEmail(), $reply_to->getRealName())
->setBody($message_html, 'text/html')
->addPart($message_text, 'text/plain');
- Swift_Mailer::newInstance(self::transport())->send($message);
+ $mailer = new Swift_Mailer(self::transport());
+ $mailer->send($message);
} catch (Exception $ex) {
DebugBar::addThrowable($ex);
@@ -84,30 +83,34 @@ class Mail
public static function transport()
{
switch (Site::getPreference('SMTP_ACTIVE')) {
- case 'internal':
- return Swift_MailTransport::newInstance();
case 'sendmail':
- return Swift_SendmailTransport::newInstance();
+ // Local sendmail (requires PHP proc_* functions)
+ return new Swift_SendmailTransport();
+
case 'external':
- $transport = Swift_SmtpTransport::newInstance()
- ->setHost(Site::getPreference('SMTP_HOST'))
- ->setPort((int) Site::getPreference('SMTP_PORT', '25'))
- ->setLocalDomain(Site::getPreference('SMTP_HELO'));
+ // SMTP
+ $smtp_host = Site::getPreference('SMTP_HOST');
+ $smtp_port = (int) Site::getPreference('SMTP_PORT', '25');
+ $smtp_auth = Site::getPreference('SMTP_AUTH');
+ $smtp_user = Site::getPreference('SMTP_AUTH_USER');
+ $smtp_pass = Site::getPreference('SMTP_AUTH_PASS');
+ $smtp_encr = Site::getPreference('SMTP_SSL');
- if (Site::getPreference('SMTP_AUTH') === '1') {
- $transport
- ->setUsername(Site::getPreference('SMTP_AUTH_USER'))
- ->setPassword(Site::getPreference('SMTP_AUTH_PASS'));
- }
+ $transport =(new Swift_SmtpTransport($smtp_host, $smtp_port, $smtp_encr));
- if (Site::getPreference('SMTP_SSL') !== 'none') {
- $transport->setEncryption(Site::getPreference('SMTP_SSL'));
+ $transport->setLocalDomain(Site::getPreference('SMTP_HELO'));
+
+ if ($smtp_auth) {
+ $transport
+ ->setUsername($smtp_user)
+ ->setPassword($smtp_pass);
}
return $transport;
+
default:
// For testing
- return Swift_NullTransport::newInstance();
+ return new Swift_NullTransport();
}
}
}
diff --git a/composer.json b/composer.json
index 0927fb3246..4cb2e6549e 100644
--- a/composer.json
+++ b/composer.json
@@ -46,7 +46,7 @@
"league/flysystem-ziparchive": "~1.0",
"league/glide": "~1.3",
"ramsey/uuid": "~3.8",
- "swiftmailer/swiftmailer": "~5.0",
+ "swiftmailer/swiftmailer": "~6.1",
"symfony/expression-language": "~4.2",
"symfony/http-foundation": "~4.2",
"symfony/http-kernel": "~4.2",
diff --git a/composer.lock b/composer.lock
index f8061df66c..10993d3afa 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,9 +4,120 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "4479e98b880b4ef760b30daf6ccba874",
+ "content-hash": "7393b43d2df5c7b902c8577a23737161",
"packages": [
{
+ "name": "doctrine/lexer",
+ "version": "v1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/lexer.git",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Lexer\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "lexer",
+ "parser"
+ ],
+ "time": "2014-09-09T13:34:57+00:00"
+ },
+ {
+ "name": "egulias/email-validator",
+ "version": "2.1.6",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/egulias/EmailValidator.git",
+ "reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
+ "reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/lexer": "^1.0.1",
+ "php": ">= 5.5"
+ },
+ "require-dev": {
+ "dominicsayers/isemail": "dev-master",
+ "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
+ "satooshi/php-coveralls": "^1.0.1"
+ },
+ "suggest": {
+ "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Egulias\\EmailValidator\\": "EmailValidator"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Eduardo Gulias Davis"
+ }
+ ],
+ "description": "A library for validating emails against several RFCs",
+ "homepage": "https://github.com/egulias/EmailValidator",
+ "keywords": [
+ "email",
+ "emailvalidation",
+ "emailvalidator",
+ "validation",
+ "validator"
+ ],
+ "time": "2018-09-25T20:47:26+00:00"
+ },
+ {
"name": "filp/whoops",
"version": "2.3.1",
"source": {
@@ -1062,29 +1173,34 @@
},
{
"name": "swiftmailer/swiftmailer",
- "version": "v5.4.12",
+ "version": "v6.1.3",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
- "reference": "181b89f18a90f8925ef805f950d47a7190e9b950"
+ "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/181b89f18a90f8925ef805f950d47a7190e9b950",
- "reference": "181b89f18a90f8925ef805f950d47a7190e9b950",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
+ "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "egulias/email-validator": "~2.0",
+ "php": ">=7.0.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
- "symfony/phpunit-bridge": "~3.2"
+ "symfony/phpunit-bridge": "~3.3@dev"
+ },
+ "suggest": {
+ "ext-intl": "Needed to support internationalized email addresses",
+ "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.4-dev"
+ "dev-master": "6.1-dev"
}
},
"autoload": {
@@ -1112,7 +1228,7 @@
"mail",
"mailer"
],
- "time": "2018-07-31T09:26:32+00:00"
+ "time": "2018-09-11T07:12:52+00:00"
},
{
"name": "symfony/cache",
diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php
index b7fc0125db..4a6f5de33f 100644
--- a/vendor/composer/autoload_namespaces.php
+++ b/vendor/composer/autoload_namespaces.php
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
+ 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
);
diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php
index cf61d87541..14f9937775 100644
--- a/vendor/composer/autoload_psr4.php
+++ b/vendor/composer/autoload_psr4.php
@@ -37,4 +37,5 @@ return array(
'Fisharebest\\Localization\\' => array($vendorDir . '/fisharebest/localization/src'),
'Fisharebest\\ExtCalendar\\' => array($vendorDir . '/fisharebest/ext-calendar/src'),
'Fisharebest\\Algorithm\\' => array($vendorDir . '/fisharebest/algorithm/src'),
+ 'Egulias\\EmailValidator\\' => array($vendorDir . '/egulias/email-validator/EmailValidator'),
);
diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php
index bf7753fbda..99a5df8306 100644
--- a/vendor/composer/autoload_static.php
+++ b/vendor/composer/autoload_static.php
@@ -75,6 +75,10 @@ class ComposerStaticInit3da29173c262c589b273f6106eae3544
'Fisharebest\\ExtCalendar\\' => 24,
'Fisharebest\\Algorithm\\' => 22,
),
+ 'E' =>
+ array (
+ 'Egulias\\EmailValidator\\' => 23,
+ ),
);
public static $prefixDirsPsr4 = array (
@@ -202,6 +206,20 @@ class ComposerStaticInit3da29173c262c589b273f6106eae3544
array (
0 => __DIR__ . '/..' . '/fisharebest/algorithm/src',
),
+ 'Egulias\\EmailValidator\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/egulias/email-validator/EmailValidator',
+ ),
+ );
+
+ public static $prefixesPsr0 = array (
+ 'D' =>
+ array (
+ 'Doctrine\\Common\\Lexer\\' =>
+ array (
+ 0 => __DIR__ . '/..' . '/doctrine/lexer/lib',
+ ),
+ ),
);
public static $classMap = array (
@@ -226,6 +244,7 @@ class ComposerStaticInit3da29173c262c589b273f6106eae3544
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit3da29173c262c589b273f6106eae3544::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3da29173c262c589b273f6106eae3544::$prefixDirsPsr4;
+ $loader->prefixesPsr0 = ComposerStaticInit3da29173c262c589b273f6106eae3544::$prefixesPsr0;
$loader->classMap = ComposerStaticInit3da29173c262c589b273f6106eae3544::$classMap;
}, null, ClassLoader::class);
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index ed5342a1eb..612a62d954 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1,5 +1,120 @@
[
{
+ "name": "doctrine/lexer",
+ "version": "v1.0.1",
+ "version_normalized": "1.0.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/doctrine/lexer.git",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "time": "2014-09-09T13:34:57+00:00",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-0": {
+ "Doctrine\\Common\\Lexer\\": "lib/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Roman Borschel",
+ "email": "roman@code-factory.org"
+ },
+ {
+ "name": "Guilherme Blanco",
+ "email": "guilhermeblanco@gmail.com"
+ },
+ {
+ "name": "Johannes Schmitt",
+ "email": "schmittjoh@gmail.com"
+ }
+ ],
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "homepage": "http://www.doctrine-project.org",
+ "keywords": [
+ "lexer",
+ "parser"
+ ]
+ },
+ {
+ "name": "egulias/email-validator",
+ "version": "2.1.6",
+ "version_normalized": "2.1.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/egulias/EmailValidator.git",
+ "reference": "0578b32b30b22de3e8664f797cf846fc9246f786"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/0578b32b30b22de3e8664f797cf846fc9246f786",
+ "reference": "0578b32b30b22de3e8664f797cf846fc9246f786",
+ "shasum": ""
+ },
+ "require": {
+ "doctrine/lexer": "^1.0.1",
+ "php": ">= 5.5"
+ },
+ "require-dev": {
+ "dominicsayers/isemail": "dev-master",
+ "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
+ "satooshi/php-coveralls": "^1.0.1"
+ },
+ "suggest": {
+ "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
+ },
+ "time": "2018-09-25T20:47:26+00:00",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "Egulias\\EmailValidator\\": "EmailValidator"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Eduardo Gulias Davis"
+ }
+ ],
+ "description": "A library for validating emails against several RFCs",
+ "homepage": "https://github.com/egulias/EmailValidator",
+ "keywords": [
+ "email",
+ "emailvalidation",
+ "emailvalidator",
+ "validation",
+ "validator"
+ ]
+ },
+ {
"name": "filp/whoops",
"version": "2.3.1",
"version_normalized": "2.3.1.0",
@@ -1091,31 +1206,36 @@
},
{
"name": "swiftmailer/swiftmailer",
- "version": "v5.4.12",
- "version_normalized": "5.4.12.0",
+ "version": "v6.1.3",
+ "version_normalized": "6.1.3.0",
"source": {
"type": "git",
"url": "https://github.com/swiftmailer/swiftmailer.git",
- "reference": "181b89f18a90f8925ef805f950d47a7190e9b950"
+ "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/181b89f18a90f8925ef805f950d47a7190e9b950",
- "reference": "181b89f18a90f8925ef805f950d47a7190e9b950",
+ "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8ddcb66ac10c392d3beb54829eef8ac1438595f4",
+ "reference": "8ddcb66ac10c392d3beb54829eef8ac1438595f4",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "egulias/email-validator": "~2.0",
+ "php": ">=7.0.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
- "symfony/phpunit-bridge": "~3.2"
+ "symfony/phpunit-bridge": "~3.3@dev"
+ },
+ "suggest": {
+ "ext-intl": "Needed to support internationalized email addresses",
+ "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
},
- "time": "2018-07-31T09:26:32+00:00",
+ "time": "2018-09-11T07:12:52+00:00",
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "5.4-dev"
+ "dev-master": "6.1-dev"
}
},
"installation-source": "dist",
diff --git a/vendor/doctrine/lexer/LICENSE b/vendor/doctrine/lexer/LICENSE
new file mode 100644
index 0000000000..5e781fce4b
--- /dev/null
+++ b/vendor/doctrine/lexer/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2006-2013 Doctrine Project
+
+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/doctrine/lexer/README.md b/vendor/doctrine/lexer/README.md
new file mode 100644
index 0000000000..66f443089e
--- /dev/null
+++ b/vendor/doctrine/lexer/README.md
@@ -0,0 +1,5 @@
+# Doctrine Lexer
+
+Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
+
+This lexer is used in Doctrine Annotations and in Doctrine ORM (DQL).
diff --git a/vendor/doctrine/lexer/composer.json b/vendor/doctrine/lexer/composer.json
new file mode 100644
index 0000000000..8cd694c652
--- /dev/null
+++ b/vendor/doctrine/lexer/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "doctrine/lexer",
+ "type": "library",
+ "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.",
+ "keywords": ["lexer", "parser"],
+ "homepage": "http://www.doctrine-project.org",
+ "license": "MIT",
+ "authors": [
+ {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"},
+ {"name": "Roman Borschel", "email": "roman@code-factory.org"},
+ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
+ ],
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "autoload": {
+ "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" }
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ }
+}
diff --git a/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
new file mode 100644
index 0000000000..399a55230b
--- /dev/null
+++ b/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php
@@ -0,0 +1,327 @@
+<?php
+/*
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * and is licensed under the MIT license. For more information, see
+ * <http://www.doctrine-project.org>.
+ */
+
+namespace Doctrine\Common\Lexer;
+
+/**
+ * Base class for writing simple lexers, i.e. for creating small DSLs.
+ *
+ * @since 2.0
+ * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
+ * @author Jonathan Wage <jonwage@gmail.com>
+ * @author Roman Borschel <roman@code-factory.org>
+ */
+abstract class AbstractLexer
+{
+ /**
+ * Lexer original input string.
+ *
+ * @var string
+ */
+ private $input;
+
+ /**
+ * Array of scanned tokens.
+ *
+ * Each token is an associative array containing three items:
+ * - 'value' : the string value of the token in the input string
+ * - 'type' : the type of the token (identifier, numeric, string, input
+ * parameter, none)
+ * - 'position' : the position of the token in the input string
+ *
+ * @var array
+ */
+ private $tokens = array();
+
+ /**
+ * Current lexer position in input string.
+ *
+ * @var integer
+ */
+ private $position = 0;
+
+ /**
+ * Current peek of current lexer position.
+ *
+ * @var integer
+ */
+ private $peek = 0;
+
+ /**
+ * The next token in the input.
+ *
+ * @var array
+ */
+ public $lookahead;
+
+ /**
+ * The last matched/seen token.
+ *
+ * @var array
+ */
+ public $token;
+
+ /**
+ * Sets the input data to be tokenized.
+ *
+ * The Lexer is immediately reset and the new input tokenized.
+ * Any unprocessed tokens from any previous input are lost.
+ *
+ * @param string $input The input to be tokenized.
+ *
+ * @return void
+ */
+ public function setInput($input)
+ {
+ $this->input = $input;
+ $this->tokens = array();
+
+ $this->reset();
+ $this->scan($input);
+ }
+
+ /**
+ * Resets the lexer.
+ *
+ * @return void
+ */
+ public function reset()
+ {
+ $this->lookahead = null;
+ $this->token = null;
+ $this->peek = 0;
+ $this->position = 0;
+ }
+
+ /**
+ * Resets the peek pointer to 0.
+ *
+ * @return void
+ */
+ public function resetPeek()
+ {
+ $this->peek = 0;
+ }
+
+ /**
+ * Resets the lexer position on the input to the given position.
+ *
+ * @param integer $position Position to place the lexical scanner.
+ *
+ * @return void
+ */
+ public function resetPosition($position = 0)
+ {
+ $this->position = $position;
+ }
+
+ /**
+ * Retrieve the original lexer's input until a given position.
+ *
+ * @param integer $position
+ *
+ * @return string
+ */
+ public function getInputUntilPosition($position)
+ {
+ return substr($this->input, 0, $position);
+ }
+
+ /**
+ * Checks whether a given token matches the current lookahead.
+ *
+ * @param integer|string $token
+ *
+ * @return boolean
+ */
+ public function isNextToken($token)
+ {
+ return null !== $this->lookahead && $this->lookahead['type'] === $token;
+ }
+
+ /**
+ * Checks whether any of the given tokens matches the current lookahead.
+ *
+ * @param array $tokens
+ *
+ * @return boolean
+ */
+ public function isNextTokenAny(array $tokens)
+ {
+ return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true);
+ }
+
+ /**
+ * Moves to the next token in the input string.
+ *
+ * @return boolean
+ */
+ public function moveNext()
+ {
+ $this->peek = 0;
+ $this->token = $this->lookahead;
+ $this->lookahead = (isset($this->tokens[$this->position]))
+ ? $this->tokens[$this->position++] : null;
+
+ return $this->lookahead !== null;
+ }
+
+ /**
+ * Tells the lexer to skip input tokens until it sees a token with the given value.
+ *
+ * @param string $type The token type to skip until.
+ *
+ * @return void
+ */
+ public function skipUntil($type)
+ {
+ while ($this->lookahead !== null && $this->lookahead['type'] !== $type) {
+ $this->moveNext();
+ }
+ }
+
+ /**
+ * Checks if given value is identical to the given token.
+ *
+ * @param mixed $value
+ * @param integer $token
+ *
+ * @return boolean
+ */
+ public function isA($value, $token)
+ {
+ return $this->getType($value) === $token;
+ }
+
+ /**
+ * Moves the lookahead token forward.
+ *
+ * @return array|null The next token or NULL if there are no more tokens ahead.
+ */
+ public function peek()
+ {
+ if (isset($this->tokens[$this->position + $this->peek])) {
+ return $this->tokens[$this->position + $this->peek++];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Peeks at the next token, returns it and immediately resets the peek.
+ *
+ * @return array|null The next token or NULL if there are no more tokens ahead.
+ */
+ public function glimpse()
+ {
+ $peek = $this->peek();
+ $this->peek = 0;
+ return $peek;
+ }
+
+ /**
+ * Scans the input string for tokens.
+ *
+ * @param string $input A query string.
+ *
+ * @return void
+ */
+ protected function scan($input)
+ {
+ static $regex;
+
+ if ( ! isset($regex)) {
+ $regex = sprintf(
+ '/(%s)|%s/%s',
+ implode(')|(', $this->getCatchablePatterns()),
+ implode('|', $this->getNonCatchablePatterns()),
+ $this->getModifiers()
+ );
+ }
+
+ $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
+ $matches = preg_split($regex, $input, -1, $flags);
+
+ foreach ($matches as $match) {
+ // Must remain before 'value' assignment since it can change content
+ $type = $this->getType($match[0]);
+
+ $this->tokens[] = array(
+ 'value' => $match[0],
+ 'type' => $type,
+ 'position' => $match[1],
+ );
+ }
+ }
+
+ /**
+ * Gets the literal for a given token.
+ *
+ * @param integer $token
+ *
+ * @return string
+ */
+ public function getLiteral($token)
+ {
+ $className = get_class($this);
+ $reflClass = new \ReflectionClass($className);
+ $constants = $reflClass->getConstants();
+
+ foreach ($constants as $name => $value) {
+ if ($value === $token) {
+ return $className . '::' . $name;
+ }
+ }
+
+ return $token;
+ }
+
+ /**
+ * Regex modifiers
+ *
+ * @return string
+ */
+ protected function getModifiers()
+ {
+ return 'i';
+ }
+
+ /**
+ * Lexical catchable patterns.
+ *
+ * @return array
+ */
+ abstract protected function getCatchablePatterns();
+
+ /**
+ * Lexical non-catchable patterns.
+ *
+ * @return array
+ */
+ abstract protected function getNonCatchablePatterns();
+
+ /**
+ * Retrieve token type. Also processes the token value if necessary.
+ *
+ * @param string $value
+ *
+ * @return integer
+ */
+ abstract protected function getType(&$value);
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/EmailLexer.php b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php
new file mode 100644
index 0000000000..882c968154
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/EmailLexer.php
@@ -0,0 +1,221 @@
+<?php
+
+namespace Egulias\EmailValidator;
+
+use Doctrine\Common\Lexer\AbstractLexer;
+
+class EmailLexer extends AbstractLexer
+{
+ //ASCII values
+ const C_DEL = 127;
+ const C_NUL = 0;
+ const S_AT = 64;
+ const S_BACKSLASH = 92;
+ const S_DOT = 46;
+ const S_DQUOTE = 34;
+ const S_OPENPARENTHESIS = 49;
+ const S_CLOSEPARENTHESIS = 261;
+ const S_OPENBRACKET = 262;
+ const S_CLOSEBRACKET = 263;
+ const S_HYPHEN = 264;
+ const S_COLON = 265;
+ const S_DOUBLECOLON = 266;
+ const S_SP = 267;
+ const S_HTAB = 268;
+ const S_CR = 269;
+ const S_LF = 270;
+ const S_IPV6TAG = 271;
+ const S_LOWERTHAN = 272;
+ const S_GREATERTHAN = 273;
+ const S_COMMA = 274;
+ const S_SEMICOLON = 275;
+ const S_OPENQBRACKET = 276;
+ const S_CLOSEQBRACKET = 277;
+ const S_SLASH = 278;
+ const S_EMPTY = null;
+ const GENERIC = 300;
+ const CRLF = 301;
+ const INVALID = 302;
+ const ASCII_INVALID_FROM = 127;
+ const ASCII_INVALID_TO = 199;
+
+ /**
+ * US-ASCII visible characters not valid for atext (@link http://tools.ietf.org/html/rfc5322#section-3.2.3)
+ *
+ * @var array
+ */
+ protected $charValue = array(
+ '(' => self::S_OPENPARENTHESIS,
+ ')' => self::S_CLOSEPARENTHESIS,
+ '<' => self::S_LOWERTHAN,
+ '>' => self::S_GREATERTHAN,
+ '[' => self::S_OPENBRACKET,
+ ']' => self::S_CLOSEBRACKET,
+ ':' => self::S_COLON,
+ ';' => self::S_SEMICOLON,
+ '@' => self::S_AT,
+ '\\' => self::S_BACKSLASH,
+ '/' => self::S_SLASH,
+ ',' => self::S_COMMA,
+ '.' => self::S_DOT,
+ '"' => self::S_DQUOTE,
+ '-' => self::S_HYPHEN,
+ '::' => self::S_DOUBLECOLON,
+ ' ' => self::S_SP,
+ "\t" => self::S_HTAB,
+ "\r" => self::S_CR,
+ "\n" => self::S_LF,
+ "\r\n" => self::CRLF,
+ 'IPv6' => self::S_IPV6TAG,
+ '{' => self::S_OPENQBRACKET,
+ '}' => self::S_CLOSEQBRACKET,
+ '' => self::S_EMPTY,
+ '\0' => self::C_NUL,
+ );
+
+ protected $hasInvalidTokens = false;
+
+ protected $previous;
+
+ public function reset()
+ {
+ $this->hasInvalidTokens = false;
+ parent::reset();
+ }
+
+ public function hasInvalidTokens()
+ {
+ return $this->hasInvalidTokens;
+ }
+
+ /**
+ * @param $type
+ * @throws \UnexpectedValueException
+ * @return boolean
+ */
+ public function find($type)
+ {
+ $search = clone $this;
+ $search->skipUntil($type);
+
+ if (!$search->lookahead) {
+ throw new \UnexpectedValueException($type . ' not found');
+ }
+ return true;
+ }
+
+ /**
+ * getPrevious
+ *
+ * @return array token
+ */
+ public function getPrevious()
+ {
+ return $this->previous;
+ }
+
+ /**
+ * moveNext
+ *
+ * @return boolean
+ */
+ public function moveNext()
+ {
+ $this->previous = $this->token;
+
+ return parent::moveNext();
+ }
+
+ /**
+ * Lexical catchable patterns.
+ *
+ * @return string[]
+ */
+ protected function getCatchablePatterns()
+ {
+ return array(
+ '[a-zA-Z_]+[46]?', //ASCII and domain literal
+ '[^\x00-\x7F]', //UTF-8
+ '[0-9]+',
+ '\r\n',
+ '::',
+ '\s+?',
+ '.',
+ );
+ }
+
+ /**
+ * Lexical non-catchable patterns.
+ *
+ * @return string[]
+ */
+ protected function getNonCatchablePatterns()
+ {
+ return array('[\xA0-\xff]+');
+ }
+
+ /**
+ * Retrieve token type. Also processes the token value if necessary.
+ *
+ * @param string $value
+ * @throws \InvalidArgumentException
+ * @return integer
+ */
+ protected function getType(&$value)
+ {
+ if ($this->isNullType($value)) {
+ return self::C_NUL;
+ }
+
+ if ($this->isValid($value)) {
+ return $this->charValue[$value];
+ }
+
+ if ($this->isUTF8Invalid($value)) {
+ $this->hasInvalidTokens = true;
+ return self::INVALID;
+ }
+
+ return self::GENERIC;
+ }
+
+ protected function isValid($value)
+ {
+ if (isset($this->charValue[$value])) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param $value
+ * @return bool
+ */
+ protected function isNullType($value)
+ {
+ if ($value === "\0") {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @param $value
+ * @return bool
+ */
+ protected function isUTF8Invalid($value)
+ {
+ if (preg_match('/\p{Cc}+/u', $value)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected function getModifiers()
+ {
+ return 'iu';
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/EmailParser.php b/vendor/egulias/email-validator/EmailValidator/EmailParser.php
new file mode 100644
index 0000000000..d0627d8241
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/EmailParser.php
@@ -0,0 +1,104 @@
+<?php
+
+namespace Egulias\EmailValidator;
+
+use Egulias\EmailValidator\Exception\ExpectingATEXT;
+use Egulias\EmailValidator\Exception\NoLocalPart;
+use Egulias\EmailValidator\Parser\DomainPart;
+use Egulias\EmailValidator\Parser\LocalPart;
+use Egulias\EmailValidator\Warning\EmailTooLong;
+
+/**
+ * EmailParser
+ *
+ * @author Eduardo Gulias Davis <me@egulias.com>
+ */
+class EmailParser
+{
+ const EMAIL_MAX_LENGTH = 254;
+
+ protected $warnings;
+ protected $domainPart = '';
+ protected $localPart = '';
+ protected $lexer;
+ protected $localPartParser;
+ protected $domainPartParser;
+
+ public function __construct(EmailLexer $lexer)
+ {
+ $this->lexer = $lexer;
+ $this->localPartParser = new LocalPart($this->lexer);
+ $this->domainPartParser = new DomainPart($this->lexer);
+ $this->warnings = new \SplObjectStorage();
+ }
+
+ /**
+ * @param $str
+ * @return array
+ */
+ public function parse($str)
+ {
+ $this->lexer->setInput($str);
+
+ if (!$this->hasAtToken()) {
+ throw new NoLocalPart();
+ }
+
+
+ $this->localPartParser->parse($str);
+ $this->domainPartParser->parse($str);
+
+ $this->setParts($str);
+
+ if ($this->lexer->hasInvalidTokens()) {
+ throw new ExpectingATEXT();
+ }
+
+ return array('local' => $this->localPart, 'domain' => $this->domainPart);
+ }
+
+ public function getWarnings()
+ {
+ $localPartWarnings = $this->localPartParser->getWarnings();
+ $domainPartWarnings = $this->domainPartParser->getWarnings();
+ $this->warnings = array_merge($localPartWarnings, $domainPartWarnings);
+
+ $this->addLongEmailWarning($this->localPart, $this->domainPart);
+
+ return $this->warnings;
+ }
+
+ public function getParsedDomainPart()
+ {
+ return $this->domainPart;
+ }
+
+ protected function setParts($email)
+ {
+ $parts = explode('@', $email);
+ $this->domainPart = $this->domainPartParser->getDomainPart();
+ $this->localPart = $parts[0];
+ }
+
+ protected function hasAtToken()
+ {
+ $this->lexer->moveNext();
+ $this->lexer->moveNext();
+ if ($this->lexer->token['type'] === EmailLexer::S_AT) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * @param string $localPart
+ * @param string $parsedDomainPart
+ */
+ protected function addLongEmailWarning($localPart, $parsedDomainPart)
+ {
+ if (strlen($localPart . '@' . $parsedDomainPart) > self::EMAIL_MAX_LENGTH) {
+ $this->warnings[EmailTooLong::CODE] = new EmailTooLong();
+ }
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/EmailValidator.php b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php
new file mode 100644
index 0000000000..44b4b93c6b
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/EmailValidator.php
@@ -0,0 +1,67 @@
+<?php
+
+namespace Egulias\EmailValidator;
+
+use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Validation\EmailValidation;
+
+class EmailValidator
+{
+ /**
+ * @var EmailLexer
+ */
+ private $lexer;
+
+ /**
+ * @var array
+ */
+ protected $warnings;
+
+ /**
+ * @var InvalidEmail
+ */
+ protected $error;
+
+ public function __construct()
+ {
+ $this->lexer = new EmailLexer();
+ }
+
+ /**
+ * @param $email
+ * @param EmailValidation $emailValidation
+ * @return bool
+ */
+ public function isValid($email, EmailValidation $emailValidation)
+ {
+ $isValid = $emailValidation->isValid($email, $this->lexer);
+ $this->warnings = $emailValidation->getWarnings();
+ $this->error = $emailValidation->getError();
+
+ return $isValid;
+ }
+
+ /**
+ * @return boolean
+ */
+ public function hasWarnings()
+ {
+ return !empty($this->warnings);
+ }
+
+ /**
+ * @return array
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
+ /**
+ * @return InvalidEmail
+ */
+ public function getError()
+ {
+ return $this->error;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php
new file mode 100644
index 0000000000..97f41a2caa
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/AtextAfterCFWS.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class AtextAfterCFWS extends InvalidEmail
+{
+ const CODE = 133;
+ const REASON = "ATEXT found after CFWS";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/CRLFAtTheEnd.php b/vendor/egulias/email-validator/EmailValidator/Exception/CRLFAtTheEnd.php
new file mode 100644
index 0000000000..ec23bc718c
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/CRLFAtTheEnd.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class CRLFAtTheEnd extends InvalidEmail
+{
+ const CODE = 149;
+ const REASON = "CRLF at the end";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/CRLFX2.php b/vendor/egulias/email-validator/EmailValidator/Exception/CRLFX2.php
new file mode 100644
index 0000000000..6bd377ee70
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/CRLFX2.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class CRLFX2 extends InvalidEmail
+{
+ const CODE = 148;
+ const REASON = "Folding whitespace CR LF found twice";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/CRNoLF.php b/vendor/egulias/email-validator/EmailValidator/Exception/CRNoLF.php
new file mode 100644
index 0000000000..9c9f73944c
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/CRNoLF.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class CRNoLF extends InvalidEmail
+{
+ const CODE = 150;
+ const REASON = "Missing LF after CR";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/CharNotAllowed.php b/vendor/egulias/email-validator/EmailValidator/Exception/CharNotAllowed.php
new file mode 100644
index 0000000000..ea20ce591d
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/CharNotAllowed.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class CharNotAllowed extends InvalidEmail
+{
+ const CODE = 201;
+ const REASON = "Non allowed character in domain";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/CommaInDomain.php b/vendor/egulias/email-validator/EmailValidator/Exception/CommaInDomain.php
new file mode 100644
index 0000000000..e9245d9663
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/CommaInDomain.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class CommaInDomain extends InvalidEmail
+{
+ const CODE = 200;
+ const REASON = "Comma ',' is not allowed in domain part";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveAt.php b/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveAt.php
new file mode 100644
index 0000000000..165ff57a9f
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveAt.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ConsecutiveAt extends InvalidEmail
+{
+ const CODE = 128;
+ const REASON = "Consecutive AT";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveDot.php b/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveDot.php
new file mode 100644
index 0000000000..949af3b59b
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ConsecutiveDot.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ConsecutiveDot extends InvalidEmail
+{
+ const CODE = 132;
+ const REASON = "Consecutive DOT";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php b/vendor/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php
new file mode 100644
index 0000000000..6f5868603f
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/DomainHyphened.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class DomainHyphened extends InvalidEmail
+{
+ const CODE = 144;
+ const REASON = "Hyphen found in domain";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php b/vendor/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php
new file mode 100644
index 0000000000..05ade77d0a
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/DotAtEnd.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class DotAtEnd extends InvalidEmail
+{
+ const CODE = 142;
+ const REASON = "Dot at the end";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/DotAtStart.php b/vendor/egulias/email-validator/EmailValidator/Exception/DotAtStart.php
new file mode 100644
index 0000000000..7772df7f88
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/DotAtStart.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class DotAtStart extends InvalidEmail
+{
+ const CODE = 141;
+ const REASON = "Found DOT at start";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php
new file mode 100644
index 0000000000..36d633c1a0
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingAT.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectingAT extends InvalidEmail
+{
+ const CODE = 202;
+ const REASON = "Expecting AT '@' ";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php
new file mode 100644
index 0000000000..095d9db745
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingATEXT.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectingATEXT extends InvalidEmail
+{
+ const CODE = 137;
+ const REASON = "Expecting ATEXT";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php
new file mode 100644
index 0000000000..63b870a4af
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingCTEXT.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectingCTEXT extends InvalidEmail
+{
+ const CODE = 139;
+ const REASON = "Expecting CTEXT";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDTEXT.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDTEXT.php
new file mode 100644
index 0000000000..6a5bb9bfe8
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDTEXT.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectingDTEXT extends InvalidEmail
+{
+ const CODE = 129;
+ const REASON = "Expected DTEXT";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDomainLiteralClose.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDomainLiteralClose.php
new file mode 100644
index 0000000000..81aad4277d
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingDomainLiteralClose.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectingDomainLiteralClose extends InvalidEmail
+{
+ const CODE = 137;
+ const REASON = "Closing bracket ']' for domain literal not found";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php
new file mode 100644
index 0000000000..2502811cac
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/ExpectingQPair.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class ExpectedQPair extends InvalidEmail
+{
+ const CODE = 136;
+ const REASON = "Expecting QPAIR";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php b/vendor/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php
new file mode 100644
index 0000000000..1c0218e9e2
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/InvalidEmail.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+abstract class InvalidEmail extends \InvalidArgumentException
+{
+ const REASON = "Invalid email";
+ const CODE = 0;
+
+ public function __construct()
+ {
+ parent::__construct(static::REASON, static::CODE);
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php b/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php
new file mode 100644
index 0000000000..86ca21d557
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/NoDNSRecord.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+use Egulias\EmailValidator\Exception\InvalidEmail;
+
+class NoDNSRecord extends InvalidEmail
+{
+ const CODE = 5;
+ const REASON = 'No MX or A DSN record was found for this email';
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php b/vendor/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php
new file mode 100644
index 0000000000..05a2604c0d
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/NoDomainPart.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class NoDomainPart extends InvalidEmail
+{
+ const CODE = 131;
+ const REASON = "No Domain part";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/NoLocalPart.php b/vendor/egulias/email-validator/EmailValidator/Exception/NoLocalPart.php
new file mode 100644
index 0000000000..07c14b8445
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/NoLocalPart.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class NoLocalPart extends InvalidEmail
+{
+ const CODE = 130;
+ const REASON = "No local part";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedComment.php b/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedComment.php
new file mode 100644
index 0000000000..c87c97ac77
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedComment.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class UnclosedComment extends InvalidEmail
+{
+ const CODE = 146;
+ const REASON = "No colosing comment token found";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedQuotedString.php b/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedQuotedString.php
new file mode 100644
index 0000000000..730a39dd3f
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/UnclosedQuotedString.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class UnclosedQuotedString extends InvalidEmail
+{
+ const CODE = 145;
+ const REASON = "Unclosed quoted string";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Exception/UnopenedComment.php b/vendor/egulias/email-validator/EmailValidator/Exception/UnopenedComment.php
new file mode 100644
index 0000000000..cff12d9253
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Exception/UnopenedComment.php
@@ -0,0 +1,9 @@
+<?php
+
+namespace Egulias\EmailValidator\Exception;
+
+class UnopenedComment extends InvalidEmail
+{
+ const CODE = 152;
+ const REASON = "No opening comment token found";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php b/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php
new file mode 100644
index 0000000000..51769dea1b
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Parser/DomainPart.php
@@ -0,0 +1,368 @@
+<?php
+
+namespace Egulias\EmailValidator\Parser;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\CharNotAllowed;
+use Egulias\EmailValidator\Exception\CommaInDomain;
+use Egulias\EmailValidator\Exception\ConsecutiveAt;
+use Egulias\EmailValidator\Exception\CRLFAtTheEnd;
+use Egulias\EmailValidator\Exception\CRNoLF;
+use Egulias\EmailValidator\Exception\DomainHyphened;
+use Egulias\EmailValidator\Exception\DotAtEnd;
+use Egulias\EmailValidator\Exception\DotAtStart;
+use Egulias\EmailValidator\Exception\ExpectingATEXT;
+use Egulias\EmailValidator\Exception\ExpectingDomainLiteralClose;
+use Egulias\EmailValidator\Exception\ExpectingDTEXT;
+use Egulias\EmailValidator\Exception\NoDomainPart;
+use Egulias\EmailValidator\Exception\UnopenedComment;
+use Egulias\EmailValidator\Warning\AddressLiteral;
+use Egulias\EmailValidator\Warning\CFWSWithFWS;
+use Egulias\EmailValidator\Warning\DeprecatedComment;
+use Egulias\EmailValidator\Warning\DomainLiteral;
+use Egulias\EmailValidator\Warning\DomainTooLong;
+use Egulias\EmailValidator\Warning\IPV6BadChar;
+use Egulias\EmailValidator\Warning\IPV6ColonEnd;
+use Egulias\EmailValidator\Warning\IPV6ColonStart;
+use Egulias\EmailValidator\Warning\IPV6Deprecated;
+use Egulias\EmailValidator\Warning\IPV6DoubleColon;
+use Egulias\EmailValidator\Warning\IPV6GroupCount;
+use Egulias\EmailValidator\Warning\IPV6MaxGroups;
+use Egulias\EmailValidator\Warning\LabelTooLong;
+use Egulias\EmailValidator\Warning\ObsoleteDTEXT;
+use Egulias\EmailValidator\Warning\TLD;
+
+class DomainPart extends Parser
+{
+ const DOMAIN_MAX_LENGTH = 254;
+ protected $domainPart = '';
+
+ public function parse($domainPart)
+ {
+ $this->lexer->moveNext();
+
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT) {
+ throw new DotAtStart();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_EMPTY) {
+ throw new NoDomainPart();
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN) {
+ throw new DomainHyphened();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
+ $this->warnings[DeprecatedComment::CODE] = new DeprecatedComment();
+ $this->parseDomainComments();
+ }
+
+ $domain = $this->doParseDomainPart();
+
+ $prev = $this->lexer->getPrevious();
+ $length = strlen($domain);
+
+ if ($prev['type'] === EmailLexer::S_DOT) {
+ throw new DotAtEnd();
+ }
+ if ($prev['type'] === EmailLexer::S_HYPHEN) {
+ throw new DomainHyphened();
+ }
+ if ($length > self::DOMAIN_MAX_LENGTH) {
+ $this->warnings[DomainTooLong::CODE] = new DomainTooLong();
+ }
+ if ($prev['type'] === EmailLexer::S_CR) {
+ throw new CRLFAtTheEnd();
+ }
+ $this->domainPart = $domain;
+ }
+
+ public function getDomainPart()
+ {
+ return $this->domainPart;
+ }
+
+ public function checkIPV6Tag($addressLiteral, $maxGroups = 8)
+ {
+ $prev = $this->lexer->getPrevious();
+ if ($prev['type'] === EmailLexer::S_COLON) {
+ $this->warnings[IPV6ColonEnd::CODE] = new IPV6ColonEnd();
+ }
+
+ $IPv6 = substr($addressLiteral, 5);
+ //Daniel Marschall's new IPv6 testing strategy
+ $matchesIP = explode(':', $IPv6);
+ $groupCount = count($matchesIP);
+ $colons = strpos($IPv6, '::');
+
+ if (count(preg_grep('/^[0-9A-Fa-f]{0,4}$/', $matchesIP, PREG_GREP_INVERT)) !== 0) {
+ $this->warnings[IPV6BadChar::CODE] = new IPV6BadChar();
+ }
+
+ if ($colons === false) {
+ // We need exactly the right number of groups
+ if ($groupCount !== $maxGroups) {
+ $this->warnings[IPV6GroupCount::CODE] = new IPV6GroupCount();
+ }
+ return;
+ }
+
+ if ($colons !== strrpos($IPv6, '::')) {
+ $this->warnings[IPV6DoubleColon::CODE] = new IPV6DoubleColon();
+ return;
+ }
+
+ if ($colons === 0 || $colons === (strlen($IPv6) - 2)) {
+ // RFC 4291 allows :: at the start or end of an address
+ //with 7 other groups in addition
+ ++$maxGroups;
+ }
+
+ if ($groupCount > $maxGroups) {
+ $this->warnings[IPV6MaxGroups::CODE] = new IPV6MaxGroups();
+ } elseif ($groupCount === $maxGroups) {
+ $this->warnings[IPV6Deprecated::CODE] = new IPV6Deprecated();
+ }
+ }
+
+ protected function doParseDomainPart()
+ {
+ $domain = '';
+ $openedParenthesis = 0;
+ do {
+ $prev = $this->lexer->getPrevious();
+
+ $this->checkNotAllowedChars($this->lexer->token);
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
+ $this->parseComments();
+ $openedParenthesis += $this->getOpenedParenthesis();
+ $this->lexer->moveNext();
+ $tmpPrev = $this->lexer->getPrevious();
+ if ($tmpPrev['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
+ $openedParenthesis--;
+ }
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
+ if ($openedParenthesis === 0) {
+ throw new UnopenedComment();
+ } else {
+ $openedParenthesis--;
+ }
+ }
+
+ $this->checkConsecutiveDots();
+ $this->checkDomainPartExceptions($prev);
+
+ if ($this->hasBrackets()) {
+ $this->parseDomainLiteral();
+ }
+
+ $this->checkLabelLength($prev);
+
+ if ($this->isFWS()) {
+ $this->parseFWS();
+ }
+
+ $domain .= $this->lexer->token['value'];
+ $this->lexer->moveNext();
+ } while ($this->lexer->token);
+
+ return $domain;
+ }
+
+ private function checkNotAllowedChars($token)
+ {
+ $notAllowed = [EmailLexer::S_BACKSLASH => true, EmailLexer::S_SLASH=> true];
+ if (isset($notAllowed[$token['type']])) {
+ throw new CharNotAllowed();
+ }
+ }
+
+ protected function parseDomainLiteral()
+ {
+ if ($this->lexer->isNextToken(EmailLexer::S_COLON)) {
+ $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart();
+ }
+ if ($this->lexer->isNextToken(EmailLexer::S_IPV6TAG)) {
+ $lexer = clone $this->lexer;
+ $lexer->moveNext();
+ if ($lexer->isNextToken(EmailLexer::S_DOUBLECOLON)) {
+ $this->warnings[IPV6ColonStart::CODE] = new IPV6ColonStart();
+ }
+ }
+
+ return $this->doParseDomainLiteral();
+ }
+
+ protected function doParseDomainLiteral()
+ {
+ $IPv6TAG = false;
+ $addressLiteral = '';
+ do {
+ if ($this->lexer->token['type'] === EmailLexer::C_NUL) {
+ throw new ExpectingDTEXT();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::INVALID ||
+ $this->lexer->token['type'] === EmailLexer::C_DEL ||
+ $this->lexer->token['type'] === EmailLexer::S_LF
+ ) {
+ $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT();
+ }
+
+ if ($this->lexer->isNextTokenAny(array(EmailLexer::S_OPENQBRACKET, EmailLexer::S_OPENBRACKET))) {
+ throw new ExpectingDTEXT();
+ }
+
+ if ($this->lexer->isNextTokenAny(
+ array(EmailLexer::S_HTAB, EmailLexer::S_SP, $this->lexer->token['type'] === EmailLexer::CRLF)
+ )) {
+ $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
+ $this->parseFWS();
+ }
+
+ if ($this->lexer->isNextToken(EmailLexer::S_CR)) {
+ throw new CRNoLF();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH) {
+ $this->warnings[ObsoleteDTEXT::CODE] = new ObsoleteDTEXT();
+ $addressLiteral .= $this->lexer->token['value'];
+ $this->lexer->moveNext();
+ $this->validateQuotedPair();
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_IPV6TAG) {
+ $IPv6TAG = true;
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_CLOSEQBRACKET) {
+ break;
+ }
+
+ $addressLiteral .= $this->lexer->token['value'];
+
+ } while ($this->lexer->moveNext());
+
+ $addressLiteral = str_replace('[', '', $addressLiteral);
+ $addressLiteral = $this->checkIPV4Tag($addressLiteral);
+
+ if (false === $addressLiteral) {
+ return $addressLiteral;
+ }
+
+ if (!$IPv6TAG) {
+ $this->warnings[DomainLiteral::CODE] = new DomainLiteral();
+ return $addressLiteral;
+ }
+
+ $this->warnings[AddressLiteral::CODE] = new AddressLiteral();
+
+ $this->checkIPV6Tag($addressLiteral);
+
+ return $addressLiteral;
+ }
+
+ protected function checkIPV4Tag($addressLiteral)
+ {
+ $matchesIP = array();
+
+ // Extract IPv4 part from the end of the address-literal (if there is one)
+ if (preg_match(
+ '/\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/',
+ $addressLiteral,
+ $matchesIP
+ ) > 0
+ ) {
+ $index = strrpos($addressLiteral, $matchesIP[0]);
+ if ($index === 0) {
+ $this->warnings[AddressLiteral::CODE] = new AddressLiteral();
+ return false;
+ }
+ // Convert IPv4 part to IPv6 format for further testing
+ $addressLiteral = substr($addressLiteral, 0, $index) . '0:0';
+ }
+
+ return $addressLiteral;
+ }
+
+ protected function checkDomainPartExceptions($prev)
+ {
+ $invalidDomainTokens = array(
+ EmailLexer::S_DQUOTE => true,
+ EmailLexer::S_SEMICOLON => true,
+ EmailLexer::S_GREATERTHAN => true,
+ EmailLexer::S_LOWERTHAN => true,
+ );
+
+ if (isset($invalidDomainTokens[$this->lexer->token['type']])) {
+ throw new ExpectingATEXT();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_COMMA) {
+ throw new CommaInDomain();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_AT) {
+ throw new ConsecutiveAt();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENQBRACKET && $prev['type'] !== EmailLexer::S_AT) {
+ throw new ExpectingATEXT();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_HYPHEN && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
+ throw new DomainHyphened();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH
+ && $this->lexer->isNextToken(EmailLexer::GENERIC)) {
+ throw new ExpectingATEXT();
+ }
+ }
+
+ protected function hasBrackets()
+ {
+ if ($this->lexer->token['type'] !== EmailLexer::S_OPENBRACKET) {
+ return false;
+ }
+
+ try {
+ $this->lexer->find(EmailLexer::S_CLOSEBRACKET);
+ } catch (\RuntimeException $e) {
+ throw new ExpectingDomainLiteralClose();
+ }
+
+ return true;
+ }
+
+ protected function checkLabelLength($prev)
+ {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
+ $prev['type'] === EmailLexer::GENERIC &&
+ strlen($prev['value']) > 63
+ ) {
+ $this->warnings[LabelTooLong::CODE] = new LabelTooLong();
+ }
+ }
+
+ protected function parseDomainComments()
+ {
+ $this->isUnclosedComment();
+ while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) {
+ $this->warnEscaping();
+ $this->lexer->moveNext();
+ }
+
+ $this->lexer->moveNext();
+ if ($this->lexer->isNextToken(EmailLexer::S_DOT)) {
+ throw new ExpectingATEXT();
+ }
+ }
+
+ protected function addTLDWarnings()
+ {
+ if ($this->warnings[DomainLiteral::CODE]) {
+ $this->warnings[TLD::CODE] = new TLD();
+ }
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php
new file mode 100644
index 0000000000..8ab16ab4a1
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Parser/LocalPart.php
@@ -0,0 +1,138 @@
+<?php
+
+namespace Egulias\EmailValidator\Parser;
+
+use Egulias\EmailValidator\Exception\DotAtEnd;
+use Egulias\EmailValidator\Exception\DotAtStart;
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Exception\ExpectingAT;
+use Egulias\EmailValidator\Exception\ExpectingATEXT;
+use Egulias\EmailValidator\Exception\UnclosedQuotedString;
+use Egulias\EmailValidator\Exception\UnopenedComment;
+use Egulias\EmailValidator\Warning\CFWSWithFWS;
+use Egulias\EmailValidator\Warning\LocalTooLong;
+
+class LocalPart extends Parser
+{
+ public function parse($localPart)
+ {
+ $parseDQuote = true;
+ $closingQuote = false;
+ $openedParenthesis = 0;
+
+ while ($this->lexer->token['type'] !== EmailLexer::S_AT && $this->lexer->token) {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT && !$this->lexer->getPrevious()) {
+ throw new DotAtStart();
+ }
+
+ $closingQuote = $this->checkDQUOTE($closingQuote);
+ if ($closingQuote && $parseDQuote) {
+ $parseDQuote = $this->parseDoubleQuote();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_OPENPARENTHESIS) {
+ $this->parseComments();
+ $openedParenthesis += $this->getOpenedParenthesis();
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_CLOSEPARENTHESIS) {
+ if ($openedParenthesis === 0) {
+ throw new UnopenedComment();
+ } else {
+ $openedParenthesis--;
+ }
+ }
+
+ $this->checkConsecutiveDots();
+
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT &&
+ $this->lexer->isNextToken(EmailLexer::S_AT)
+ ) {
+ throw new DotAtEnd();
+ }
+
+ $this->warnEscaping();
+ $this->isInvalidToken($this->lexer->token, $closingQuote);
+
+ if ($this->isFWS()) {
+ $this->parseFWS();
+ }
+
+ $this->lexer->moveNext();
+ }
+
+ $prev = $this->lexer->getPrevious();
+ if (strlen($prev['value']) > LocalTooLong::LOCAL_PART_LENGTH) {
+ $this->warnings[LocalTooLong::CODE] = new LocalTooLong();
+ }
+ }
+
+ protected function parseDoubleQuote()
+ {
+ $parseAgain = true;
+ $special = array(
+ EmailLexer::S_CR => true,
+ EmailLexer::S_HTAB => true,
+ EmailLexer::S_LF => true
+ );
+
+ $invalid = array(
+ EmailLexer::C_NUL => true,
+ EmailLexer::S_HTAB => true,
+ EmailLexer::S_CR => true,
+ EmailLexer::S_LF => true
+ );
+ $setSpecialsWarning = true;
+
+ $this->lexer->moveNext();
+
+ while ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE && $this->lexer->token) {
+ $parseAgain = false;
+ if (isset($special[$this->lexer->token['type']]) && $setSpecialsWarning) {
+ $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
+ $setSpecialsWarning = false;
+ }
+ if ($this->lexer->token['type'] === EmailLexer::S_BACKSLASH && $this->lexer->isNextToken(EmailLexer::S_DQUOTE)) {
+ $this->lexer->moveNext();
+ }
+
+ $this->lexer->moveNext();
+
+ if (!$this->escaped() && isset($invalid[$this->lexer->token['type']])) {
+ throw new ExpectingATEXT();
+ }
+ }
+
+ $prev = $this->lexer->getPrevious();
+
+ if ($prev['type'] === EmailLexer::S_BACKSLASH) {
+ if (!$this->checkDQUOTE(false)) {
+ throw new UnclosedQuotedString();
+ }
+ }
+
+ if (!$this->lexer->isNextToken(EmailLexer::S_AT) && $prev['type'] !== EmailLexer::S_BACKSLASH) {
+ throw new ExpectingAT();
+ }
+
+ return $parseAgain;
+ }
+
+ protected function isInvalidToken($token, $closingQuote)
+ {
+ $forbidden = array(
+ EmailLexer::S_COMMA,
+ EmailLexer::S_CLOSEBRACKET,
+ EmailLexer::S_OPENBRACKET,
+ EmailLexer::S_GREATERTHAN,
+ EmailLexer::S_LOWERTHAN,
+ EmailLexer::S_COLON,
+ EmailLexer::S_SEMICOLON,
+ EmailLexer::INVALID
+ );
+
+ if (in_array($token['type'], $forbidden) && !$closingQuote) {
+ throw new ExpectingATEXT();
+ }
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php
new file mode 100644
index 0000000000..e5042e1a85
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Parser/Parser.php
@@ -0,0 +1,215 @@
+<?php
+
+namespace Egulias\EmailValidator\Parser;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\AtextAfterCFWS;
+use Egulias\EmailValidator\Exception\ConsecutiveDot;
+use Egulias\EmailValidator\Exception\CRLFAtTheEnd;
+use Egulias\EmailValidator\Exception\CRLFX2;
+use Egulias\EmailValidator\Exception\CRNoLF;
+use Egulias\EmailValidator\Exception\ExpectedQPair;
+use Egulias\EmailValidator\Exception\ExpectingATEXT;
+use Egulias\EmailValidator\Exception\ExpectingCTEXT;
+use Egulias\EmailValidator\Exception\UnclosedComment;
+use Egulias\EmailValidator\Exception\UnclosedQuotedString;
+use Egulias\EmailValidator\Warning\CFWSNearAt;
+use Egulias\EmailValidator\Warning\CFWSWithFWS;
+use Egulias\EmailValidator\Warning\Comment;
+use Egulias\EmailValidator\Warning\QuotedPart;
+use Egulias\EmailValidator\Warning\QuotedString;
+
+abstract class Parser
+{
+ protected $warnings = [];
+ protected $lexer;
+ protected $openedParenthesis = 0;
+
+ public function __construct(EmailLexer $lexer)
+ {
+ $this->lexer = $lexer;
+ }
+
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
+ abstract public function parse($str);
+
+ /** @return int */
+ public function getOpenedParenthesis()
+ {
+ return $this->openedParenthesis;
+ }
+
+ /**
+ * validateQuotedPair
+ */
+ protected function validateQuotedPair()
+ {
+ if (!($this->lexer->token['type'] === EmailLexer::INVALID
+ || $this->lexer->token['type'] === EmailLexer::C_DEL)) {
+ throw new ExpectedQPair();
+ }
+
+ $this->warnings[QuotedPart::CODE] =
+ new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']);
+ }
+
+ protected function parseComments()
+ {
+ $this->openedParenthesis = 1;
+ $this->isUnclosedComment();
+ $this->warnings[Comment::CODE] = new Comment();
+ while (!$this->lexer->isNextToken(EmailLexer::S_CLOSEPARENTHESIS)) {
+ if ($this->lexer->isNextToken(EmailLexer::S_OPENPARENTHESIS)) {
+ $this->openedParenthesis++;
+ }
+ $this->warnEscaping();
+ $this->lexer->moveNext();
+ }
+
+ $this->lexer->moveNext();
+ if ($this->lexer->isNextTokenAny(array(EmailLexer::GENERIC, EmailLexer::S_EMPTY))) {
+ throw new ExpectingATEXT();
+ }
+
+ if ($this->lexer->isNextToken(EmailLexer::S_AT)) {
+ $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt();
+ }
+ }
+
+ protected function isUnclosedComment()
+ {
+ try {
+ $this->lexer->find(EmailLexer::S_CLOSEPARENTHESIS);
+ return true;
+ } catch (\RuntimeException $e) {
+ throw new UnclosedComment();
+ }
+ }
+
+ protected function parseFWS()
+ {
+ $previous = $this->lexer->getPrevious();
+
+ $this->checkCRLFInFWS();
+
+ if ($this->lexer->token['type'] === EmailLexer::S_CR) {
+ throw new CRNoLF();
+ }
+
+ if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] !== EmailLexer::S_AT) {
+ throw new AtextAfterCFWS();
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_LF || $this->lexer->token['type'] === EmailLexer::C_NUL) {
+ throw new ExpectingCTEXT();
+ }
+
+ if ($this->lexer->isNextToken(EmailLexer::S_AT) || $previous['type'] === EmailLexer::S_AT) {
+ $this->warnings[CFWSNearAt::CODE] = new CFWSNearAt();
+ } else {
+ $this->warnings[CFWSWithFWS::CODE] = new CFWSWithFWS();
+ }
+ }
+
+ protected function checkConsecutiveDots()
+ {
+ if ($this->lexer->token['type'] === EmailLexer::S_DOT && $this->lexer->isNextToken(EmailLexer::S_DOT)) {
+ throw new ConsecutiveDot();
+ }
+ }
+
+ protected function isFWS()
+ {
+ if ($this->escaped()) {
+ return false;
+ }
+
+ if ($this->lexer->token['type'] === EmailLexer::S_SP ||
+ $this->lexer->token['type'] === EmailLexer::S_HTAB ||
+ $this->lexer->token['type'] === EmailLexer::S_CR ||
+ $this->lexer->token['type'] === EmailLexer::S_LF ||
+ $this->lexer->token['type'] === EmailLexer::CRLF
+ ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected function escaped()
+ {
+ $previous = $this->lexer->getPrevious();
+
+ if ($previous['type'] === EmailLexer::S_BACKSLASH
+ &&
+ $this->lexer->token['type'] !== EmailLexer::GENERIC
+ ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ protected function warnEscaping()
+ {
+ if ($this->lexer->token['type'] !== EmailLexer::S_BACKSLASH) {
+ return false;
+ }
+
+ if ($this->lexer->isNextToken(EmailLexer::GENERIC)) {
+ throw new ExpectingATEXT();
+ }
+
+ if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB, EmailLexer::C_DEL))) {
+ return false;
+ }
+
+ $this->warnings[QuotedPart::CODE] =
+ new QuotedPart($this->lexer->getPrevious()['type'], $this->lexer->token['type']);
+ return true;
+
+ }
+
+ protected function checkDQUOTE($hasClosingQuote)
+ {
+ if ($this->lexer->token['type'] !== EmailLexer::S_DQUOTE) {
+ return $hasClosingQuote;
+ }
+ if ($hasClosingQuote) {
+ return $hasClosingQuote;
+ }
+ $previous = $this->lexer->getPrevious();
+ if ($this->lexer->isNextToken(EmailLexer::GENERIC) && $previous['type'] === EmailLexer::GENERIC) {
+ throw new ExpectingATEXT();
+ }
+
+ try {
+ $this->lexer->find(EmailLexer::S_DQUOTE);
+ $hasClosingQuote = true;
+ } catch (\Exception $e) {
+ throw new UnclosedQuotedString();
+ }
+ $this->warnings[QuotedString::CODE] = new QuotedString($previous['value'], $this->lexer->token['value']);
+
+ return $hasClosingQuote;
+ }
+
+ protected function checkCRLFInFWS()
+ {
+ if ($this->lexer->token['type'] !== EmailLexer::CRLF) {
+ return;
+ }
+
+ if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) {
+ throw new CRLFX2();
+ }
+
+ if (!$this->lexer->isNextTokenAny(array(EmailLexer::S_SP, EmailLexer::S_HTAB))) {
+ throw new CRLFAtTheEnd();
+ }
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
new file mode 100644
index 0000000000..e5c3e5df90
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/DNSCheckValidation.php
@@ -0,0 +1,72 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Warning\NoDNSMXRecord;
+use Egulias\EmailValidator\Exception\NoDNSRecord;
+
+class DNSCheckValidation implements EmailValidation
+{
+ /**
+ * @var array
+ */
+ private $warnings = [];
+
+ /**
+ * @var InvalidEmail
+ */
+ private $error;
+
+ public function __construct()
+ {
+ if (!extension_loaded('intl')) {
+ throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
+ }
+ }
+
+ public function isValid($email, EmailLexer $emailLexer)
+ {
+ // use the input to check DNS if we cannot extract something similar to a domain
+ $host = $email;
+
+ // Arguable pattern to extract the domain. Not aiming to validate the domain nor the email
+ if (false !== $lastAtPos = strrpos($email, '@')) {
+ $host = substr($email, $lastAtPos + 1);
+ }
+
+ return $this->checkDNS($host);
+ }
+
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+
+ protected function checkDNS($host)
+ {
+ $variant = INTL_IDNA_VARIANT_2003;
+ if ( defined('INTL_IDNA_VARIANT_UTS46') ) {
+ $variant = INTL_IDNA_VARIANT_UTS46;
+ }
+ $host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
+
+ $Aresult = true;
+ $MXresult = checkdnsrr($host, 'MX');
+
+ if (!$MXresult) {
+ $this->warnings[NoDNSMXRecord::CODE] = new NoDNSMXRecord();
+ $Aresult = checkdnsrr($host, 'A') || checkdnsrr($host, 'AAAA');
+ if (!$Aresult) {
+ $this->error = new NoDNSRecord();
+ }
+ }
+ return $MXresult || $Aresult;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php
new file mode 100644
index 0000000000..d5a015be57
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/EmailValidation.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Warning\Warning;
+
+interface EmailValidation
+{
+ /**
+ * Returns true if the given email is valid.
+ *
+ * @param string $email The email you want to validate.
+ * @param EmailLexer $emailLexer The email lexer.
+ *
+ * @return bool
+ */
+ public function isValid($email, EmailLexer $emailLexer);
+
+ /**
+ * Returns the validation error.
+ *
+ * @return InvalidEmail|null
+ */
+ public function getError();
+
+ /**
+ * Returns the validation warnings.
+ *
+ * @return Warning[]
+ */
+ public function getWarnings();
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/Error/RFCWarnings.php b/vendor/egulias/email-validator/EmailValidator/Validation/Error/RFCWarnings.php
new file mode 100644
index 0000000000..7f2256d60f
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/Error/RFCWarnings.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation\Error;
+
+use Egulias\EmailValidator\Exception\InvalidEmail;
+
+class RFCWarnings extends InvalidEmail
+{
+ const CODE = 997;
+ const REASON = 'Warnings were found.';
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/Error/SpoofEmail.php b/vendor/egulias/email-validator/EmailValidator/Validation/Error/SpoofEmail.php
new file mode 100644
index 0000000000..8c92cb5aec
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/Error/SpoofEmail.php
@@ -0,0 +1,11 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation\Error;
+
+use Egulias\EmailValidator\Exception\InvalidEmail;
+
+class SpoofEmail extends InvalidEmail
+{
+ const CODE = 998;
+ const REASON = "The email contains mixed UTF8 chars that makes it suspicious";
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php b/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
new file mode 100644
index 0000000000..775ad16fb5
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/Exception/EmptyValidationList.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation\Exception;
+
+use Exception;
+
+class EmptyValidationList extends \InvalidArgumentException
+{
+ public function __construct($code = 0, Exception $previous = null)
+ {
+ parent::__construct("Empty validation list is not allowed", $code, $previous);
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
new file mode 100644
index 0000000000..d5e87d8ce0
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleErrors.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\Exception\InvalidEmail;
+
+class MultipleErrors extends InvalidEmail
+{
+ const CODE = 999;
+ const REASON = "Accumulated errors for multiple validations";
+ /**
+ * @var array
+ */
+ private $errors = [];
+
+ public function __construct(array $errors)
+ {
+ $this->errors = $errors;
+ parent::__construct();
+ }
+
+ public function getErrors()
+ {
+ return $this->errors;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
new file mode 100644
index 0000000000..43fa42a64b
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/MultipleValidationWithAnd.php
@@ -0,0 +1,110 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Validation\Exception\EmptyValidationList;
+
+class MultipleValidationWithAnd implements EmailValidation
+{
+ /**
+ * If one of validations gets failure skips all succeeding validation.
+ * This means MultipleErrors will only contain a single error which first found.
+ */
+ const STOP_ON_ERROR = 0;
+
+ /**
+ * All of validations will be invoked even if one of them got failure.
+ * So MultipleErrors will contain all causes.
+ */
+ const ALLOW_ALL_ERRORS = 1;
+
+ /**
+ * @var EmailValidation[]
+ */
+ private $validations = [];
+
+ /**
+ * @var array
+ */
+ private $warnings = [];
+
+ /**
+ * @var MultipleErrors
+ */
+ private $error;
+
+ /**
+ * @var bool
+ */
+ private $mode;
+
+ /**
+ * @param EmailValidation[] $validations The validations.
+ * @param int $mode The validation mode (one of the constants).
+ */
+ public function __construct(array $validations, $mode = self::ALLOW_ALL_ERRORS)
+ {
+ if (count($validations) == 0) {
+ throw new EmptyValidationList();
+ }
+
+ $this->validations = $validations;
+ $this->mode = $mode;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isValid($email, EmailLexer $emailLexer)
+ {
+ $result = true;
+ $errors = [];
+ foreach ($this->validations as $validation) {
+ $emailLexer->reset();
+ $result = $result && $validation->isValid($email, $emailLexer);
+ $this->warnings = array_merge($this->warnings, $validation->getWarnings());
+ $errors = $this->addNewError($validation->getError(), $errors);
+
+ if ($this->shouldStop($result)) {
+ break;
+ }
+ }
+
+ if (!empty($errors)) {
+ $this->error = new MultipleErrors($errors);
+ }
+
+ return $result;
+ }
+
+ private function addNewError($possibleError, array $errors)
+ {
+ if (null !== $possibleError) {
+ $errors[] = $possibleError;
+ }
+
+ return $errors;
+ }
+
+ private function shouldStop($result)
+ {
+ return !$result && $this->mode === self::STOP_ON_ERROR;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
new file mode 100644
index 0000000000..e4bf0cc4df
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/NoRFCWarningsValidation.php
@@ -0,0 +1,41 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Validation\Error\RFCWarnings;
+
+class NoRFCWarningsValidation extends RFCValidation
+{
+ /**
+ * @var InvalidEmail
+ */
+ private $error;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isValid($email, EmailLexer $emailLexer)
+ {
+ if (!parent::isValid($email, $emailLexer)) {
+ return false;
+ }
+
+ if (empty($this->getWarnings())) {
+ return true;
+ }
+
+ $this->error = new RFCWarnings();
+
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getError()
+ {
+ return $this->error ?: parent::getError();
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
new file mode 100644
index 0000000000..c4ffe35034
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/RFCValidation.php
@@ -0,0 +1,49 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\EmailParser;
+use Egulias\EmailValidator\Exception\InvalidEmail;
+
+class RFCValidation implements EmailValidation
+{
+ /**
+ * @var EmailParser
+ */
+ private $parser;
+
+ /**
+ * @var array
+ */
+ private $warnings = [];
+
+ /**
+ * @var InvalidEmail
+ */
+ private $error;
+
+ public function isValid($email, EmailLexer $emailLexer)
+ {
+ $this->parser = new EmailParser($emailLexer);
+ try {
+ $this->parser->parse((string)$email);
+ } catch (InvalidEmail $invalid) {
+ $this->error = $invalid;
+ return false;
+ }
+
+ $this->warnings = $this->parser->getWarnings();
+ return true;
+ }
+
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ public function getWarnings()
+ {
+ return $this->warnings;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
new file mode 100644
index 0000000000..4721f0d8c9
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Validation/SpoofCheckValidation.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Egulias\EmailValidator\Validation;
+
+use Egulias\EmailValidator\EmailLexer;
+use Egulias\EmailValidator\Exception\InvalidEmail;
+use Egulias\EmailValidator\Validation\Error\SpoofEmail;
+use \Spoofchecker;
+
+class SpoofCheckValidation implements EmailValidation
+{
+ /**
+ * @var InvalidEmail
+ */
+ private $error;
+
+ public function __construct()
+ {
+ if (!extension_loaded('intl')) {
+ throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
+ }
+ }
+
+ public function isValid($email, EmailLexer $emailLexer)
+ {
+ $checker = new Spoofchecker();
+ $checker->setChecks(Spoofchecker::SINGLE_SCRIPT);
+
+ if ($checker->isSuspicious($email)) {
+ $this->error = new SpoofEmail();
+ }
+
+ return $this->error === null;
+ }
+
+ public function getError()
+ {
+ return $this->error;
+ }
+
+ public function getWarnings()
+ {
+ return [];
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php
new file mode 100644
index 0000000000..77e70f7f55
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/AddressLiteral.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class AddressLiteral extends Warning
+{
+ const CODE = 12;
+
+ public function __construct()
+ {
+ $this->message = 'Address literal in domain part';
+ $this->rfcNumber = 5321;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php
new file mode 100644
index 0000000000..be43bbe6f6
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSNearAt.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class CFWSNearAt extends Warning
+{
+ const CODE = 49;
+
+ public function __construct()
+ {
+ $this->message = "Deprecated folding white space near @";
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php
new file mode 100644
index 0000000000..dea3450ec8
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/CFWSWithFWS.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class CFWSWithFWS extends Warning
+{
+ const CODE = 18;
+
+ public function __construct()
+ {
+ $this->message = 'Folding whites space followed by folding white space';
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php
new file mode 100644
index 0000000000..704c2908b9
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/Comment.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class Comment extends Warning
+{
+ const CODE = 17;
+
+ public function __construct()
+ {
+ $this->message = "Comments found in this email";
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php
new file mode 100644
index 0000000000..ad43bd7c97
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/DeprecatedComment.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class DeprecatedComment extends Warning
+{
+ const CODE = 37;
+
+ public function __construct()
+ {
+ $this->message = 'Deprecated comments';
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php
new file mode 100644
index 0000000000..6f36b5e293
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainLiteral.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class DomainLiteral extends Warning
+{
+ const CODE = 70;
+
+ public function __construct()
+ {
+ $this->message = 'Domain Literal';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php
new file mode 100644
index 0000000000..61ff17a767
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/DomainTooLong.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class DomainTooLong extends Warning
+{
+ const CODE = 255;
+
+ public function __construct()
+ {
+ $this->message = 'Domain is too long, exceeds 255 chars';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php
new file mode 100644
index 0000000000..497309dbb0
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/EmailTooLong.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+use Egulias\EmailValidator\EmailParser;
+
+class EmailTooLong extends Warning
+{
+ const CODE = 66;
+
+ public function __construct()
+ {
+ $this->message = 'Email is too long, exceeds ' . EmailParser::EMAIL_MAX_LENGTH;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php
new file mode 100644
index 0000000000..ba2fcc01b8
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6BadChar.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6BadChar extends Warning
+{
+ const CODE = 74;
+
+ public function __construct()
+ {
+ $this->message = 'Bad char in IPV6 domain literal';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php
new file mode 100644
index 0000000000..41afa78c63
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonEnd.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6ColonEnd extends Warning
+{
+ const CODE = 77;
+
+ public function __construct()
+ {
+ $this->message = ':: found at the end of the domain literal';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php
new file mode 100644
index 0000000000..1bf754e30c
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6ColonStart.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6ColonStart extends Warning
+{
+ const CODE = 76;
+
+ public function __construct()
+ {
+ $this->message = ':: found at the start of the domain literal';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php
new file mode 100644
index 0000000000..d752caaa19
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6Deprecated.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6Deprecated extends Warning
+{
+ const CODE = 13;
+
+ public function __construct()
+ {
+ $this->message = 'Deprecated form of IPV6';
+ $this->rfcNumber = 5321;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php
new file mode 100644
index 0000000000..4f82394996
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6DoubleColon.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6DoubleColon extends Warning
+{
+ const CODE = 73;
+
+ public function __construct()
+ {
+ $this->message = 'Double colon found after IPV6 tag';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php
new file mode 100644
index 0000000000..a59d317f28
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6GroupCount.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6GroupCount extends Warning
+{
+ const CODE = 72;
+
+ public function __construct()
+ {
+ $this->message = 'Group count is not IPV6 valid';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php
new file mode 100644
index 0000000000..936274c13e
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/IPV6MaxGroups.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class IPV6MaxGroups extends Warning
+{
+ const CODE = 75;
+
+ public function __construct()
+ {
+ $this->message = 'Reached the maximum number of IPV6 groups allowed';
+ $this->rfcNumber = 5321;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php
new file mode 100644
index 0000000000..daf07f4083
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/LabelTooLong.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class LabelTooLong extends Warning
+{
+ const CODE = 63;
+
+ public function __construct()
+ {
+ $this->message = 'Label too long';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php
new file mode 100644
index 0000000000..0d08d8b35c
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/LocalTooLong.php
@@ -0,0 +1,15 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class LocalTooLong extends Warning
+{
+ const CODE = 64;
+ const LOCAL_PART_LENGTH = 64;
+
+ public function __construct()
+ {
+ $this->message = 'Local part is too long, exceeds 64 chars (octets)';
+ $this->rfcNumber = 5322;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php
new file mode 100644
index 0000000000..b3c21a1f3b
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/NoDNSMXRecord.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class NoDNSMXRecord extends Warning
+{
+ const CODE = 6;
+
+ public function __construct()
+ {
+ $this->message = 'No MX DSN record was found for this email';
+ $this->rfcNumber = 5321;
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php
new file mode 100644
index 0000000000..10f19e3340
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/ObsoleteDTEXT.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class ObsoleteDTEXT extends Warning
+{
+ const CODE = 71;
+
+ public function __construct()
+ {
+ $this->rfcNumber = 5322;
+ $this->message = 'Obsolete DTEXT in domain literal';
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
new file mode 100644
index 0000000000..7be9e6a3f2
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedPart.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class QuotedPart extends Warning
+{
+ const CODE = 36;
+
+ public function __construct($prevToken, $postToken)
+ {
+ $this->message = "Deprecated Quoted String found between $prevToken and $postToken";
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php
new file mode 100644
index 0000000000..e9d56e1e03
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/QuotedString.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class QuotedString extends Warning
+{
+ const CODE = 11;
+
+ public function __construct($prevToken, $postToken)
+ {
+ $this->message = "Quoted String found between $prevToken and $postToken";
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php
new file mode 100644
index 0000000000..2338b9f442
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/TLD.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+class TLD extends Warning
+{
+ const CODE = 9;
+
+ public function __construct()
+ {
+ $this->message = "RFC5321, TLD";
+ }
+}
diff --git a/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php
new file mode 100644
index 0000000000..ec6a365ffb
--- /dev/null
+++ b/vendor/egulias/email-validator/EmailValidator/Warning/Warning.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Egulias\EmailValidator\Warning;
+
+abstract class Warning
+{
+ const CODE = 0;
+ protected $message;
+ protected $rfcNumber;
+
+ public function message()
+ {
+ return $this->message;
+ }
+
+ public function code()
+ {
+ return self::CODE;
+ }
+
+ public function RFCNumber()
+ {
+ return $this->rfcNumber;
+ }
+
+ public function __toString()
+ {
+ return $this->message() . " rfc: " . $this->rfcNumber . "interal code: " . static::CODE;
+ }
+}
diff --git a/vendor/egulias/email-validator/LICENSE b/vendor/egulias/email-validator/LICENSE
new file mode 100644
index 0000000000..c34d2c197d
--- /dev/null
+++ b/vendor/egulias/email-validator/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2013-2016 Eduardo Gulias Davis
+
+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/egulias/email-validator/README.md b/vendor/egulias/email-validator/README.md
new file mode 100644
index 0000000000..8fcd2a6fea
--- /dev/null
+++ b/vendor/egulias/email-validator/README.md
@@ -0,0 +1,79 @@
+# EmailValidator
+[![Build Status](https://travis-ci.org/egulias/EmailValidator.png?branch=master)](https://travis-ci.org/egulias/EmailValidator) [![Coverage Status](https://coveralls.io/repos/egulias/EmailValidator/badge.png?branch=master)](https://coveralls.io/r/egulias/EmailValidator?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/egulias/EmailValidator/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/egulias/EmailValidator/?branch=master) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6/small.png)](https://insight.sensiolabs.com/projects/22ba6692-9c02-42e5-a65d-1c5696bfffc6)
+=============================
+With the help of [PHPStorm](https://www.jetbrains.com/phpstorm/)
+
+## Requirements ##
+
+ * [Composer](https://getcomposer.org) is required for installation
+ * [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) and [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) validation requires that your PHP system have the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
+
+## Installation ##
+
+Run the command below to install via Composer
+
+```shell
+composer require egulias/email-validator "~2.1"
+```
+
+## Getting Started ##
+`EmailValidator`requires you to decide which (or combination of them) validation/s strategy/ies you'd like to follow for each [validation](#available-validations).
+
+A basic example with the RFC validation
+```php
+<?php
+
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
+$validator = new EmailValidator();
+$validator->isValid("example@example.com", new RFCValidation()); //true
+```
+
+
+### Available validations ###
+
+1. [RFCValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/RFCValidation.php)
+2. [NoRFCWarningsValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/NoRFCWarningsValidation.php)
+3. [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php)
+4. [SpoofCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php)
+5. [MultipleValidationWithAnd](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/MultipleValidationWithAnd.php)
+6. [Your own validation](#how-to-extend)
+
+`MultipleValidationWithAnd`
+
+It is a validation that operates over other validations performing a logical and (&&) over the result of each validation.
+
+```php
+<?php
+
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\DNSCheckValidation;
+use Egulias\EmailValidator\Validation\MultipleValidationWithAnd;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
+$validator = new EmailValidator();
+$multipleValidations = new MultipleValidationWithAnd([
+ new RFCValidation(),
+ new DNSCheckValidation()
+]);
+$validator->isValid("example@example.com", $multipleValidations); //true
+```
+
+### How to extend ###
+
+It's easy! You just need to implement [EmailValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/EmailValidation.php) and you can use your own validation.
+
+
+## Other Contributors ##
+(You can find current contributors [here](https://github.com/egulias/EmailValidator/graphs/contributors))
+
+As this is a port from another library and work, here are other people related to the previous one:
+
+* Ricard Clau [@ricardclau](https://github.com/ricardclau): Performance against PHP built-in filter_var
+* Josepf Bielawski [@stloyd](https://github.com/stloyd): For its first re-work of Dominic's lib
+* Dominic Sayers [@dominicsayers](https://github.com/dominicsayers): The original isemail function
+
+## License ##
+Released under the MIT License attached with this code.
+
diff --git a/vendor/egulias/email-validator/composer.json b/vendor/egulias/email-validator/composer.json
new file mode 100644
index 0000000000..5423e9f02b
--- /dev/null
+++ b/vendor/egulias/email-validator/composer.json
@@ -0,0 +1,44 @@
+{
+ "name": "egulias/email-validator",
+ "description": "A library for validating emails against several RFCs",
+ "homepage": "https://github.com/egulias/EmailValidator",
+ "type": "Library",
+ "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"],
+ "license": "MIT",
+ "authors": [
+ {"name": "Eduardo Gulias Davis"}
+ ],
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "repositories": [
+ {
+ "type": "git",
+ "url": "https://github.com/dominicsayers/isemail"
+ }
+ ],
+ "require": {
+ "php": ">= 5.5",
+ "doctrine/lexer": "^1.0.1"
+ },
+ "require-dev" : {
+ "satooshi/php-coveralls": "^1.0.1",
+ "phpunit/phpunit": "^4.8.35||^5.7||^6.0",
+ "dominicsayers/isemail": "dev-master"
+ },
+ "suggest": {
+ "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation"
+ },
+ "autoload": {
+ "psr-4": {
+ "Egulias\\EmailValidator\\": "EmailValidator"
+ }
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Egulias\\Tests\\": "test"
+ }
+ }
+}
diff --git a/vendor/egulias/email-validator/phpunit.xml.dist b/vendor/egulias/email-validator/phpunit.xml.dist
new file mode 100644
index 0000000000..b0812f97be
--- /dev/null
+++ b/vendor/egulias/email-validator/phpunit.xml.dist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="vendor/autoload.php"
+>
+<testsuites>
+ <testsuite name="EmailValidator Test Suite">
+ <directory>./Tests/EmailValidator</directory>
+ <exclude>./vendor/</exclude>
+ </testsuite>
+</testsuites>
+
+<filter>
+ <blacklist>
+ <directory>./vendor</directory>
+ </blacklist>
+</filter>
+</phpunit>
diff --git a/vendor/swiftmailer/swiftmailer/.gitattributes b/vendor/swiftmailer/swiftmailer/.gitattributes
index 33b8efdb87..09c3fba946 100644
--- a/vendor/swiftmailer/swiftmailer/.gitattributes
+++ b/vendor/swiftmailer/swiftmailer/.gitattributes
@@ -6,4 +6,4 @@
*.txt -crlf
# ignore /notes in the git-generated distributed .zip archive
-/notes export-ignore
+/doc/notes export-ignore
diff --git a/vendor/swiftmailer/swiftmailer/.php_cs.dist b/vendor/swiftmailer/swiftmailer/.php_cs.dist
index f18d65d428..2c04e04be3 100644
--- a/vendor/swiftmailer/swiftmailer/.php_cs.dist
+++ b/vendor/swiftmailer/swiftmailer/.php_cs.dist
@@ -1,15 +1,16 @@
<?php
return PhpCsFixer\Config::create()
- ->setRules(array(
+ ->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
- 'array_syntax' => array('syntax' => 'long'),
+ 'array_syntax' => ['syntax' => 'short'],
'no_unreachable_default_argument_value' => false,
- 'braces' => array('allow_single_line_closure' => true),
+ 'braces' => ['allow_single_line_closure' => true],
'heredoc_to_nowdoc' => false,
'phpdoc_annotation_without_dot' => false,
- ))
+ 'ternary_to_null_coalescing' => true,
+ ])
->setRiskyAllowed(true)
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__))
;
diff --git a/vendor/swiftmailer/swiftmailer/.travis.yml b/vendor/swiftmailer/swiftmailer/.travis.yml
index fc24d05e89..5ee2c0dbe1 100644
--- a/vendor/swiftmailer/swiftmailer/.travis.yml
+++ b/vendor/swiftmailer/swiftmailer/.travis.yml
@@ -11,19 +11,13 @@ before_script:
- gem install mailcatcher
- mailcatcher --smtp-port 4456
-script: ./vendor/bin/simple-phpunit
+script: SYMFONY_PHPUNIT_VERSION=6.1 ./vendor/bin/simple-phpunit
matrix:
include:
- - php: 5.3
- - php: 5.4
- - php: 5.5
- - php: 5.6
- php: 7.0
- php: 7.1
- - php: hhvm
- allow_failures:
- - php: hhvm
+ - php: 7.2
fast_finish: true
cache:
diff --git a/vendor/swiftmailer/swiftmailer/CHANGES b/vendor/swiftmailer/swiftmailer/CHANGES
index 3532ec2dcd..1725a2043f 100644
--- a/vendor/swiftmailer/swiftmailer/CHANGES
+++ b/vendor/swiftmailer/swiftmailer/CHANGES
@@ -1,21 +1,66 @@
Changelog
=========
-5.4.12 (2018-07-31)
--------------------
+6.1.3 (2018-XX-XX)
+------------------
+
+ * added auto-start to the SMTP transport when sending a message
+ * tweaked error message when the response from an SMTP server is empty
+ * fixed missing property in Swift_Mime_IdGenerator
+ * exposed original body content type with Swift_Mime_SimpleMimeEntity::getBodyContentType()
+ * fixed typo in variable name in Swift_AddressEncoder_IdnAddressEncoder
+ * fixed return type in MessageLogger
+ * fixed missing property addressEncoder in SimpleHeaderFactory class
+
+6.1.2 (2018-07-13)
+------------------
- * fixed typo
+ * handled recipient errors when pipelining
-5.4.11 (2018-07-31)
--------------------
+6.1.1 (2018-07-04)
+------------------
- * fixed startTLS support for PHP 5.6-
+ * removed hard dependency on an IDN encoder
-5.4.10 (2018-07-27)
--------------------
+6.1.0 (2018-07-02)
+------------------
+ * added address encoder exceptions during send
+ * added support for bubbling up authenticator error messages
+ * added support for non-ASCII email addresses
+ * introduced new dependencies: transport.smtphandlers and transport.authhandlers
+ * deprecated Swift_Signers_OpenDKIMSigner; use Swift_Signers_DKIMSigner instead
+ * added support for SMTP pipelining
+ * added Swift_Transport_Esmtp_EightBitMimeHandler
* fixed startTLS only allowed tls1.0, now allowed: tls1.0, tls1.1, tls1.2
+6.0.2 (2017-09-30)
+------------------
+
+ * fixed DecoratorPlugin
+ * removed usage of getmypid()
+
+6.0.1 (2017-05-20)
+------------------
+
+ * fixed BC break that can be avoided easily
+
+6.0.0 (2017-05-19)
+------------------
+
+ * added Swift_Transport::ping()
+ * removed Swift_Mime_HeaderFactory, Swift_Mime_HeaderSet, Swift_Mime_Message, Swift_Mime_MimeEntity,
+ and Swift_Mime_ParameterizedHeader interfaces
+ * removed Swift_MailTransport and Swift_Transport_MailTransport
+ * removed Swift_Encoding
+ * removed the Swift_Transport_MailInvoker interface and Swift_Transport_SimpleMailInvoker class
+ * removed the Swift_SignedMessage class
+ * removed newInstance() methods everywhere
+ * methods operating on Date header now use DateTimeImmutable object instead of Unix timestamp;
+ Swift_Mime_Headers_DateHeader::getTimestamp()/setTimestamp() renamed to getDateTime()/setDateTime()
+ * bumped minimum version to PHP 7.0
+ * removed Swift_Validate and replaced by egulias/email-validator
+
5.4.9 (2018-01-23)
------------------
diff --git a/vendor/swiftmailer/swiftmailer/LICENSE b/vendor/swiftmailer/swiftmailer/LICENSE
index 485f1d6d6c..bb9c80f0c8 100644
--- a/vendor/swiftmailer/swiftmailer/LICENSE
+++ b/vendor/swiftmailer/swiftmailer/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2013-2016 Fabien Potencier
+Copyright (c) 2013-2018 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/swiftmailer/swiftmailer/README b/vendor/swiftmailer/swiftmailer/README
index 52c0757582..a41b66027d 100644
--- a/vendor/swiftmailer/swiftmailer/README
+++ b/vendor/swiftmailer/swiftmailer/README
@@ -1,7 +1,7 @@
Swift Mailer
------------
-Swift Mailer is a component based mailing solution for PHP 5.
+Swift Mailer is a component based mailing solution for PHP 7.
It is released under the MIT license.
Homepage: https://swiftmailer.symfony.com/
diff --git a/vendor/swiftmailer/swiftmailer/VERSION b/vendor/swiftmailer/swiftmailer/VERSION
deleted file mode 100644
index 82a2d1d048..0000000000
--- a/vendor/swiftmailer/swiftmailer/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-Swift-5.4.12
diff --git a/vendor/swiftmailer/swiftmailer/composer.json b/vendor/swiftmailer/swiftmailer/composer.json
index 44a1050fa2..9e5d360fe4 100644
--- a/vendor/swiftmailer/swiftmailer/composer.json
+++ b/vendor/swiftmailer/swiftmailer/composer.json
@@ -15,23 +15,26 @@
}
],
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.0.0",
+ "egulias/email-validator": "~2.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
- "symfony/phpunit-bridge": "~3.2"
+ "symfony/phpunit-bridge": "~3.3@dev"
+ },
+ "suggest": {
+ "ext-intl": "Needed to support internationalized email addresses",
+ "true/punycode": "Needed to support internationalized email addresses, if ext-intl is not installed"
},
"autoload": {
"files": ["lib/swift_required.php"]
},
"autoload-dev": {
- "psr-0": {
- "Swift_": "tests/unit"
- }
+ "psr-0": { "Swift_": "tests/unit" }
},
"extra": {
"branch-alias": {
- "dev-master": "5.4-dev"
+ "dev-master": "6.1-dev"
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/doc/headers.rst b/vendor/swiftmailer/swiftmailer/doc/headers.rst
index 2c11c18e06..8b8bece261 100644
--- a/vendor/swiftmailer/swiftmailer/doc/headers.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/headers.rst
@@ -8,15 +8,15 @@ this.
Header Basics
-------------
-All MIME entities in Swift Mailer -- including the message itself --
-store their headers in a single object called a HeaderSet. This HeaderSet is
+All MIME entities in Swift Mailer -- including the message itself -- store
+their headers in a single object called a HeaderSet. This HeaderSet is
retrieved with the ``getHeaders()`` method.
As mentioned in the previous chapter, everything that forms a part of a message
in Swift Mailer is a MIME entity that is represented by an instance of
-``Swift_Mime_MimeEntity``. This includes -- most notably -- the message object
-itself, attachments, MIME parts and embedded images. Each of these MIME entities
-consists of a body and a set of headers that describe the body.
+``Swift_Mime_SimpleMimeEntity``. This includes -- most notably -- the message
+object itself, attachments, MIME parts and embedded images. Each of these MIME
+entities consists of a body and a set of headers that describe the body.
For all of the "standard" headers in these MIME entities, such as the
``Content-Type``, there are named methods for working with them, such as
@@ -25,11 +25,9 @@ moderately complex area of the library. Each header has a slightly different
required structure that it must meet in order to comply with the standards that
govern email (and that are checked by spam blockers etc).
-You fetch the HeaderSet from a MIME entity like so:
+You fetch the HeaderSet from a MIME entity like so::
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
// Fetch the HeaderSet from a Message object
$headers = $message->getHeaders();
@@ -44,10 +42,8 @@ Depending upon the MIME entity the HeaderSet came from, the contents of the
HeaderSet will be different, since an attachment for example has a different
set of headers to those in a message.
-You can find out what the HeaderSet contains with a quick loop, dumping out
-the names of the headers:
-
-.. code-block:: php
+You can find out what the HeaderSet contains with a quick loop, dumping out the
+names of the headers::
foreach ($headers->getAll() as $header) {
printf("%s<br />\n", $header->getFieldName());
@@ -65,9 +61,7 @@ the names of the headers:
*/
You can also dump out the rendered HeaderSet by calling its ``toString()``
-method:
-
-.. code-block:: php
+method::
echo $headers->toString();
@@ -85,18 +79,15 @@ method:
Where the complexity comes in is when you want to modify an existing header.
This complexity comes from the fact that each header can be of a slightly
different type (such as a Date header, or a header that contains email
-addresses, or a header that has key-value parameters on it!). Each header in the
-HeaderSet is an instance of ``Swift_Mime_Header``. They all have common
+addresses, or a header that has key-value parameters on it!). Each header in
+the HeaderSet is an instance of ``Swift_Mime_Header``. They all have common
functionality, but knowing exactly what type of header you're working with will
allow you a little more control.
You can determine the type of header by comparing the return value of its
``getFieldType()`` method with the constants ``TYPE_TEXT``,
``TYPE_PARAMETERIZED``, ``TYPE_DATE``, ``TYPE_MAILBOX``, ``TYPE_ID`` and
-``TYPE_PATH`` which are defined in ``Swift_Mime_Header``.
-
-
-.. code-block:: php
+``TYPE_PATH`` which are defined in ``Swift_Mime_Header``::
foreach ($headers->getAll() as $header) {
switch ($header->getFieldType()) {
@@ -131,8 +122,8 @@ Headers can be removed from the set, modified within the set, or added to the
set.
The following sections show you how to work with the HeaderSet and explain the
-details of each implementation of ``Swift_Mime_Header`` that may
-exist within the HeaderSet.
+details of each implementation of ``Swift_Mime_Header`` that may exist within
+the HeaderSet.
Header Types
------------
@@ -151,44 +142,33 @@ header in a message.
There's nothing particularly interesting about a text header, though it is
probably the one you'd opt to use if you need to add a custom header to a
-message. It represents text just like you'd think it does. If the text
-contains characters that are not permitted in a message header (such as new
-lines, or non-ascii characters) then the header takes care of encoding the
-text so that it can be used.
+message. It represents text just like you'd think it does. If the text contains
+characters that are not permitted in a message header (such as new lines, or
+non-ascii characters) then the header takes care of encoding the text so that
+it can be used.
No header -- including text headers -- in Swift Mailer is vulnerable to
-header-injection attacks. Swift Mailer breaks any attempt at header injection by
-encoding the dangerous data into a non-dangerous form.
+header-injection attacks. Swift Mailer breaks any attempt at header injection
+by encoding the dangerous data into a non-dangerous form.
It's easy to add a new text header to a HeaderSet. You do this by calling the
-HeaderSet's ``addTextHeader()`` method.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+HeaderSet's ``addTextHeader()`` method::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
$headers->addTextHeader('Your-Header-Name', 'the header value');
Changing the value of an existing text header is done by calling it's
-``setValue()`` method.
-
-.. code-block:: php
+``setValue()`` method::
$subject = $message->getHeaders()->get('Subject');
-
$subject->setValue('new subject');
When output via ``toString()``, a text header produces something like the
-following:
-
-.. code-block:: php
+following::
$subject = $message->getHeaders()->get('Subject');
-
$subject->setValue('amazing subject line');
-
echo $subject->toString();
/*
@@ -198,15 +178,11 @@ following:
*/
If the header contains any characters that are outside of the US-ASCII range
-however, they will be encoded. This is nothing to be concerned about since
-mail clients will decode them back.
-
-.. code-block:: php
+however, they will be encoded. This is nothing to be concerned about since mail
+clients will decode them back::
$subject = $message->getHeaders()->get('Subject');
-
$subject->setValue('contains – dash');
-
echo $subject->toString();
/*
@@ -229,46 +205,37 @@ from text headers are available in addition to the methods described here.
Adding a parameterized header to a HeaderSet is done by using the
``addParameterizedHeader()`` method which takes a text value like
-``addTextHeader()`` but it also accepts an associative array of
-key-value parameters.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+``addTextHeader()`` but it also accepts an associative array of key-value
+parameters::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
$headers->addParameterizedHeader(
'Header-Name', 'header value',
- array('foo' => 'bar')
+ ['foo' => 'bar']
);
To change the text value of the header, call it's ``setValue()`` method just as
you do with text headers.
To change the parameters in the header, call the header's ``setParameters()``
-method or the ``setParameter()`` method (note the pluralization).
-
-.. code-block:: php
+method or the ``setParameter()`` method (note the pluralization)::
$type = $message->getHeaders()->get('Content-Type');
// setParameters() takes an associative array
- $type->setParameters(array(
+ $type->setParameters([
'name' => 'file.txt',
'charset' => 'iso-8859-1'
- ));
+ ]);
// setParameter() takes two args for $key and $value
$type->setParameter('charset', 'iso-8859-1');
When output via ``toString()``, a parameterized header produces something like
-the following:
-
-.. code-block:: php
+the following::
$type = $message->getHeaders()->get('Content-Type');
-
$type->setValue('text/html');
$type->setParameter('charset', 'utf-8');
@@ -284,17 +251,12 @@ If the header contains any characters that are outside of the US-ASCII range
however, they will be encoded, just like they are for text headers. This is
nothing to be concerned about since mail clients will decode them back.
Likewise, if the parameters contain any non-ascii characters they will be
-encoded so that they can be transmitted safely.
-
-.. code-block:: php
-
- $attachment = Swift_Attachment::newInstance();
+encoded so that they can be transmitted safely::
+ $attachment = new Swift_Attachment();
$disp = $attachment->getHeaders()->get('Content-Disposition');
-
$disp->setValue('attachment');
$disp->setParameter('filename', 'report–may.pdf');
-
echo $disp->toString();
/*
@@ -310,41 +272,30 @@ Date headers contains an RFC 2822 formatted date (i.e. what PHP's ``date('r')``
returns). They are used anywhere a date or time is needed to be presented as a
message header.
-The data on which a date header is modeled is simply a UNIX timestamp such as
-that returned by ``time()`` or ``strtotime()``. The timestamp is used to create
-a correctly structured RFC 2822 formatted date such as
-``Tue, 17 Feb 2009 22:26:31 +1100``.
+The data on which a date header is modeled as a DateTimeImmutable object. The
+object is used to create a correctly structured RFC 2822 formatted date with
+timezone such as ``Tue, 17 Feb 2009 22:26:31 +1100``.
The obvious place this header type is used is in the ``Date:`` header of the
message itself.
-It's easy to add a new date header to a HeaderSet. You do this by calling
-the HeaderSet's ``addDateHeader()`` method.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+It's easy to add a new date header to a HeaderSet. You do this by calling the
+HeaderSet's ``addDateHeader()`` method::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
- $headers->addDateHeader('Your-Header-Name', strtotime('3 days ago'));
+ $headers->addDateHeader('Your-Header', new DateTimeImmutable('3 days ago'));
Changing the value of an existing date header is done by calling it's
-``setTimestamp()`` method.
-
-.. code-block:: php
+``setDateTime()`` method::
$date = $message->getHeaders()->get('Date');
-
- $date->setTimestamp(time());
+ $date->setDateTime(new DateTimeImmutable());
When output via ``toString()``, a date header produces something like the
-following:
-
-.. code-block:: php
+following::
$date = $message->getHeaders()->get('Date');
-
echo $date->toString();
/*
@@ -356,9 +307,9 @@ following:
Mailbox (e-mail address) Headers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Mailbox headers contain one or more email addresses, possibly with
-personalized names attached to them. The data on which they are modeled is
-represented by an associative array of email addresses and names.
+Mailbox headers contain one or more email addresses, possibly with personalized
+names attached to them. The data on which they are modeled is represented by an
+associative array of email addresses and names.
Mailbox headers are probably the most complex header type to understand in
Swift Mailer because they accept their input as an array which can take various
@@ -369,48 +320,38 @@ exception of ``Return-Path:`` which has a stricter syntax -- use this header
type. That is, ``To:``, ``From:`` etc.
You add a new mailbox header to a HeaderSet by calling the HeaderSet's
-``addMailboxHeader()`` method.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+``addMailboxHeader()`` method::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
- $headers->addMailboxHeader('Your-Header-Name', array(
- 'person1@example.org' => 'Person Name One',
- 'person2@example.org',
- 'person3@example.org',
- 'person4@example.org' => 'Another named person'
- ));
+ $headers->addMailboxHeader('Your-Header-Name', [
+ 'person1@example.org' => 'Person Name One',
+ 'person2@example.org',
+ 'person3@example.org',
+ 'person4@example.org' => 'Another named person'
+ ]);
Changing the value of an existing mailbox header is done by calling it's
-``setNameAddresses()`` method.
-
-.. code-block:: php
+``setNameAddresses()`` method::
$to = $message->getHeaders()->get('To');
-
- $to->setNameAddresses(array(
+ $to->setNameAddresses([
'joe@example.org' => 'Joe Bloggs',
'john@example.org' => 'John Doe',
'no-name@example.org'
- ));
+ ]);
If you don't wish to concern yourself with the complicated accepted input
formats accepted by ``setNameAddresses()`` as described in the previous chapter
and you only want to set one or more addresses (not names) then you can just
-use the ``setAddresses()`` method instead.
-
-.. code-block:: php
+use the ``setAddresses()`` method instead::
$to = $message->getHeaders()->get('To');
-
- $to->setAddresses(array(
+ $to->setAddresses([
'joe@example.org',
'john@example.org',
'no-name@example.org'
- ));
+ ]);
.. note::
@@ -418,26 +359,20 @@ use the ``setAddresses()`` method instead.
If all you want to do is set a single address in the header, you can use a
string as the input parameter to ``setAddresses()`` and/or
-``setNameAddresses()``.
-
-.. code-block:: php
+``setNameAddresses()``::
$to = $message->getHeaders()->get('To');
-
$to->setAddresses('joe-bloggs@example.org');
When output via ``toString()``, a mailbox header produces something like the
-following:
-
-.. code-block:: php
+following::
$to = $message->getHeaders()->get('To');
-
- $to->setNameAddresses(array(
+ $to->setNameAddresses([
'person1@example.org' => 'Name of Person',
'person2@example.org',
'person3@example.org' => 'Another Person'
- ));
+ ]);
echo $to->toString();
@@ -448,6 +383,19 @@ following:
*/
+Internationalized domains are automatically converted to IDN encoding::
+
+ $to = $message->getHeaders()->get('To');
+ $to->setAddresses('joe@ëxämple.org');
+
+ echo $to->toString();
+
+ /*
+
+ To: joe@xn--xmple-gra1c.org
+
+ */
+
ID Headers
~~~~~~~~~~
@@ -455,41 +403,33 @@ ID headers contain identifiers for the entity (or the message). The most
notable ID header is the Message-ID header on the message itself.
An ID that exists inside an ID header looks more-or-less less like an email
-address. For example, ``<1234955437.499becad62ec2@example.org>``.
-The part to the left of the @ sign is usually unique, based on the current time
-and some random factor. The part on the right is usually a domain name.
+address. For example, ``<1234955437.499becad62ec2@example.org>``. The part to
+the left of the @ sign is usually unique, based on the current time and some
+random factor. The part on the right is usually a domain name.
Any ID passed to the header's ``setId()`` method absolutely MUST conform to
this structure, otherwise you'll get an Exception thrown at you by Swift Mailer
-(a ``Swift_RfcComplianceException``). This is to ensure that the generated
+(a ``Swift_RfcComplianceException``). This is to ensure that the generated
email complies with relevant RFC documents and therefore is less likely to be
blocked as spam.
-It's easy to add a new ID header to a HeaderSet. You do this by calling
-the HeaderSet's ``addIdHeader()`` method.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+It's easy to add a new ID header to a HeaderSet. You do this by calling the
+HeaderSet's ``addIdHeader()`` method::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
$headers->addIdHeader('Your-Header-Name', '123456.unqiue@example.org');
-Changing the value of an existing ID header is done by calling its
-``setId()`` method::
+Changing the value of an existing ID header is done by calling its ``setId()``
+method::
$msgId = $message->getHeaders()->get('Message-ID');
-
$msgId->setId(time() . '.' . uniqid('thing') . '@example.org');
When output via ``toString()``, an ID header produces something like the
-following:
-
-.. code-block:: php
+following::
$msgId = $message->getHeaders()->get('Message-ID');
-
echo $msgId->toString();
/*
@@ -502,38 +442,27 @@ Path Headers
~~~~~~~~~~~~
Path headers are like very-restricted mailbox headers. They contain a single
-email address with no associated name. The Return-Path header of a message is
-a path header.
+email address with no associated name. The Return-Path header of a message is a
+path header.
You add a new path header to a HeaderSet by calling the HeaderSet's
-``addPathHeader()`` method.
-
-.. code-block:: php
-
- $message = Swift_Message::newInstance();
+``addPathHeader()`` method::
+ $message = new Swift_Message();
$headers = $message->getHeaders();
-
$headers->addPathHeader('Your-Header-Name', 'person@example.org');
Changing the value of an existing path header is done by calling its
-``setAddress()`` method.
-
-.. code-block:: php
+``setAddress()`` method::
$return = $message->getHeaders()->get('Return-Path');
-
$return->setAddress('my-address@example.org');
When output via ``toString()``, a path header produces something like the
-following:
-
-.. code-block:: php
+following::
$return = $message->getHeaders()->get('Return-Path');
-
$return->setAddress('person@example.org');
-
echo $return->toString();
/*
@@ -554,19 +483,10 @@ Adding new Headers
New headers can be added to the HeaderSet by using one of the provided
``add..Header()`` methods.
-To add a header to a MIME entity (such as the message):
-
-Get the HeaderSet from the entity by via its ``getHeaders()`` method.
-
-* Add the header to the HeaderSet by calling one of the ``add..Header()``
- methods.
-
-The added header will appear in the message when it is sent.
-
-.. code-block:: php
+The added header will appear in the message when it is sent::
// Adding a custom header to a message
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
$headers = $message->getHeaders();
$headers->addTextHeader('X-Mine', 'something here');
@@ -578,14 +498,21 @@ Retrieving Headers
~~~~~~~~~~~~~~~~~~
Headers are retrieved through the HeaderSet's ``get()`` and ``getAll()``
-methods.
+methods::
+
+ $headers = $message->getHeaders();
+
+ // Get the To: header
+ $toHeader = $headers->get('To');
-To get a header, or several headers from a MIME entity:
+ // Get all headers named "X-Foo"
+ $fooHeaders = $headers->getAll('X-Foo');
-* Get the HeaderSet from the entity by via its ``getHeaders()`` method.
+ // Get the second header named "X-Foo"
+ $foo = $headers->get('X-Foo', 1);
-* Get the header(s) from the HeaderSet by calling either ``get()`` or
- ``getAll()``.
+ // Get all headers that are present
+ $all = $headers->getAll();
When using ``get()`` a single header is returned that matches the name (case
insensitive) that is passed to it. When using ``getAll()`` with a header name,
@@ -606,34 +533,23 @@ arguments returns an array of all headers present in the entity.
sure what type of header it is then you may need to check the type by
calling its ``getFieldType()`` method.
- .. code-block:: php
-
- $headers = $message->getHeaders();
-
- // Get the To: header
- $toHeader = $headers->get('To');
-
- // Get all headers named "X-Foo"
- $fooHeaders = $headers->getAll('X-Foo');
-
- // Get the second header named "X-Foo"
- $foo = $headers->get('X-Foo', 1);
-
- // Get all headers that are present
- $all = $headers->getAll();
-
Check if a Header Exists
~~~~~~~~~~~~~~~~~~~~~~~~
You can check if a named header is present in a HeaderSet by calling its
-``has()`` method.
+``has()`` method::
-To check if a header exists:
+ $headers = $message->getHeaders();
-* Get the HeaderSet from the entity by via its ``getHeaders()`` method.
+ // Check if the To: header exists
+ if ($headers->has('To')) {
+ echo 'To: exists';
+ }
-* Call the HeaderSet's ``has()`` method specifying the header you're looking
- for.
+ // Check if an X-Foo header exists twice (i.e. check for the 2nd one)
+ if ($headers->has('X-Foo', 1)) {
+ echo 'Second X-Foo header exists';
+ }
If the header exists, ``true`` will be returned or ``false`` if not.
@@ -644,32 +560,22 @@ If the header exists, ``true`` will be returned or ``false`` if not.
numerical index, starting from zero to specify which header you want to
check more specifically.
- .. code-block:: php
-
- $headers = $message->getHeaders();
-
- // Check if the To: header exists
- if ($headers->has('To')) {
- echo 'To: exists';
- }
-
- // Check if an X-Foo header exists twice (i.e. check for the 2nd one)
- if ($headers->has('X-Foo', 1)) {
- echo 'Second X-Foo header exists';
- }
-
Removing Headers
~~~~~~~~~~~~~~~~
Removing a Header from the HeaderSet is done by calling the HeaderSet's
-``remove()`` or ``removeAll()`` methods.
+``remove()`` or ``removeAll()`` methods::
-To remove an existing header:
+ $headers = $message->getHeaders();
+
+ // Remove the Subject: header
+ $headers->remove('Subject');
-* Get the HeaderSet from the entity by via its ``getHeaders()`` method.
+ // Remove all X-Foo headers
+ $headers->removeAll('X-Foo');
-* Call the HeaderSet's ``remove()`` or ``removeAll()`` methods specifying the
- header you want to remove.
+ // Remove only the second X-Foo header
+ $headers->remove('X-Foo', 1);
When calling ``remove()`` a single header will be removed. When calling
``removeAll()`` all headers with the given name will be removed. If no headers
@@ -683,40 +589,16 @@ exist with the given name, no errors will occur.
check more specifically. For the same reason, ``removeAll()`` exists to
remove all headers that have the given name.
- .. code-block:: php
-
- $headers = $message->getHeaders();
-
- // Remove the Subject: header
- $headers->remove('Subject');
-
- // Remove all X-Foo headers
- $headers->removeAll('X-Foo');
-
- // Remove only the second X-Foo header
- $headers->remove('X-Foo', 1);
-
Modifying a Header's Content
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To change a Header's content you should know what type of header it is and then
call it's appropriate setter method. All headers also have a
``setFieldBodyModel()`` method that accepts a mixed parameter and delegates to
-the correct setter.
-
-To modify an existing header:
-
-* Get the HeaderSet from the entity by via its ``getHeaders()`` method.
-
-* Get the Header by using the HeaderSet's ``get()``.
-
-* Call the Header's appropriate setter method or call the header's
- ``setFieldBodyModel()`` method.
+the correct setter::
The header will be updated inside the HeaderSet and the changes will be seen
-when the message is sent.
-
-.. code-block:: php
+when the message is sent::
$headers = $message->getHeaders();
@@ -726,14 +608,14 @@ when the message is sent.
// Change the To: header
$to = $headers->get('To');
- $to->setNameAddresses(array(
+ $to->setNameAddresses([
'person@example.org' => 'Person',
'thing@example.org'
- ));
+ ]);
// Using the setFieldBodyModel() just delegates to the correct method
// So here to calls setNameAddresses()
- $to->setFieldBodyModel(array(
+ $to->setFieldBodyModel([
'person@example.org' => 'Person',
'thing@example.org'
- ));
+ ]);
diff --git a/vendor/swiftmailer/swiftmailer/doc/help-resources.rst b/vendor/swiftmailer/swiftmailer/doc/help-resources.rst
deleted file mode 100644
index 420893590a..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/help-resources.rst
+++ /dev/null
@@ -1,44 +0,0 @@
-Getting Help
-============
-
-There are a number of ways you can get help when using Swift Mailer, depending
-upon the nature of your problem. For bug reports and feature requests create a
-new ticket in GitHub. For general advice ask on the Google Group
-(swiftmailer).
-
-Submitting Bugs & Feature Requests
-----------------------------------
-
-Bugs and feature requests should be posted on GitHub.
-
-If you post a bug or request a feature in the forum, or on the Google Group
-you will most likely be asked to create a ticket in `GitHub`_ since it is
-simply not feasible to manage such requests from a number of a different
-sources.
-
-When you go to GitHub you will be asked to create a username and password
-before you can create a ticket. This is free and takes very little time.
-
-When you create your ticket, do not assign it to any milestones. A developer
-will assess your ticket and re-assign it as needed.
-
-If your ticket is reporting a bug present in the current version, which was
-not present in the previous version please include the tag "regression" in
-your ticket.
-
-GitHub will update you when work is performed on your ticket.
-
-Ask on the Google Group
------------------------
-
-You can seek advice at Google Groups, within the "swiftmailer" `group`_.
-
-You can post messages to this group if you want help, or there's something you
-wish to discuss with the developers and with other users.
-
-This is probably the fastest way to get help since it is primarily email-based
-for most users, though bug reports should not be posted here since they may
-not be resolved.
-
-.. _`GitHub`: https://github.com/swiftmailer/swiftmailer/issues
-.. _`group`: http://groups.google.com/group/swiftmailer
diff --git a/vendor/swiftmailer/swiftmailer/doc/including-the-files.rst b/vendor/swiftmailer/swiftmailer/doc/including-the-files.rst
deleted file mode 100644
index 978dca206a..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/including-the-files.rst
+++ /dev/null
@@ -1,46 +0,0 @@
-Including Swift Mailer (Autoloading)
-====================================
-
-If you are using Composer, Swift Mailer will be automatically autoloaded.
-
-If not, you can use the built-in autoloader by requiring the
-``swift_required.php`` file::
-
- require_once '/path/to/swift-mailer/lib/swift_required.php';
-
- /* rest of code goes here */
-
-If you want to override the default Swift Mailer configuration, call the
-``init()`` method on the ``Swift`` class and pass it a valid PHP callable (a
-PHP function name, a PHP 5.3 anonymous function, ...)::
-
- require_once '/path/to/swift-mailer/lib/swift_required.php';
-
- function swiftmailer_configurator() {
- // configure Swift Mailer
-
- Swift_DependencyContainer::getInstance()->...
- Swift_Preferences::getInstance()->...
- }
-
- Swift::init('swiftmailer_configurator');
-
- /* rest of code goes here */
-
-The advantage of using the ``init()`` method is that your code will be
-executed only if you use Swift Mailer in your script.
-
-.. note::
-
- While Swift Mailer's autoloader is designed to play nicely with other
- autoloaders, sometimes you may have a need to avoid using Swift Mailer's
- autoloader and use your own instead. Include the ``swift_init.php``
- instead of the ``swift_required.php`` if you need to do this. The very
- minimum include is the ``swift_init.php`` file since Swift Mailer will not
- work without the dependency injection this file sets up:
-
- .. code-block:: php
-
- require_once '/path/to/swift-mailer/lib/swift_init.php';
-
- /* rest of code goes here */
diff --git a/vendor/swiftmailer/swiftmailer/doc/index.rst b/vendor/swiftmailer/swiftmailer/doc/index.rst
index a1a0a92464..5d928891c4 100644
--- a/vendor/swiftmailer/swiftmailer/doc/index.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/index.rst
@@ -5,10 +5,6 @@ Swiftmailer
:maxdepth: 2
introduction
- overview
- installing
- help-resources
- including-the-files
messages
headers
sending
diff --git a/vendor/swiftmailer/swiftmailer/doc/installing.rst b/vendor/swiftmailer/swiftmailer/doc/installing.rst
deleted file mode 100644
index 557211d48b..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/installing.rst
+++ /dev/null
@@ -1,89 +0,0 @@
-Installing the Library
-======================
-
-Installing with Composer
-------------------------
-
-The recommended way to install Swiftmailer is via Composer:
-
-.. code-block:: bash
-
- $ php composer.phar require swiftmailer/swiftmailer @stable
-
-Installing from Git
--------------------
-
-It's possible to download and install Swift Mailer directly from github.com if
-you want to keep up-to-date with ease.
-
-Swift Mailer's source code is kept in a git repository at github.com so you
-can get the source directly from the repository.
-
-.. note::
-
- You do not need to have git installed to use Swift Mailer from GitHub. If
- you don't have git installed, go to `GitHub`_ and click the "Download"
- button.
-
-Cloning the Repository
-~~~~~~~~~~~~~~~~~~~~~~
-
-The repository can be cloned from git://github.com/swiftmailer/swiftmailer.git
-using the ``git clone`` command.
-
-You will need to have ``git`` installed before you can use the
-``git clone`` command.
-
-To clone the repository:
-
-* Open your favorite terminal environment (command line).
-
-* Move to the directory you want to clone to.
-
-* Run the command ``git clone git://github.com/swiftmailer/swiftmailer.git
- swiftmailer``.
-
-The source code will be downloaded into a directory called "swiftmailer".
-
-The example shows the process on a UNIX-like system such as Linux, BSD or Mac
-OS X.
-
-.. code-block:: bash
-
- $ cd source_code/
- $ git clone git://github.com/swiftmailer/swiftmailer.git swiftmailer
- Initialized empty Git repository in /Users/chris/source_code/swiftmailer/.git/
- remote: Counting objects: 6815, done.
- remote: Compressing objects: 100% (2761/2761), done.
- remote: Total 6815 (delta 3641), reused 6326 (delta 3286)
- Receiving objects: 100% (6815/6815), 4.35 MiB | 162 KiB/s, done.
- Resolving deltas: 100% (3641/3641), done.
- Checking out files: 100% (1847/1847), done.
- $ cd swiftmailer/
- $ ls
- CHANGES LICENSE ...
- $
-
-Troubleshooting
----------------
-
-Swift Mailer does not work when used with function overloading as implemented
-by ``mbstring`` (``mbstring.func_overload`` set to ``2``). A workaround is to
-temporarily change the internal encoding to ``ASCII`` when sending an email:
-
-.. code-block:: php
-
- if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2)
- {
- $mbEncoding = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
-
- // Create your message and send it with Swift Mailer
-
- if (isset($mbEncoding))
- {
- mb_internal_encoding($mbEncoding);
- }
-
-.. _`GitHub`: http://github.com/swiftmailer/swiftmailer
diff --git a/vendor/swiftmailer/swiftmailer/doc/introduction.rst b/vendor/swiftmailer/swiftmailer/doc/introduction.rst
index a85336b7ce..774e9f4663 100644
--- a/vendor/swiftmailer/swiftmailer/doc/introduction.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/introduction.rst
@@ -1,135 +1,61 @@
Introduction
============
-Swift Mailer is a component-based library for sending e-mails from PHP
-applications.
+Swift Mailer is a for sending e-mails from PHP applications.
-Organization of this Book
--------------------------
+System Requirements
+-------------------
-This book has been written so that those who need information quickly are able
-to find what they need, and those who wish to learn more advanced topics can
-read deeper into each chapter.
+Swift Mailer requires PHP 7.0 or higher (``proc_*`` functions must be
+available).
-The book begins with an overview of Swift Mailer, discussing what's included
-in the package and preparing you for the remainder of the book.
+Swift Mailer does not work when used with function overloading as implemented
+by ``mbstring`` when ``mbstring.func_overload`` is set to ``2``.
-It is possible to read this user guide just like any other book (from
-beginning to end). Each chapter begins with a discussion of the contents it
-contains, followed by a short code sample designed to give you a head start.
-As you get further into a chapter you will learn more about Swift Mailer's
-capabilities, but often you will be able to head directly to the topic you
-wish to learn about.
-
-Throughout this book you will be presented with code samples, which most
-people should find ample to implement Swift Mailer appropriately in their own
-projects. We will also use diagrams where appropriate, and where we believe
-readers may find it helpful we will discuss some related theory, including
-reference to certain documents you are able to find online.
-
-Code Samples
+Installation
------------
-Code samples presented in this book will be displayed on a different colored
-background in a monospaced font. Samples are not to be taken as copy & paste
-code snippets.
-
-Code examples are used through the book to clarify what is written in text.
-They will sometimes be usable as-is, but they should always be taken as
-outline/pseudo code only.
-
-A code sample will look like this::
-
- class AClass
- {
- ...
- }
-
- // A Comment
- $obj = new AClass($arg1, $arg2, ... );
-
- /* A note about another way of doing something
- $obj = AClass::newInstance($arg1, $arg2, ... );
-
- */
+The recommended way to install Swiftmailer is via Composer:
-The presence of 3 dots ``...`` in a code sample indicates that we have left
-out a chunk of the code for brevity, they are not actually part of the code.
+.. code-block:: bash
-We will often place multi-line comments ``/* ... */`` in the code so that we
-can show alternative ways of achieving the same result.
+ $ composer require "swiftmailer/swiftmailer:^6.0"
-You should read the code examples given and try to understand them. They are
-kept concise so that you are not overwhelmed with information.
+Basic Usage
+-----------
-History of Swift Mailer
------------------------
+Here is the simplest way to send emails with Swift Mailer::
-Swift Mailer began back in 2005 as a one-class project for sending mail over
-SMTP. It has since grown into the flexible component-based library that is in
-development today.
+ require_once '/path/to/vendor/autoload.php';
-Chris Corbyn first posted Swift Mailer on a web forum asking for comments from
-other developers. It was never intended as a fully supported open source
-project, but members of the forum began to adopt it and make use of it.
+ // Create the Transport
+ $transport = (new Swift_SmtpTransport('smtp.example.org', 25))
+ ->setUsername('your username')
+ ->setPassword('your password')
+ ;
-Very quickly feature requests were coming for the ability to add attachments
-and use SMTP authentication, along with a number of other "obvious" missing
-features. Considering the only alternative was PHPMailer it seemed like a good
-time to bring some fresh tools to the table. Chris began working towards a
-more component based, PHP5-like approach unlike the existing single-class,
-legacy PHP4 approach taken by PHPMailer.
+ // Create the Mailer using your created Transport
+ $mailer = new Swift_Mailer($transport);
-Members of the forum offered a lot of advice and critique on the code as he
-worked through this project and released versions 2 and 3 of the library in
-2005 and 2006, which by then had been broken down into smaller classes
-offering more flexibility and supporting plugins. To this day the Swift Mailer
-team still receive a lot of feature requests from users both on the forum and
-in by email.
+ // Create a message
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
+ ->setBody('Here is the message itself')
+ ;
-Until 2008 Chris was the sole developer of Swift Mailer, but entering 2009 he
-gained the support of two experienced developers well-known to him: Paul
-Annesley and Christopher Thompson. This has been an extremely welcome change.
+ // Send the message
+ $result = $mailer->send($message);
-As of September 2009, Chris handed over the maintenance of Swift Mailer to
-Fabien Potencier.
+You can also use Sendmail as a transport::
-Now 2009 and in its fourth major version Swift Mailer is more object-oriented
-and flexible than ever, both from a usability standpoint and from a
-development standpoint.
+ // Sendmail
+ $transport = new Swift_SendmailTransport('/usr/sbin/sendmail -bs');
-By no means is Swift Mailer ready to call "finished". There are still many
-features that can be added to the library along with the constant refactoring
-that happens behind the scenes.
-
-It's a Library!
----------------
-
-Swift Mailer is not an application - it's a library.
-
-To most experienced developers this is probably an obvious point to make, but
-it's certainly worth mentioning. Many people often contact us having gotten
-the completely wrong end of the stick in terms of what Swift Mailer is
-actually for.
-
-It's not an application. It does not have a graphical user interface. It
-cannot be opened in your web browser directly.
-
-It's a library (or a framework if you like). It provides a whole lot of
-classes that do some very complicated things, so that you don't have to. You
-"use" Swift Mailer within an application so that your application can have the
-ability to send emails.
-
-The component-based structure of the library means that you are free to
-implement it in a number of different ways and that you can pick and choose
-what you want to use.
+Getting Help
+------------
-An application on the other hand (such as a blog or a forum) is already "put
-together" in a particular way, (usually) provides a graphical user interface
-and most likely doesn't offer a great deal of integration with your own
-application.
+For general support, use `Stack Overflow <https://stackoverflow.com>`_.
-Embrace the structure of the library and use the components it offers to your
-advantage. Learning what the components do, rather than blindly copying and
-pasting existing code will put you in a great position to build a powerful
-application!
+For bug reports and feature requests, create a new ticket in `GitHub
+<https://github.com/swiftmailer/swiftmailer/issues>`_.
diff --git a/vendor/swiftmailer/swiftmailer/doc/japanese.rst b/vendor/swiftmailer/swiftmailer/doc/japanese.rst
index 34afa7b8fb..5454821799 100644
--- a/vendor/swiftmailer/swiftmailer/doc/japanese.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/japanese.rst
@@ -3,11 +3,8 @@ Using Swift Mailer for Japanese Emails
To send emails in Japanese, you need to tweak the default configuration.
-After requiring the Swift Mailer autoloader (by including the
-``swift_required.php`` file), call the ``Swift::init()`` method with the
-following code::
-
- require_once '/path/to/swift-mailer/lib/swift_required.php';
+Call the ``Swift::init()`` method with the following code as early as possible
+in your code::
Swift::init(function () {
Swift_DependencyContainer::getInstance()
diff --git a/vendor/swiftmailer/swiftmailer/doc/messages.rst b/vendor/swiftmailer/swiftmailer/doc/messages.rst
index b058b776e0..fac402c6eb 100644
--- a/vendor/swiftmailer/swiftmailer/doc/messages.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/messages.rst
@@ -2,45 +2,27 @@ Creating Messages
=================
Creating messages in Swift Mailer is done by making use of the various MIME
-entities provided with the library. Complex messages can be quickly created
+entities provided with the library. Complex messages can be quickly created
with very little effort.
-Quick Reference for Creating a Message
----------------------------------------
+Quick Reference
+---------------
You can think of creating a Message as being similar to the steps you perform
-when you click the Compose button in your mail client. You give it a subject,
-specify some recipients, add any attachments and write your message.
-
-To create a Message:
-
-* Call the ``newInstance()`` method of ``Swift_Message``.
-
-* Set your sender address (``From:``) with ``setFrom()`` or ``setSender()``.
-
-* Set a subject line with ``setSubject()``.
-
-* Set recipients with ``setTo()``, ``setCc()`` and/or ``setBcc()``.
-
-* Set a body with ``setBody()``.
-
-* Add attachments with ``attach()``.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+when you click the Compose button in your mail client. You give it a subject,
+specify some recipients, add any attachments and write your message::
// Create the message
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
// Give the message a subject
->setSubject('Your subject')
// Set the From address with an associative array
- ->setFrom(array('john@doe.com' => 'John Doe'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
- // Set the To addresses with an associative array
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ // Set the To addresses with an associative array (setTo/setCc/setBcc)
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
// Give it a body
->setBody('Here is the message itself')
@@ -82,19 +64,18 @@ Encoders and different Header types to generate the entity.
The Structure of a Message
~~~~~~~~~~~~~~~~~~~~~~~~~~
-Of all of the MIME entities, a message -- ``Swift_Message``
-is the largest and most complex. It has many properties that can be updated
-and it can contain other MIME entities -- attachments for example --
-nested inside it.
+Of all of the MIME entities, a message -- ``Swift_Message`` is the largest and
+most complex. It has many properties that can be updated and it can contain
+other MIME entities -- attachments for example -- nested inside it.
-A Message has a lot of different Headers which are there to present
-information about the message to the recipients' mail client. Most of these
-headers will be familiar to the majority of users, but we'll list the basic
-ones. Although it's possible to work directly with the Headers of a Message
-(or other MIME entity), the standard Headers have accessor methods provided to
-abstract away the complex details for you. For example, although the Date on a
-message is written with a strict format, you only need to pass a UNIX
-timestamp to ``setDate()``.
+A Message has a lot of different Headers which are there to present information
+about the message to the recipients' mail client. Most of these headers will be
+familiar to the majority of users, but we'll list the basic ones. Although it's
+possible to work directly with the Headers of a Message (or other MIME entity),
+the standard Headers have accessor methods provided to abstract away the
+complex details for you. For example, although the Date on a message is written
+with a strict format, you only need to pass a DateTimeInterface instance to
+``setDate()``.
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
| Header | Description | Accessors |
@@ -129,28 +110,17 @@ Working with a Message Object
Although there are a lot of available methods on a message object, you only
need to make use of a small subset of them. Usually you'll use
-``setSubject()``, ``setTo()`` and
-``setFrom()`` before setting the body of your message with
-``setBody()``.
+``setSubject()``, ``setTo()`` and ``setFrom()`` before setting the body of your
+message with ``setBody()``::
-Calling methods is simple. You just call them like functions, but using the
-object operator "``->``" to do so. If you've created
-a message object and called it ``$message`` then you'd set a
-subject on it like so:
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
-
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
$message->setSubject('My subject');
-All MIME entities (including a message) have a ``toString()``
-method that you can call if you want to take a look at what is going to be
-sent. For example, if you ``echo
-$message->toString();`` you would see something like this:
+All MIME entities (including a message) have a ``toString()`` method that you
+can call if you want to take a look at what is going to be sent. For example,
+if you ``echo $message->toString();`` you would see something like this:
-.. code-block:: bash
+.. code-block:: text
Message-ID: <1230173678.4952f5eeb1432@swift.generated>
Date: Thu, 25 Dec 2008 13:54:38 +1100
@@ -177,17 +147,10 @@ Setting the Subject Line
~~~~~~~~~~~~~~~~~~~~~~~~
The subject line, displayed in the recipients' mail client can be set with the
-``setSubject()`` method, or as a parameter to ``Swift_Message::newInstance()``.
-
-To set the subject of your Message:
-
-* Call the ``setSubject()`` method of the Message, or specify it at the time
- you create the message.
-
- .. code-block:: php
+``setSubject()`` method, or as a parameter to ``new Swift_Message()``::
// Pass it as a parameter when you create the message
- $message = Swift_Message::newInstance('My amazing subject');
+ $message = new Swift_Message('My amazing subject');
// Or set it after like this
$message->setSubject('My amazing subject');
@@ -195,36 +158,26 @@ To set the subject of your Message:
Setting the Body Content
~~~~~~~~~~~~~~~~~~~~~~~~
-The body of the message -- seen when the user opens the message --
-is specified by calling the ``setBody()`` method. If an alternative body is to
-be included ``addPart()`` can be used.
+The body of the message -- seen when the user opens the message -- is specified
+by calling the ``setBody()`` method. If an alternative body is to be included,
+``addPart()`` can be used.
The body of a message is the main part that is read by the user. Often people
-want to send a message in HTML format (``text/html``), other
-times people want to send in plain text (``text/plain``), or
-sometimes people want to send both versions and allow the recipient to choose
-how they view the message.
+want to send a message in HTML format (``text/html``), other times people want
+to send in plain text (``text/plain``), or sometimes people want to send both
+versions and allow the recipient to choose how they view the message.
As a rule of thumb, if you're going to send a HTML email, always include a
plain-text equivalent of the same content so that users who prefer to read
plain text can do so.
-To set the body of your Message:
-
-* Call the ``setBody()`` method of the Message, or specify it at the time you
- create the message.
-
-* Add any alternative bodies with ``addPart()``.
-
If the recipient's mail client offers preferences for displaying text vs. HTML
-then the mail client will present that part to the user where available. In
+then the mail client will present that part to the user where available. In
other cases the mail client will display the "best" part it can - usually HTML
-if you've included HTML.
-
-.. code-block:: php
+if you've included HTML::
// Pass it as a parameter when you create the message
- $message = Swift_Message::newInstance('Subject here', 'My amazing body');
+ $message = new Swift_Message('Subject here', 'My amazing body');
// Or set it after like this
$message->setBody('My <em>amazing</em> body', 'text/html');
@@ -235,25 +188,20 @@ if you've included HTML.
Attaching Files
---------------
-Attachments are downloadable parts of a message and can be added by calling
-the ``attach()`` method on the message. You can add attachments that exist on
-disk, or you can create attachments on-the-fly.
-
-Attachments are actually an interesting area of Swift Mailer and something
-that could put a lot of power at your fingertips if you grasp the concept
-behind the way a message is held together.
+Attachments are downloadable parts of a message and can be added by calling the
+``attach()`` method on the message. You can add attachments that exist on disk,
+or you can create attachments on-the-fly.
Although we refer to files sent over e-mails as "attachments" -- because
they're attached to the message -- lots of other parts of the message are
actually "attached" even if we don't refer to these parts as attachments.
-File attachments are created by the ``Swift_Attachment`` class
-and then attached to the message via the ``attach()`` method on
-it. For all of the "every day" MIME types such as all image formats, word
-documents, PDFs and spreadsheets you don't need to explicitly set the
-content-type of the attachment, though it would do no harm to do so. For less
-common formats you should set the content-type -- which we'll cover in a
-moment.
+File attachments are created by the ``Swift_Attachment`` class and then
+attached to the message via the ``attach()`` method on it. For all of the
+"every day" MIME types such as all image formats, word documents, PDFs and
+spreadsheets you don't need to explicitly set the content-type of the
+attachment, though it would do no harm to do so. For less common formats you
+should set the content-type -- which we'll cover in a moment.
Attaching Existing Files
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -265,16 +213,8 @@ You can attach files that exist locally, or if your PHP installation has
``allow_url_fopen`` turned on you can attach files from other
websites.
-To attach an existing file:
-
-* Create an attachment with ``Swift_Attachment::fromPath()``.
-
-* Add the attachment to the message with ``attach()``.
-
The attachment will be presented to the recipient as a downloadable file with
-the same filename as the one you attached.
-
-.. code-block:: php
+the same filename as the one you attached::
// Create the attachment
// * Note that you can technically leave the content-type parameter out
@@ -296,14 +236,8 @@ Usually you don't need to explicitly set the filename of an attachment because
the name of the attached file will be used by default, but if you want to set
the filename you use the ``setFilename()`` method of the Attachment.
-To change the filename of an attachment:
-
-* Call its ``setFilename()`` method.
-
The attachment will be attached in the normal way, but meta-data sent inside
-the email will rename the file to something else.
-
-.. code-block:: php
+the email will rename the file to something else::
// Create the attachment and call its setFilename() method
$attachment = Swift_Attachment::fromPath('/path/to/image.jpg')
@@ -319,43 +253,32 @@ Attaching Dynamic Content
Files that are generated at runtime, such as PDF documents or images created
via GD can be attached directly to a message without writing them out to disk.
-Use the standard ``Swift_Attachment::newInstance()`` method.
-
-To attach dynamically created content:
-
-* Create your content as you normally would.
-
-* Create an attachment with ``Swift_Attachment::newInstance()``, specifying
- the source data of your content along with a name and the content-type.
-
-* Add the attachment to the message with ``attach()``.
+Use ``Swift_Attachment`` directly.
The attachment will be presented to the recipient as a downloadable file
-with the filename and content-type you specify.
+with the filename and content-type you specify::
-.. note::
+ // Create your file contents in the normal way, but don't write them to disk
+ $data = create_my_pdf_data();
- If you would usually write the file to disk anyway you should just attach
- it with ``Swift_Attachment::fromPath()`` since this will use less memory:
-
- .. code-block:: php
+ // Create the attachment with your data
+ $attachment = new Swift_Attachment($data, 'my-file.pdf', 'application/pdf');
- // Create your file contents in the normal way, but don't write them to disk
- $data = create_my_pdf_data();
+ // Attach it to the message
+ $message->attach($attachment);
- // Create the attachment with your data
- $attachment = Swift_Attachment::newInstance($data, 'my-file.pdf', 'application/pdf');
- // Attach it to the message
- $message->attach($attachment);
+ // You can alternatively use method chaining to build the attachment
+ $attachment = (new Swift_Attachment())
+ ->setFilename('my-file.pdf')
+ ->setContentType('application/pdf')
+ ->setBody($data)
+ ;
+.. note::
- // You can alternatively use method chaining to build the attachment
- $attachment = Swift_Attachment::newInstance()
- ->setFilename('my-file.pdf')
- ->setContentType('application/pdf')
- ->setBody($data)
- ;
+ If you would usually write the file to disk anyway you should just attach
+ it with ``Swift_Attachment::fromPath()`` since this will use less memory.
Changing the Disposition
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -364,35 +287,29 @@ Attachments just appear as files that can be saved to the Desktop if desired.
You can make attachment appear inline where possible by using the
``setDisposition()`` method of an attachment.
-To make an attachment appear inline:
+The attachment will be displayed within the email viewing window if the mail
+client knows how to display it::
+
+ // Create the attachment and call its setDisposition() method
+ $attachment = Swift_Attachment::fromPath('/path/to/image.jpg')
+ ->setDisposition('inline');
-* Call its ``setDisposition()`` method.
-The attachment will be displayed within the email viewing window if the mail
-client knows how to display it.
+ // Because there's a fluid interface, you can do this in one statement
+ $message->attach(
+ Swift_Attachment::fromPath('/path/to/image.jpg')->setDisposition('inline')
+ );
.. note::
If you try to create an inline attachment for a non-displayable file type
such as a ZIP file, the mail client should just present the attachment as
- normal:
-
- .. code-block:: php
-
- // Create the attachment and call its setDisposition() method
- $attachment = Swift_Attachment::fromPath('/path/to/image.jpg')
- ->setDisposition('inline');
-
-
- // Because there's a fluid interface, you can do this in one statement
- $message->attach(
- Swift_Attachment::fromPath('/path/to/image.jpg')->setDisposition('inline')
- );
+ normal.
Embedding Inline Media Files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Often people want to include an image or other content inline with a HTML
+Often, people want to include an image or other content inline with a HTML
message. It's easy to do this with HTML linking to remote resources, but this
approach is usually blocked by mail clients. Swift Mailer allows you to embed
your media directly into the message.
@@ -427,58 +344,47 @@ message with just one line of code, using ``Swift_EmbeddedFile::fromPath()``.
You can embed files that exist locally, or if your PHP installation has
``allow_url_fopen`` turned on you can embed files from other websites.
-To embed an existing file:
+The file will be displayed with the message inline with the HTML wherever its ID
+is used as a ``src`` attribute::
-* Create a message object with ``Swift_Message::newInstance()``.
+ // Create the message
+ $message = new Swift_Message('My subject');
-* Set the body as HTML, and embed a file at the correct point in the message with ``embed()``.
+ // Set the body
+ $message->setBody(
+ '<html>' .
+ ' <body>' .
+ ' Here is an image <img src="' . // Embed the file
+ $message->embed(Swift_Image::fromPath('image.png')) .
+ '" alt="Image" />' .
+ ' Rest of message' .
+ ' </body>' .
+ '</html>',
+ 'text/html' // Mark the content-type as HTML
+ );
-The file will be displayed with the message inline with the HTML wherever its ID
-is used as a ``src`` attribute.
+ // You can embed files from a URL if allow_url_fopen is on in php.ini
+ $message->setBody(
+ '<html>' .
+ ' <body>' .
+ ' Here is an image <img src="' .
+ $message->embed(Swift_Image::fromPath('http://site.tld/logo.png')) .
+ '" alt="Image" />' .
+ ' Rest of message' .
+ ' </body>' .
+ '</html>',
+ 'text/html'
+ );
.. note::
- ``Swift_Image`` and ``Swift_EmbeddedFile`` are just aliases of one
- another. ``Swift_Image`` exists for semantic purposes.
+ ``Swift_Image`` and ``Swift_EmbeddedFile`` are just aliases of one another.
+ ``Swift_Image`` exists for semantic purposes.
.. note::
You can embed files in two stages if you prefer. Just capture the return
- value of ``embed()`` in a variable and use that as the ``src`` attribute.
-
- .. code-block:: php
-
- // Create the message
- $message = Swift_Message::newInstance('My subject');
-
- // Set the body
- $message->setBody(
- '<html>' .
- ' <head></head>' .
- ' <body>' .
- ' Here is an image <img src="' . // Embed the file
- $message->embed(Swift_Image::fromPath('image.png')) .
- '" alt="Image" />' .
- ' Rest of message' .
- ' </body>' .
- '</html>',
- 'text/html' // Mark the content-type as HTML
- );
-
- // You can embed files from a URL if allow_url_fopen is on in php.ini
- $message->setBody(
- '<html>' .
- ' <head></head>' .
- ' <body>' .
- ' Here is an image <img src="' .
- $message->embed(Swift_Image::fromPath('http://site.tld/logo.png')) .
- '" alt="Image" />' .
- ' Rest of message' .
- ' </body>' .
- '</html>',
- 'text/html'
- );
-
+ value of ``embed()`` in a variable and use that as the ``src`` attribute::
// If placing the embed() code inline becomes cumbersome
// it's easy to do this in two steps
@@ -486,7 +392,6 @@ is used as a ``src`` attribute.
$message->setBody(
'<html>' .
- ' <head></head>' .
' <body>' .
' Here is an image <img src="' . $cid . '" alt="Image" />' .
' Rest of message' .
@@ -500,58 +405,46 @@ Embedding Dynamic Content
Images that are generated at runtime, such as images created via GD can be
embedded directly to a message without writing them out to disk. Use the
-standard ``Swift_Image::newInstance()`` method.
+standard ``new Swift_Image()`` method.
-To embed dynamically created content:
+The file will be displayed with the message inline with the HTML wherever its ID
+is used as a ``src`` attribute::
-* Create a message object with ``Swift_Message::newInstance()``.
+ // Create your file contents in the normal way, but don't write them to disk
+ $img_data = create_my_image_data();
-* Set the body as HTML, and embed a file at the correct point in the message
- with ``embed()``. You will need to specify a filename and a content-type.
+ // Create the message
+ $message = new Swift_Message('My subject');
-The file will be displayed with the message inline with the HTML wherever its ID
-is used as a ``src`` attribute.
+ // Set the body
+ $message->setBody(
+ '<html>' .
+ ' <body>' .
+ ' Here is an image <img src="' . // Embed the file
+ $message->embed(new Swift_Image($img_data, 'image.jpg', 'image/jpeg')) .
+ '" alt="Image" />' .
+ ' Rest of message' .
+ ' </body>' .
+ '</html>',
+ 'text/html' // Mark the content-type as HTML
+ );
.. note::
- ``Swift_Image`` and ``Swift_EmbeddedFile`` are just aliases of one
- another. ``Swift_Image`` exists for semantic purposes.
+ ``Swift_Image`` and ``Swift_EmbeddedFile`` are just aliases of one another.
+ ``Swift_Image`` exists for semantic purposes.
.. note::
You can embed files in two stages if you prefer. Just capture the return
- value of ``embed()`` in a variable and use that as the ``src`` attribute.
-
- .. code-block:: php
-
- // Create your file contents in the normal way, but don't write them to disk
- $img_data = create_my_image_data();
-
- // Create the message
- $message = Swift_Message::newInstance('My subject');
-
- // Set the body
- $message->setBody(
- '<html>' .
- ' <head></head>' .
- ' <body>' .
- ' Here is an image <img src="' . // Embed the file
- $message->embed(Swift_Image::newInstance($img_data, 'image.jpg', 'image/jpeg')) .
- '" alt="Image" />' .
- ' Rest of message' .
- ' </body>' .
- '</html>',
- 'text/html' // Mark the content-type as HTML
- );
-
+ value of ``embed()`` in a variable and use that as the ``src`` attribute::
// If placing the embed() code inline becomes cumbersome
// it's easy to do this in two steps
- $cid = $message->embed(Swift_Image::newInstance($img_data, 'image.jpg', 'image/jpeg'));
+ $cid = $message->embed(new Swift_Image($img_data, 'image.jpg', 'image/jpeg'));
$message->setBody(
'<html>' .
- ' <head></head>' .
' <body>' .
' Here is an image <img src="' . $cid . '" alt="Image" />' .
' Rest of message' .
@@ -575,9 +468,9 @@ Message recipients are one of three types:
* ``Bcc:`` recipients -- hidden from other recipients (optional)
-Each type can contain one, or several addresses. It's possible to list only
-the addresses of the recipients, or you can personalize the address by
-providing the real name of the recipient.
+Each type can contain one, or several addresses. It's possible to list only the
+addresses of the recipients, or you can personalize the address by providing
+the real name of the recipient.
Make sure to add only valid email addresses as recipients. If you try to add an
invalid email address with ``setTo()``, ``setCc()`` or ``setBcc()``, Swift
@@ -585,79 +478,74 @@ Mailer will throw a ``Swift_RfcComplianceException``.
If you add recipients automatically based on a data source that may contain
invalid email addresses, you can prevent possible exceptions by validating the
-addresses using ``Swift_Validate::email($email)`` and only adding addresses
-that validate. Another way would be to wrap your ``setTo()``, ``setCc()`` and
+addresses using::
+ use Egulias\EmailValidator\EmailValidator;
+ use Egulias\EmailValidator\Validation\RFCValidation;
+
+ $validator = new EmailValidator();
+ $validator->isValid("example@example.com", new RFCValidation()); //true
+and only adding addresses that validate. Another way would be to wrap your ``setTo()``, ``setCc()`` and
``setBcc()`` calls in a try-catch block and handle the
``Swift_RfcComplianceException`` in the catch block.
.. sidebar:: Syntax for Addresses
If you only wish to refer to a single email address (for example your
- ``From:`` address) then you can just use a string.
-
- .. code-block:: php
+ ``From:`` address) then you can just use a string::
$message->setFrom('some@address.tld');
- If you want to include a name then you must use an associative array.
-
- .. code-block:: php
+ If you want to include a name then you must use an associative array::
- $message->setFrom(array('some@address.tld' => 'The Name'));
+ $message->setFrom(['some@address.tld' => 'The Name']);
- If you want to include multiple addresses then you must use an array.
+ If you want to include multiple addresses then you must use an array::
- .. code-block:: php
-
- $message->setTo(array('some@address.tld', 'other@address.tld'));
+ $message->setTo(['some@address.tld', 'other@address.tld']);
You can mix personalized (addresses with a name) and non-personalized
addresses in the same list by mixing the use of associative and
- non-associative array syntax.
-
- .. code-block:: php
+ non-associative array syntax::
- $message->setTo(array(
+ $message->setTo([
'recipient-with-name@example.org' => 'Recipient Name One',
'no-name@example.org', // Note that this is not a key-value pair
'named-recipient@example.org' => 'Recipient Name Two'
- ));
+ ]);
Setting ``To:`` Recipients
~~~~~~~~~~~~~~~~~~~~~~~~~~
-``To:`` recipients are required in a message and are set with the
-``setTo()`` or ``addTo()`` methods of the message.
+``To:`` recipients are required in a message and are set with the ``setTo()``
+or ``addTo()`` methods of the message.
-To set ``To:`` recipients, create the message object using either
-``new Swift_Message( ... )`` or ``Swift_Message::newInstance( ... )``,
-then call the ``setTo()`` method with a complete array of addresses, or use the
-``addTo()`` method to iteratively add recipients.
+To set ``To:`` recipients, create the message object using either ``new
+Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
+``setTo()`` method with a complete array of addresses, or use the ``addTo()``
+method to iteratively add recipients.
The ``setTo()`` method accepts input in various formats as described earlier in
this chapter. The ``addTo()`` method takes either one or two parameters. The
first being the email address and the second optional parameter being the name
of the recipient.
-``To:`` recipients are visible in the message headers and will be
-seen by the other recipients.
+``To:`` recipients are visible in the message headers and will be seen by the
+other recipients::
+
+ // Using setTo() to set all recipients in one go
+ $message->setTo([
+ 'person1@example.org',
+ 'person2@otherdomain.org' => 'Person 2 Name',
+ 'person3@example.org',
+ 'person4@example.org',
+ 'person5@example.org' => 'Person 5 Name'
+ ]);
.. note::
Multiple calls to ``setTo()`` will not add new recipients -- each
call overrides the previous calls. If you want to iteratively add
- recipients, use the ``addTo()`` method.
-
- .. code-block:: php
-
- // Using setTo() to set all recipients in one go
- $message->setTo(array(
- 'person1@example.org',
- 'person2@otherdomain.org' => 'Person 2 Name',
- 'person3@example.org',
- 'person4@example.org',
- 'person5@example.org' => 'Person 5 Name'
- ));
+ recipients, use the ``addTo()`` method::
// Using addTo() to add recipients iteratively
$message->addTo('person1@example.org');
@@ -669,35 +557,33 @@ Setting ``Cc:`` Recipients
``Cc:`` recipients are set with the ``setCc()`` or ``addCc()`` methods of the
message.
-To set ``Cc:`` recipients, create the message object using either
-``new Swift_Message( ... )`` or ``Swift_Message::newInstance( ... )``, then call
-the ``setCc()`` method with a complete array of addresses, or use the
-``addCc()`` method to iteratively add recipients.
+To set ``Cc:`` recipients, create the message object using either ``new
+Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
+``setCc()`` method with a complete array of addresses, or use the ``addCc()``
+method to iteratively add recipients.
The ``setCc()`` method accepts input in various formats as described earlier in
this chapter. The ``addCc()`` method takes either one or two parameters. The
first being the email address and the second optional parameter being the name
of the recipient.
-``Cc:`` recipients are visible in the message headers and will be
-seen by the other recipients.
-
-.. note::
+``Cc:`` recipients are visible in the message headers and will be seen by the
+other recipients::
- Multiple calls to ``setCc()`` will not add new recipients -- each
- call overrides the previous calls. If you want to iteratively add Cc:
- recipients, use the ``addCc()`` method.
+ // Using setTo() to set all recipients in one go
+ $message->setTo([
+ 'person1@example.org',
+ 'person2@otherdomain.org' => 'Person 2 Name',
+ 'person3@example.org',
+ 'person4@example.org',
+ 'person5@example.org' => 'Person 5 Name'
+ ]);
- .. code-block:: php
+.. note::
- // Using setCc() to set all recipients in one go
- $message->setCc(array(
- 'person1@example.org',
- 'person2@otherdomain.org' => 'Person 2 Name',
- 'person3@example.org',
- 'person4@example.org',
- 'person5@example.org' => 'Person 5 Name'
- ));
+ Multiple calls to ``setCc()`` will not add new recipients -- each call
+ overrides the previous calls. If you want to iteratively add Cc:
+ recipients, use the ``addCc()`` method::
// Using addCc() to add recipients iteratively
$message->addCc('person1@example.org');
@@ -710,45 +596,63 @@ Setting ``Bcc:`` Recipients
it, and are set with the ``setBcc()`` or ``addBcc()`` methods of the message.
To set ``Bcc:`` recipients, create the message object using either ``new
-Swift_Message( ... )`` or ``Swift_Message::newInstance( ... )``, then call the
-``setBcc()`` method with a complete array of addresses, or use
-the ``addBcc()`` method to iteratively add recipients.
+Swift_Message( ... )`` or ``new Swift_Message( ... )``, then call the
+``setBcc()`` method with a complete array of addresses, or use the ``addBcc()``
+method to iteratively add recipients.
-The ``setBcc()`` method accepts input in various formats as described earlier in
-this chapter. The ``addBcc()`` method takes either one or two parameters. The
-first being the email address and the second optional parameter being the name
-of the recipient.
+The ``setBcc()`` method accepts input in various formats as described earlier
+in this chapter. The ``addBcc()`` method takes either one or two parameters.
+The first being the email address and the second optional parameter being the
+name of the recipient.
Only the individual ``Bcc:`` recipient will see their address in the message
-headers. Other recipients (including other ``Bcc:`` recipients) will not see the
-address.
-
-.. note::
+headers. Other recipients (including other ``Bcc:`` recipients) will not see
+the address::
- Multiple calls to ``setBcc()`` will not add new recipients -- each
- call overrides the previous calls. If you want to iteratively add Bcc:
- recipients, use the ``addBcc()`` method.
+ // Using setBcc() to set all recipients in one go
+ $message->setBcc([
+ 'person1@example.org',
+ 'person2@otherdomain.org' => 'Person 2 Name',
+ 'person3@example.org',
+ 'person4@example.org',
+ 'person5@example.org' => 'Person 5 Name'
+ ]);
- .. code-block:: php
+.. note::
- // Using setBcc() to set all recipients in one go
- $message->setBcc(array(
- 'person1@example.org',
- 'person2@otherdomain.org' => 'Person 2 Name',
- 'person3@example.org',
- 'person4@example.org',
- 'person5@example.org' => 'Person 5 Name'
- ));
+ Multiple calls to ``setBcc()`` will not add new recipients -- each call
+ overrides the previous calls. If you want to iteratively add Bcc:
+ recipients, use the ``addBcc()`` method::
// Using addBcc() to add recipients iteratively
$message->addBcc('person1@example.org');
$message->addBcc('person2@example.org', 'Person 2 Name');
+.. sidebar:: Internationalized Email Addresses
+
+ Traditionally only ASCII characters have been allowed in email addresses.
+ With the introduction of internationalized domain names (IDNs), non-ASCII
+ characters may appear in the domain name. By default, Swiftmailer encodes
+ such domain names in Punycode (e.g. xn--xample-ova.invalid). This is
+ compatible with all mail servers.
+
+ RFC 6531 introduced an SMTP extension, SMTPUTF8, that allows non-ASCII
+ characters in email addresses on both sides of the @ sign. To send to such
+ addresses, your outbound SMTP server must support the SMTPUTF8 extension.
+ You should use the ``Swift_AddressEncoder_Utf8AddressEncoder`` address
+ encoder and enable the ``Swift_Transport_Esmtp_SmtpUtf8Handler`` SMTP
+ extension handler::
+
+ $smtpUtf8 = new Swift_Transport_Esmtp_SmtpUtf8Handler();
+ $transport->setExtensionHandlers([$smtpUtf8]);
+ $utf8Encoder = new Swift_AddressEncoder_Utf8AddressEncoder();
+ $transport->setAddressEncoder($utf8Encoder);
+
Specifying Sender Details
-------------------------
-An email must include information about who sent it. Usually this is managed
-by the ``From:`` address, however there are other options.
+An email must include information about who sent it. Usually this is managed by
+the ``From:`` address, however there are other options.
The sender information is contained in three possible places:
@@ -772,37 +676,34 @@ Setting the ``From:`` Address
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A ``From:`` address is required and is set with the ``setFrom()`` method of the
-message. ``From:`` addresses specify who actually wrote the email, and usually who sent it.
+message. ``From:`` addresses specify who actually wrote the email, and usually
+who sent it.
-What most people probably don't realise is that you can have more than one
+What most people probably don't realize is that you can have more than one
``From:`` address if more than one person wrote the email -- for example if an
email was put together by a committee.
-To set the ``From:`` address(es):
-
-* Call the ``setFrom()`` method on the Message.
-
-The ``From:`` address(es) are visible in the message headers and
-will be seen by the recipients.
+The ``From:`` address(es) are visible in the message headers and will be seen
+by the recipients.
.. note::
If you set multiple ``From:`` addresses then you absolutely must set a
``Sender:`` address to indicate who physically sent the message.
- .. code-block:: php
+::
- // Set a single From: address
- $message->setFrom('your@address.tld');
+ // Set a single From: address
+ $message->setFrom('your@address.tld');
- // Set a From: address including a name
- $message->setFrom(array('your@address.tld' => 'Your Name'));
+ // Set a From: address including a name
+ $message->setFrom(['your@address.tld' => 'Your Name']);
- // Set multiple From: addresses if multiple people wrote the email
- $message->setFrom(array(
- 'person1@example.org' => 'Sender One',
- 'person2@example.org' => 'Sender Two'
- ));
+ // Set multiple From: addresses if multiple people wrote the email
+ $message->setFrom([
+ 'person1@example.org' => 'Sender One',
+ 'person2@example.org' => 'Sender Two'
+ ]);
Setting the ``Sender:`` Address
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -810,10 +711,6 @@ Setting the ``Sender:`` Address
A ``Sender:`` address specifies who sent the message and is set with the
``setSender()`` method of the message.
-To set the ``Sender:`` address:
-
-* Call the ``setSender()`` method on the Message.
-
The ``Sender:`` address is visible in the message headers and will be seen by
the recipients.
@@ -825,32 +722,22 @@ This address will be used as the ``Return-Path:`` unless otherwise specified.
``Sender:`` address to indicate who physically sent the message.
You must not set more than one sender address on a message because it's not
-possible for more than one person to send a single message.
-
-.. code-block:: php
+possible for more than one person to send a single message::
$message->setSender('your@address.tld');
Setting the ``Return-Path:`` (Bounce) Address
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The ``Return-Path:`` address specifies where bounce notifications should
-be sent and is set with the ``setReturnPath()`` method of the message.
-
-You can only have one ``Return-Path:`` and it must not include
-a personal name.
-
-To set the ``Return-Path:`` address:
+The ``Return-Path:`` address specifies where bounce notifications should be
+sent and is set with the ``setReturnPath()`` method of the message.
-* Call the ``setReturnPath()`` method on the Message.
+You can only have one ``Return-Path:`` and it must not include a personal name.
-Bounce notifications will be sent to this address.
-
-.. code-block:: php
+Bounce notifications will be sent to this address::
$message->setReturnPath('bounces@address.tld');
-
Signed/Encrypted Message
------------------------
@@ -862,73 +749,72 @@ S/MIME
S/MIME can sign and/or encrypt a message using the OpenSSL extension.
-When signing a message, the signer creates a signature of the entire content of the message (including attachments).
+When signing a message, the signer creates a signature of the entire content of
+the message (including attachments).
-The certificate and private key must be PEM encoded, and can be either created using for example OpenSSL or
-obtained at an official Certificate Authority (CA).
+The certificate and private key must be PEM encoded, and can be either created
+using for example OpenSSL or obtained at an official Certificate Authority (CA).
-**The recipient must have the CA certificate in the list of trusted issuers in order to verify the signature.**
+**The recipient must have the CA certificate in the list of trusted issuers in
+order to verify the signature.**
**Make sure the certificate supports emailProtection.**
-When using OpenSSL this can done by the including the *-addtrust emailProtection* parameter when creating the certificate.
+When using OpenSSL this can done by the including the *-addtrust
+emailProtection* parameter when creating the certificate::
-.. code-block:: php
+ $message = new Swift_Message();
- $message = Swift_Message::newInstance();
-
- $smimeSigner = Swift_Signers_SMimeSigner::newInstance();
+ $smimeSigner = new Swift_Signers_SMimeSigner();
$smimeSigner->setSignCertificate('/path/to/certificate.pem', '/path/to/private-key.pem');
$message->attachSigner($smimeSigner);
-When the private key is secured using a passphrase use the following instead.
-
-.. code-block:: php
+When the private key is secured using a passphrase use the following instead::
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
- $smimeSigner = Swift_Signers_SMimeSigner::newInstance();
- $smimeSigner->setSignCertificate('/path/to/certificate.pem', array('/path/to/private-key.pem', 'passphrase'));
+ $smimeSigner = new Swift_Signers_SMimeSigner();
+ $smimeSigner->setSignCertificate('/path/to/certificate.pem', ['/path/to/private-key.pem', 'passphrase']);
$message->attachSigner($smimeSigner);
-By default the signature is added as attachment,
-making the message still readable for mailing agents not supporting signed messages.
-
-Storing the message as binary is also possible but not recommended.
+By default the signature is added as attachment, making the message still
+readable for mailing agents not supporting signed messages.
-.. code-block:: php
+Storing the message as binary is also possible but not recommended::
$smimeSigner->setSignCertificate('/path/to/certificate.pem', '/path/to/private-key.pem', PKCS7_BINARY);
-When encrypting the message (also known as enveloping), the entire message (including attachments)
-is encrypted using a certificate, and the recipient can then decrypt the message using corresponding private key.
+When encrypting the message (also known as enveloping), the entire message
+(including attachments) is encrypted using a certificate, and the recipient can
+then decrypt the message using corresponding private key.
-Encrypting ensures nobody can read the contents of the message without the private key.
+Encrypting ensures nobody can read the contents of the message without the
+private key.
-Normally the recipient provides a certificate for encrypting and keeping the decryption key private.
+Normally the recipient provides a certificate for encrypting and keeping the
+decryption key private.
-Using both signing and encrypting is also possible.
+Using both signing and encrypting is also possible::
-.. code-block:: php
+ $message = new Swift_Message();
- $message = Swift_Message::newInstance();
-
- $smimeSigner = Swift_Signers_SMimeSigner::newInstance();
+ $smimeSigner = new Swift_Signers_SMimeSigner();
$smimeSigner->setSignCertificate('/path/to/sign-certificate.pem', '/path/to/private-key.pem');
$smimeSigner->setEncryptCertificate('/path/to/encrypt-certificate.pem');
$message->attachSigner($smimeSigner);
-The used encryption cipher can be set as the second parameter of setEncryptCertificate()
-
-See http://php.net/manual/openssl.ciphers for a list of supported ciphers.
+The used encryption cipher can be set as the second parameter of
+setEncryptCertificate()
-By default the message is first signed and then encrypted, this can be changed by adding.
+See https://secure.php.net/manual/openssl.ciphers for a list of supported ciphers.
-.. code-block:: php
+By default the message is first signed and then encrypted, this can be changed
+by adding::
$smimeSigner->setSignThenEncrypt(false);
-**Changing this is not recommended as most mail agents don't support this none-standard way.**
+**Changing this is not recommended as most mail agents don't support this
+none-standard way.**
Only when having trouble with sign then encrypt method, this should be changed.
@@ -937,14 +823,12 @@ Requesting a Read Receipt
It is possible to request a read-receipt to be sent to an address when the
email is opened. To request a read receipt set the address with
-``setReadReceiptTo()``.
+``setReadReceiptTo()``:
-To request a read receipt:
+ $message->setReadReceiptTo('your@address.tld');
-* Set the address you want the receipt to be sent to with the
- ``setReadReceiptTo()`` method on the Message.
-
-When the email is opened, if the mail client supports it a notification will be sent to this address.
+When the email is opened, if the mail client supports it a notification will be
+sent to this address.
.. note::
@@ -952,14 +836,10 @@ When the email is opened, if the mail client supports it a notification will be
clients auto-disable them. Those clients that will send a read receipt
will make the user aware that one has been requested.
- .. code-block:: php
-
- $message->setReadReceiptTo('your@address.tld');
-
Setting the Character Set
-------------------------
-The character set of the message (and it's MIME parts) is set with the
+The character set of the message (and its MIME parts) is set with the
``setCharset()`` method. You can also change the global default of UTF-8 by
working with the ``Swift_Preferences`` class.
@@ -982,15 +862,13 @@ To set the character set of your Message:
* Change the global UTF-8 setting by calling
``Swift_Preferences::setCharset()``; or
-* Call the ``setCharset()`` method on the message or the MIME part.
-
- .. code-block:: php
+* Call the ``setCharset()`` method on the message or the MIME part::
// Approach 1: Change the global setting (suggested)
Swift_Preferences::getInstance()->setCharset('iso-8859-2');
// Approach 2: Call the setCharset() method of the message
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setCharset('iso-8859-2');
// Approach 3: Specify the charset when setting the body
@@ -999,19 +877,42 @@ To set the character set of your Message:
// Approach 4: Specify the charset for each part added
$message->addPart('My part', 'text/plain', 'iso-8859-2');
+Setting the Encoding
+--------------------
+
+The body of each MIME part needs to be encoded. Binary attachments are encoded
+in base64 using the ``Swift_Mime_ContentEncoder_Base64ContentEncoder``. Text
+parts are traditionally encoded in quoted-printable using
+``Swift_Mime_ContentEncoder_QpContentEncoder`` or
+``Swift_Mime_ContentEncoder_NativeQpContentEncoder``.
+
+The encoder of the message or MIME part is set with the ``setEncoder()`` method.
+
+Quoted-printable is the safe choice, because it converts 8-bit text as 7-bit.
+Most modern SMTP servers support 8-bit text. This is advertised via the 8BITMIME
+SMTP extension. If your outbound SMTP server supports this SMTP extension, and
+it supports downgrading the message (e.g converting to quoted-printable on the
+fly) when delivering to a downstream server that does not support the extension,
+you may wish to use ``Swift_Mime_ContentEncoder_PlainContentEncoder`` in
+``8bit`` mode instead. This has the advantage that the source data is slightly
+more readable and compact, especially for non-Western languages.
+
+ $eightBitMime = new Swift_Transport_Esmtp_EightBitMimeHandler();
+ $transport->setExtensionHandlers([$eightBitMime]);
+ $plainEncoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');
+ $message->setEncoder($plainEncoder);
+
Setting the Line Length
-----------------------
-The length of lines in a message can be changed by using the ``setMaxLineLength()`` method on the message. It should be kept to less than
-1000 characters.
+The length of lines in a message can be changed by using the
+``setMaxLineLength()`` method on the message::
+
+ $message->setMaxLineLength(1000);
Swift Mailer defaults to using 78 characters per line in a message. This is
done for historical reasons and so that the message can be easily viewed in
-plain-text terminals.
-
-To change the maximum length of lines in your Message:
-
-* Call the ``setMaxLineLength()`` method on the Message.
+plain-text terminals
Lines that are longer than the line length specified will be wrapped between
words.
@@ -1023,36 +924,27 @@ words.
as truncating parts of your message when it is transported between SMTP
servers.
- .. code-block:: php
-
- $message->setMaxLineLength(1000);
-
Setting the Message Priority
----------------------------
You can change the priority of the message with ``setPriority()``. Setting the
priority will not change the way your email is sent -- it is purely an
-indicative setting for the recipient.
+indicative setting for the recipient::
+
+ // Indicate "High" priority
+ $message->setPriority(2);
The priority of a message is an indication to the recipient what significance
it has. Swift Mailer allows you to set the priority by calling the
``setPriority`` method. This method takes an integer value between 1 and 5:
-* `Swift_Mime_SimpleMessage::PRIORITY_HIGHEST`: 1
-* `Swift_Mime_SimpleMessage::PRIORITY_HIGH`: 2
-* `Swift_Mime_SimpleMessage::PRIORITY_NORMAL`: 3
-* `Swift_Mime_SimpleMessage::PRIORITY_LOW`: 4
-* `Swift_Mime_SimpleMessage::PRIORITY_LOWEST`: 5
-
-To set the message priority:
+* ``Swift_Mime_SimpleMessage::PRIORITY_HIGHEST``: 1
+* ``Swift_Mime_SimpleMessage::PRIORITY_HIGH``: 2
+* ``Swift_Mime_SimpleMessage::PRIORITY_NORMAL``: 3
+* ``Swift_Mime_SimpleMessage::PRIORITY_LOW``: 4
+* ``Swift_Mime_SimpleMessage::PRIORITY_LOWEST``: 5
-* Set the priority as an integer between 1 and 5 with the ``setPriority()``
- method on the Message.
-
-.. code-block:: php
-
- // Indicate "High" priority
- $message->setPriority(2);
+::
// Or use the constant to be more explicit
$message->setPriority(Swift_Mime_SimpleMessage::PRIORITY_HIGH);
diff --git a/vendor/swiftmailer/swiftmailer/doc/overview.rst b/vendor/swiftmailer/swiftmailer/doc/overview.rst
deleted file mode 100644
index ebfe008360..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/overview.rst
+++ /dev/null
@@ -1,159 +0,0 @@
-Library Overview
-================
-
-Most features (and more) of your every day mail client software are provided
-by Swift Mailer, using object-oriented PHP code as the interface.
-
-In this chapter we will take a short tour of the various components, which put
-together form the Swift Mailer library as a whole. You will learn key
-terminology used throughout the rest of this book and you will gain a little
-understanding of the classes you will work with as you integrate Swift Mailer
-into your application.
-
-This chapter is intended to prepare you for the information contained in the
-subsequent chapters of this book. You may choose to skip this chapter if you
-are fairly technically minded, though it is likely to save you some time in
-the long run if you at least read between the lines here.
-
-System Requirements
--------------------
-
-The basic requirements to operate Swift Mailer are extremely minimal and
-easily achieved. Historically, Swift Mailer has supported both PHP 4 and PHP 5
-by following a parallel development workflow. Now in it's fourth major
-version, and Swift Mailer operates on servers running PHP 5.3.3 or higher.
-
-The library aims to work with as many PHP 5 projects as possible:
-
-* PHP 5.3.3 or higher, with the SPL extension (standard)
-
-* Limited network access to connect to remote SMTP servers
-
-* 8 MB or more memory limit (Swift Mailer uses around 2 MB)
-
-Component Breakdown
--------------------
-
-Swift Mailer is made up of many classes. Each of these classes can be grouped
-into a general "component" group which describes the task it is designed to
-perform.
-
-We'll take a brief look at the components which form Swift Mailer in this
-section of the book.
-
-The Mailer
-~~~~~~~~~~
-
-The mailer class, ``Swift_Mailer`` is the central class in the library where
-all of the other components meet one another. ``Swift_Mailer`` acts as a sort
-of message dispatcher, communicating with the underlying Transport to deliver
-your Message to all intended recipients.
-
-If you were to dig around in the source code for Swift Mailer you'd notice
-that ``Swift_Mailer`` itself is pretty bare. It delegates to other objects for
-most tasks and in theory, if you knew the internals of Swift Mailer well you
-could by-pass this class entirely. We wouldn't advise doing such a thing
-however -- there are reasons this class exists:
-
-* for consistency, regardless of the Transport used
-
-* to provide abstraction from the internals in the event internal API changes
- are made
-
-* to provide convenience wrappers around aspects of the internal API
-
-An instance of ``Swift_Mailer`` is created by the developer before sending any
-Messages.
-
-Transports
-~~~~~~~~~~
-
-Transports are the classes in Swift Mailer that are responsible for
-communicating with a service in order to deliver a Message. There are several
-types of Transport in Swift Mailer, all of which implement the Swift_Transport
-interface and offer underlying start(), stop() and send() methods.
-
-Typically you will not need to know how a Transport works under-the-surface,
-you will only need to know how to create an instance of one, and which one to
-use for your environment.
-
-+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-| Class | Features | Pros/cons |
-+=================================+=============================================================================================+===============================================================================================================================================+
-| ``Swift_SmtpTransport`` | Sends messages over SMTP; Supports Authentication; Supports Encryption | Very portable; Pleasingly predictable results; Provides good feedback |
-+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-| ``Swift_SendmailTransport`` | Communicates with a locally installed ``sendmail`` executable (Linux/UNIX) | Quick time-to-run; Provides less-accurate feedback than SMTP; Requires ``sendmail`` installation |
-+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-| ``Swift_LoadBalancedTransport`` | Cycles through a collection of the other Transports to manage load-reduction | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down); Keeps the load on remote services down by spreading the work |
-+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-| ``Swift_FailoverTransport`` | Works in conjunction with a collection of the other Transports to provide high-availability | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down) |
-+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-
-MIME Entities
-~~~~~~~~~~~~~
-
-Everything that forms part of a Message is called a MIME Entity. All MIME
-entities in Swift Mailer share a common set of features. There are various
-types of MIME entity that serve different purposes such as Attachments and
-MIME parts.
-
-An e-mail message is made up of several relatively simple entities that are
-combined in different ways to achieve different results. All of these entities
-have the same fundamental outline but serve a different purpose. The Message
-itself can be defined as a MIME entity, an Attachment is a MIME entity, all
-MIME parts are MIME entities -- and so on!
-
-The basic units of each MIME entity -- be it the Message itself, or an
-Attachment -- are its Headers and its body:
-
-.. code-block:: text
-
- Other-Header: Another value
-
- The body content itself
-
-The Headers of a MIME entity, and its body must conform to some strict
-standards defined by various RFC documents. Swift Mailer ensures that these
-specifications are followed by using various types of object, including
-Encoders and different Header types to generate the entity.
-
-Each MIME component implements the base ``Swift_Mime_MimeEntity`` interface,
-which offers methods for retrieving Headers, adding new Headers, changing the
-Encoder, updating the body and so on!
-
-All MIME entities have one Header in common -- the Content-Type Header,
-updated with the entity's ``setContentType()`` method.
-
-Encoders
-~~~~~~~~
-
-Encoders are used to transform the content of Messages generated in Swift
-Mailer into a format that is safe to send across the internet and that
-conforms to RFC specifications.
-
-Generally speaking you will not need to interact with the Encoders in Swift
-Mailer -- the correct settings will be handled by the library itself.
-However they are probably worth a brief mention in the event that you do want
-to play with them.
-
-Both the Headers and the body of all MIME entities (including the Message
-itself) use Encoders to ensure the data they contain can be sent over the
-internet without becoming corrupted or misinterpreted.
-
-There are two types of Encoder: Base64 and Quoted-Printable.
-
-Plugins
-~~~~~~~
-
-Plugins exist to extend, or modify the behaviour of Swift Mailer. They respond
-to Events that are fired within the Transports during sending.
-
-There are a number of Plugins provided as part of the base Swift Mailer
-package and they all follow a common interface to respond to Events fired
-within the library. Interfaces are provided to "listen" to each type of Event
-fired and to act as desired when a listened-to Event occurs.
-
-Although several plugins are provided with Swift Mailer out-of-the-box, the
-Events system has been specifically designed to make it easy for experienced
-object-oriented developers to write their own plugins in order to achieve
-goals that may not be possible with the base library.
diff --git a/vendor/swiftmailer/swiftmailer/doc/plugins.rst b/vendor/swiftmailer/swiftmailer/doc/plugins.rst
index 6cec6be267..c19c6d6a6b 100644
--- a/vendor/swiftmailer/swiftmailer/doc/plugins.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/plugins.rst
@@ -1,21 +1,31 @@
Plugins
=======
-Plugins are provided with Swift Mailer and can be used to extend the behavior
-of the library in situations where using simple class inheritance would be more complex.
+Plugins exist to extend, or modify the behaviour of Swift Mailer. They respond
+to Events that are fired within the Transports during sending.
+
+There are a number of Plugins provided as part of the base Swift Mailer package
+and they all follow a common interface to respond to Events fired within the
+library. Interfaces are provided to "listen" to each type of Event fired and to
+act as desired when a listened-to Event occurs.
+
+Although several plugins are provided with Swift Mailer out-of-the-box, the
+Events system has been specifically designed to make it easy for experienced
+object-oriented developers to write their own plugins in order to achieve
+goals that may not be possible with the base library.
AntiFlood Plugin
----------------
-Many SMTP servers have limits on the number of messages that may be sent
-during any single SMTP connection. The AntiFlood plugin provides a way to stay
-within this limit while still managing a large number of emails.
+Many SMTP servers have limits on the number of messages that may be sent during
+any single SMTP connection. The AntiFlood plugin provides a way to stay within
+this limit while still managing a large number of emails.
A typical limit for a single connection is 100 emails. If the server you
-connect to imposes such a limit, it expects you to disconnect after that
-number of emails has been sent. You could manage this manually within a loop,
-but the AntiFlood plugin provides the necessary wrapper code so that you don't
-need to worry about this logic.
+connect to imposes such a limit, it expects you to disconnect after that number
+of emails has been sent. You could manage this manually within a loop, but the
+AntiFlood plugin provides the necessary wrapper code so that you don't need to
+worry about this logic.
Regardless of limits imposed by the server, it's usually a good idea to be
conservative with the resources of the SMTP server. Sending will become
@@ -38,29 +48,14 @@ The AntiFlood Plugin -- like all plugins -- is added with the Mailer class's
``registerPlugin()`` method. It takes two constructor parameters: the number of
emails to pause after, and optionally the number of seconds to pause for.
-To use the AntiFlood plugin:
-
-* Create an instance of the Mailer using any Transport you choose.
-
-* Create an instance of the ``Swift_Plugins_AntiFloodPlugin`` class, passing
- in one or two constructor parameters.
-
-* Register the plugin using the Mailer's ``registerPlugin()`` method.
-
-* Continue using Swift Mailer to send messages as normal.
-
-When Swift Mailer sends messages it will count the number of messages that
-have been sent since the last re-connect. Once the number hits your specified
-threshold it will disconnect and re-connect, optionally pausing for a
-specified amount of time.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+When Swift Mailer sends messages it will count the number of messages that have
+been sent since the last re-connect. Once the number hits your specified
+threshold it will disconnect and re-connect, optionally pausing for a specified
+amount of time::
// Create the Mailer using any Transport
- $mailer = Swift_Mailer::newInstance(
- Swift_SmtpTransport::newInstance('smtp.example.org', 25)
+ $mailer = new Swift_Mailer(
+ new Swift_SmtpTransport('smtp.example.org', 25)
);
// Use AntiFlood to re-connect after 100 emails
@@ -83,9 +78,9 @@ If your SMTP server has restrictions in place to limit the rate at which you
send emails, then your code will need to be aware of this rate-limiting. The
Throttler plugin makes Swift Mailer run at a rate-limited speed.
-Many shared hosts don't open their SMTP servers as a free-for-all. Usually
-they have policies in place (probably to discourage spammers) that only allow
-you to send a fixed number of emails per-hour/day.
+Many shared hosts don't open their SMTP servers as a free-for-all. Usually they
+have policies in place (probably to discourage spammers) that only allow you to
+send a fixed number of emails per-hour/day.
The Throttler plugin supports two modes of rate-limiting and with each, you
will need to do that math to figure out the values you want. The plugin can
@@ -99,29 +94,14 @@ The Throttler Plugin -- like all plugins -- is added with the Mailer class'
``registerPlugin()`` method. It has two required constructor parameters that
tell it how to do its rate-limiting.
-To use the Throttler plugin:
-
-* Create an instance of the Mailer using any Transport you choose.
-
-* Create an instance of the ``Swift_Plugins_ThrottlerPlugin`` class, passing
- the number of emails, or bytes you wish to limit by, along with the mode
- you're using.
-
-* Register the plugin using the Mailer's ``registerPlugin()`` method.
-
-* Continue using Swift Mailer to send messages as normal.
-
-When Swift Mailer sends messages it will keep track of the rate at which sending
-messages is occurring. If it realises that sending is happening too fast, it
-will cause your program to ``sleep()`` for enough time to average out the rate.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+When Swift Mailer sends messages it will keep track of the rate at which
+sending messages is occurring. If it realises that sending is happening too
+fast, it will cause your program to ``sleep()`` for enough time to average out
+the rate::
// Create the Mailer using any Transport
- $mailer = Swift_Mailer::newInstance(
- Swift_SmtpTransport::newInstance('smtp.example.org', 25)
+ $mailer = new Swift_Mailer(
+ new Swift_SmtpTransport('smtp.example.org', 25)
);
// Rate limit to 100 emails per-minute
@@ -148,10 +128,10 @@ The Logger plugins helps with debugging during the process of sending. It can
help to identify why an SMTP server is rejecting addresses, or any other
hard-to-find problems that may arise.
-The Logger plugin comes in two parts. There's the plugin itself, along with
-one of a number of possible Loggers that you may choose to use. For example,
-the logger may output messages directly in realtime, or it may capture
-messages in an array.
+The Logger plugin comes in two parts. There's the plugin itself, along with one
+of a number of possible Loggers that you may choose to use. For example, the
+logger may output messages directly in realtime, or it may capture messages in
+an array.
One other notable feature is the way in which the Logger plugin changes
Exception messages. If Exceptions are being thrown but the error message does
@@ -164,8 +144,7 @@ own implementation is incredibly simple and is achieved by creating a short
class that implements the ``Swift_Plugins_Logger`` interface.
* ``Swift_Plugins_Loggers_ArrayLogger``: Keeps a collection of log messages
- inside an array. The array content can be cleared or dumped out to the
- screen.
+ inside an array. The array content can be cleared or dumped out to the screen.
* ``Swift_Plugins_Loggers_EchoLogger``: Prints output to the screen in
realtime. Handy for very rudimentary debug output.
@@ -177,34 +156,14 @@ The Logger Plugin -- like all plugins -- is added with the Mailer class'
``registerPlugin()`` method. It accepts an instance of ``Swift_Plugins_Logger``
in its constructor.
-To use the Logger plugin:
-
-* Create an instance of the Mailer using any Transport you choose.
-
-* Create an instance of the a Logger implementation of
- ``Swift_Plugins_Logger``.
-
-* Create an instance of the ``Swift_Plugins_LoggerPlugin`` class, passing the
- created Logger instance to its constructor.
-
-* Register the plugin using the Mailer's ``registerPlugin()`` method.
-
-* Continue using Swift Mailer to send messages as normal.
-
-* Dump the contents of the log with the logger's ``dump()`` method.
-
When Swift Mailer sends messages it will keep a log of all the interactions
with the underlying Transport being used. Depending upon the Logger that has
-been used the behaviour will differ, but all implementations offer a way to
-get the contents of the log.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+been used the behaviour will differ, but all implementations offer a way to get
+the contents of the log::
// Create the Mailer using any Transport
- $mailer = Swift_Mailer::newInstance(
- Swift_SmtpTransport::newInstance('smtp.example.org', 25)
+ $mailer = new Swift_Mailer(
+ new Swift_SmtpTransport('smtp.example.org', 25)
);
// To use the ArrayLogger
@@ -234,18 +193,18 @@ tiny variations such as the recipient's name being used inside the message
body. The Decorator plugin aims to provide a solution for allowing these small
differences.
-The decorator plugin works by intercepting the sending process of Swift
-Mailer, reading the email address in the To: field and then looking up a set
-of replacements for a template.
+The decorator plugin works by intercepting the sending process of Swift Mailer,
+reading the email address in the To: field and then looking up a set of
+replacements for a template.
While the use of this plugin is simple, it is probably the most commonly
misunderstood plugin due to the way in which it works. The typical mistake
users make is to try registering the plugin multiple times (once for each
recipient) -- inside a loop for example. This is incorrect.
-The Decorator plugin should be registered just once, but containing the list
-of all recipients prior to sending. It will use this list of recipients to
-find the required replacements during sending.
+The Decorator plugin should be registered just once, but containing the list of
+all recipients prior to sending. It will use this list of recipients to find
+the required replacements during sending.
Using the Decorator Plugin
~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -263,37 +222,33 @@ you'll be sending the message to.
email addresses and whose values are an associative array of replacements
for that email address. The curly braces used in this example can be any
type of syntax you choose, provided they match the placeholders in your
- email template.
-
- .. code-block:: php
+ email template::
- $replacements = array();
+ $replacements = [];
foreach ($users as $user) {
- $replacements[$user['email']] = array(
+ $replacements[$user['email']] = [
'{username}'=>$user['username'],
- '{password}'=>$user['password']
- );
+ '{resetcode}'=>$user['resetcode']
+ ];
}
Now create an instance of the Decorator plugin using this array of replacements
and then register it with the Mailer. Do this only once!
-.. code-block:: php
+::
$decorator = new Swift_Plugins_DecoratorPlugin($replacements);
$mailer->registerPlugin($decorator);
When you create your message, replace elements in the body (and/or the subject
-line) with your placeholders.
+line) with your placeholders::
-.. code-block:: php
-
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('Important notice for {username}')
->setBody(
- "Hello {username}, we have reset your password to {password}\n" .
- "Please log in and change it at your earliest convenience."
+ "Hello {username}, you requested to reset your password.\n" .
+ "Please visit https://example.com/pwreset and use the reset code {resetcode} to set a new password."
)
;
@@ -310,8 +265,8 @@ this to one user:
Subject: Important notice for smilingsunshine2009
- Hello smilingsunshine2009, we have reset your password to rainyDays
- Please log in and change it at your earliest convenience.
+ Hello smilingsunshine2009,you requested to reset your password.
+ Please visit https://example.com/pwreset and use the reset code 183457 to set a new password.
While another use may receive the message as:
@@ -319,12 +274,12 @@ While another use may receive the message as:
Subject: Important notice for billy-bo-bob
- Hello billy-bo-bob, we have reset your password to dancingOctopus
- Please log in and change it at your earliest convenience.
+ Hello billy-bo-bob, you requested to reset your password.
+ Please visit https://example.com/pwreset and use the reset code 539127 to set a new password.
While the decorator plugin provides a means to solve this problem, there are
-various ways you could tackle this problem without the need for a plugin.
-We're trying to come up with a better way ourselves and while we have several
+various ways you could tackle this problem without the need for a plugin. We're
+trying to come up with a better way ourselves and while we have several
(obvious) ideas we don't quite have the perfect solution to go ahead and
implement it. Watch this space.
@@ -337,16 +292,15 @@ that performs replacement lookups on-the-fly you may provide your own
implementation.
Providing your own replacements lookup implementation for the Decorator is
-simply a matter of passing an instance of ``Swift_Plugins_Decorator_Replacements`` to the decorator plugin's constructor,
+simply a matter of passing an instance of
+``Swift_Plugins_Decorator_Replacements`` to the decorator plugin's constructor,
rather than passing in an array.
The Replacements interface is very simple to implement since it has just one
method: ``getReplacementsFor($address)``.
Imagine you want to look up replacements from a database on-the-fly, you might
-provide an implementation that does this. You need to create a small class.
-
-.. code-block:: php
+provide an implementation that does this. You need to create a small class::
class DbReplacements implements Swift_Plugins_Decorator_Replacements {
public function getReplacementsFor($address) {
@@ -358,28 +312,26 @@ provide an implementation that does this. You need to create a small class.
$query->execute([$address]);
if ($row = $query->fetch(PDO::FETCH_ASSOC)) {
- return array(
+ return [
'{username}'=>$row['username'],
- '{password}'=>$row['password']
- );
+ '{resetcode}'=>$row['resetcode']
+ ];
}
}
}
Now all you need to do is pass an instance of your class into the Decorator
-plugin's constructor instead of passing an array.
-
-.. code-block:: php
+plugin's constructor instead of passing an array::
$decorator = new Swift_Plugins_DecoratorPlugin(new DbReplacements());
$mailer->registerPlugin($decorator);
-For each message sent, the plugin will call your class' ``getReplacementsFor()``
-method to find the array of replacements it needs.
+For each message sent, the plugin will call your class'
+``getReplacementsFor()`` method to find the array of replacements it needs.
.. note::
If your lookup algorithm is case sensitive, you should transform the
- ``$address`` argument as appropriate -- for example by passing it
- through ``strtolower()``.
+ ``$address`` argument as appropriate -- for example by passing it through
+ ``strtolower()``.
diff --git a/vendor/swiftmailer/swiftmailer/doc/sending.rst b/vendor/swiftmailer/swiftmailer/doc/sending.rst
index f340404cad..0104207971 100644
--- a/vendor/swiftmailer/swiftmailer/doc/sending.rst
+++ b/vendor/swiftmailer/swiftmailer/doc/sending.rst
@@ -7,40 +7,15 @@ Quick Reference for Sending a Message
Sending a message is very straightforward. You create a Transport, use it to
create the Mailer, then you use the Mailer to send the message.
-To send a Message:
-
-* Create a Transport from one of the provided Transports --
- ``Swift_SmtpTransport``, ``Swift_SendmailTransport``
- or one of the aggregate Transports.
-
-* Create an instance of the ``Swift_Mailer`` class, using the Transport as
- it's constructor parameter.
-
-* Create a Message.
-
-* Send the message via the ``send()`` method on the Mailer object.
-
-.. caution::
-
- The ``Swift_SmtpTransport`` and ``Swift_SendmailTransport`` transports use
- ``proc_*`` PHP functions, which might not be available on your PHP
- installation. You can easily check if that's the case by running the
- following PHP script: ``<?php echo function_exists('proc_open') ? "Yep,
- that will work" : "Sorry, that won't work";``
-
-When using ``send()`` the message will be sent just like it would be sent if you
-used your mail client. An integer is returned which includes the number of
-successful recipients. If none of the recipients could be sent to then zero will
-be returned, which equates to a boolean ``false``. If you set two ``To:``
+When using ``send()`` the message will be sent just like it would be sent if
+you used your mail client. An integer is returned which includes the number of
+successful recipients. If none of the recipients could be sent to then zero
+will be returned, which equates to a boolean ``false``. If you set two ``To:``
recipients and three ``Bcc:`` recipients in the message and all of the
-recipients are delivered to successfully then the value 5 will be returned.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+recipients are delivered to successfully then the value 5 will be returned::
// Create the Transport
- $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25)
+ $transport = (new Swift_SmtpTransport('smtp.example.org', 25))
->setUsername('your username')
->setPassword('your password')
;
@@ -49,16 +24,16 @@ recipients are delivered to successfully then the value 5 will be returned.
You could alternatively use a different transport such as Sendmail:
// Sendmail
- $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
+ $transport = new Swift_SendmailTransport('/usr/sbin/sendmail -bs');
*/
// Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
+ $mailer = new Swift_Mailer($transport);
// Create a message
- $message = Swift_Message::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself')
;
@@ -68,19 +43,33 @@ recipients are delivered to successfully then the value 5 will be returned.
Transport Types
~~~~~~~~~~~~~~~
-A Transport is the component which actually does the sending. You need to
-provide a Transport object to the Mailer class and there are several possible
-options.
+Transports are the classes in Swift Mailer that are responsible for
+communicating with a service in order to deliver a Message. There are several
+types of Transport in Swift Mailer, all of which implement the
+``Swift_Transport`` interface::
+
+* ``Swift_SmtpTransport``: Sends messages over SMTP; Supports Authentication;
+ Supports Encryption. Very portable; Pleasingly predictable results; Provides
+ good feedback;
-Typically you will not need to know how a Transport works under-the-surface,
-you will only need to know how to create an instance of one, and which one to
-use for your environment.
+* ``Swift_SendmailTransport``: Communicates with a locally installed
+ ``sendmail`` executable (Linux/UNIX). Quick time-to-run; Provides
+ less-accurate feedback than SMTP; Requires ``sendmail`` installation;
+
+* ``Swift_LoadBalancedTransport``: Cycles through a collection of the other
+ Transports to manage load-reduction. Provides graceful fallback if one
+ Transport fails (e.g. an SMTP server is down); Keeps the load on remote
+ services down by spreading the work;
+
+* ``Swift_FailoverTransport``: Works in conjunction with a collection of the
+ other Transports to provide high-availability. Provides graceful fallback if
+ one Transport fails (e.g. an SMTP server is down).
The SMTP Transport
..................
The SMTP Transport sends messages over the (standardized) Simple Message
-Transfer Protocol. It can deal with encryption and authentication.
+Transfer Protocol. It can deal with encryption and authentication.
The SMTP Transport, ``Swift_SmtpTransport`` is without doubt the most commonly
used Transport because it will work on 99% of web servers (I just made that
@@ -92,12 +81,12 @@ SMTP servers often require users to authenticate with a username and password
before any mail can be sent to other domains. This is easily achieved using
Swift Mailer with the SMTP Transport.
-SMTP is a protocol -- in other words it's a "way" of communicating a job
-to be done (i.e. sending a message). The SMTP protocol is the fundamental
-basis on which messages are delivered all over the internet 7 days a week, 365
-days a year. For this reason it's the most "direct" method of sending messages
-you can use and it's the one that will give you the most power and feedback
-(such as delivery failures) when using Swift Mailer.
+SMTP is a protocol -- in other words it's a "way" of communicating a job to be
+done (i.e. sending a message). The SMTP protocol is the fundamental basis on
+which messages are delivered all over the internet 7 days a week, 365 days a
+year. For this reason it's the most "direct" method of sending messages you can
+use and it's the one that will give you the most power and feedback (such as
+delivery failures) when using Swift Mailer.
Because SMTP is generally run as a remote service (i.e. you connect to it over
the network/internet) it's extremely portable from server-to-server. You can
@@ -114,35 +103,24 @@ Using the SMTP Transport
The SMTP Transport is easy to use. Most configuration options can be set with
the constructor.
-To use the SMTP Transport you need to know which SMTP server your code needs
-to connect to. Ask your web host if you're not sure. Lots of people ask me who
-to connect to -- I really can't answer that since it's a setting that's
-extremely specific to your hosting environment.
-
-To use the SMTP Transport:
-
-* Call ``Swift_SmtpTransport::newInstance()`` with the SMTP server name and
- optionally with a port number (defaults to 25).
-
-* Use the returned object to create the Mailer.
+To use the SMTP Transport you need to know which SMTP server your code needs to
+connect to. Ask your web host if you're not sure. Lots of people ask me who to
+connect to -- I really can't answer that since it's a setting that's extremely
+specific to your hosting environment.
A connection to the SMTP server will be established upon the first call to
-``send()``.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+``send()``::
// Create the Transport
- $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25);
+ $transport = new Swift_SmtpTransport('smtp.example.org', 25);
// Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
+ $mailer = new Swift_Mailer($transport);
/*
It's also possible to use multiple method calls
- $transport = Swift_SmtpTransport::newInstance()
+ $transport = (new Swift_SmtpTransport())
->setHost('smtp.example.org')
->setPort(25)
;
@@ -151,15 +129,14 @@ A connection to the SMTP server will be established upon the first call to
Encrypted SMTP
^^^^^^^^^^^^^^
-You can use SSL or TLS encryption with the SMTP Transport by specifying it as
-a parameter or with a method call.
-
-To use encryption with the SMTP Transport:
+You can use SSL or TLS encryption with the SMTP Transport by specifying it as a
+parameter or with a method call::
-* Pass the encryption setting as a third parameter to
- ``Swift_SmtpTransport::newInstance()``; or
+ // Create the Transport
+ $transport = new Swift_SmtpTransport('smtp.example.org', 587, 'ssl');
-* Call the ``setEncryption()`` method on the Transport.
+ // Create the Mailer using your created Transport
+ $mailer = new Swift_Mailer($transport);
A connection to the SMTP server will be established upon the first call to
``send()``. The connection will be initiated with the correct encryption
@@ -170,42 +147,29 @@ settings.
For SSL or TLS encryption to work your PHP installation must have
appropriate OpenSSL transports wrappers. You can check if "tls" and/or
"ssl" are present in your PHP installation by using the PHP function
- ``stream_get_transports()``
-
- .. code-block:: php
-
- require_once 'lib/swift_required.php';
-
- // Create the Transport
- $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 587, 'ssl');
+ ``stream_get_transports()``.
- // Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
-
- /*
- It's also possible to use multiple method calls
-
- $transport = Swift_SmtpTransport::newInstance()
- ->setHost('smtp.example.org')
- ->setPort(587)
- ->setEncryption('ssl')
- ;
- */
+.. note::
+ If you are using Mailcatcher_, make sure you do not set the encryption
+ for the ``Swift_SmtpTransport``, since Mailcatcher does not support encryption.
SMTP with a Username and Password
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some servers require authentication. You can provide a username and password
-with ``setUsername()`` and ``setPassword()`` methods.
+with ``setUsername()`` and ``setPassword()`` methods::
-To use a username and password with the SMTP Transport:
-
-* Create the Transport with ``Swift_SmtpTransport::newInstance()``.
+ // Create the Transport the call setUsername() and setPassword()
+ $transport = (new Swift_SmtpTransport('smtp.example.org', 25))
+ ->setUsername('username')
+ ->setPassword('password')
+ ;
-* Call the ``setUsername()`` and ``setPassword()`` methods on the Transport.
+ // Create the Mailer using your created Transport
+ $mailer = new Swift_Mailer($transport);
-Your username and password will be used to authenticate upon first connect
-when ``send()`` are first used on the Mailer.
+Your username and password will be used to authenticate upon first connect when
+``send()`` are first used on the Mailer.
If authentication fails, an Exception of type ``Swift_TransportException`` will
be thrown.
@@ -216,27 +180,14 @@ be thrown.
Exception is going to be thrown, call the ``start()`` method on the
created Transport.
- .. code-block:: php
-
- require_once 'lib/swift_required.php';
-
- // Create the Transport the call setUsername() and setPassword()
- $transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25)
- ->setUsername('username')
- ->setPassword('password')
- ;
-
- // Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
-
The Sendmail Transport
......................
-The Sendmail Transport sends messages by communicating with a locally
-installed MTA -- such as ``sendmail``.
+The Sendmail Transport sends messages by communicating with a locally installed
+MTA -- such as ``sendmail``.
-The Sendmail Transport, ``Swift_SendmailTransport`` does not directly connect to
-any remote services. It is designed for Linux servers that have ``sendmail``
+The Sendmail Transport, ``Swift_SendmailTransport`` does not directly connect
+to any remote services. It is designed for Linux servers that have ``sendmail``
installed. The Transport starts a local ``sendmail`` process and sends messages
to it. Usually the ``sendmail`` process will respond quickly as it spools your
messages to disk before sending them.
@@ -248,18 +199,18 @@ its name, provided they have the relevant sendmail wrappers so that they can be
started with the correct command-line flags.
It's a common misconception that because the Sendmail Transport returns a
-result very quickly it must therefore deliver messages to recipients quickly
--- this is not true. It's not slow by any means, but it's certainly not
-faster than SMTP when it comes to getting messages to the intended recipients.
-This is because sendmail itself sends the messages over SMTP once they have
-been quickly spooled to disk.
+result very quickly it must therefore deliver messages to recipients quickly --
+this is not true. It's not slow by any means, but it's certainly not faster
+than SMTP when it comes to getting messages to the intended recipients. This is
+because sendmail itself sends the messages over SMTP once they have been
+quickly spooled to disk.
The Sendmail Transport has the potential to be just as smart of the SMTP
Transport when it comes to notifying Swift Mailer about which recipients were
rejected, but in reality the majority of locally installed ``sendmail``
-instances are not configured well enough to provide any useful feedback. As such
-Swift Mailer may report successful deliveries where they did in fact fail before
-they even left your server.
+instances are not configured well enough to provide any useful feedback. As
+such Swift Mailer may report successful deliveries where they did in fact fail
+before they even left your server.
You can run the Sendmail Transport in two different modes specified by command
line flags:
@@ -270,19 +221,19 @@ line flags:
* "``-t``" runs in piped mode with no feedback, but theoretically faster,
though not advised
-You can think of the Sendmail Transport as a sort of asynchronous SMTP Transport
--- though if you have problems with delivery failures you should try using the
-SMTP Transport instead. Swift Mailer isn't doing the work here, it's simply
-passing the work to somebody else (i.e. ``sendmail``).
+You can think of the Sendmail Transport as a sort of asynchronous SMTP
+Transport -- though if you have problems with delivery failures you should try
+using the SMTP Transport instead. Swift Mailer isn't doing the work here, it's
+simply passing the work to somebody else (i.e. ``sendmail``).
Using the Sendmail Transport
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-To use the Sendmail Transport you simply need to call
-``Swift_SendmailTransport::newInstance()`` with the command as a parameter.
+To use the Sendmail Transport you simply need to call ``new
+Swift_SendmailTransport()`` with the command as a parameter.
-To use the Sendmail Transport you need to know where ``sendmail`` or another MTA
-exists on the server. Swift Mailer uses a default value of
+To use the Sendmail Transport you need to know where ``sendmail`` or another
+MTA exists on the server. Swift Mailer uses a default value of
``/usr/sbin/sendmail``, which should work on most systems.
You specify the entire command as a parameter (i.e. including the command line
@@ -294,64 +245,20 @@ flags). Swift Mailer supports operational modes of "``-bs``" (default) and
If you run sendmail in "``-t``" mode you will get no feedback as to whether
or not sending has succeeded. Use "``-bs``" unless you have a reason not to.
-To use the Sendmail Transport:
-
-* Call ``Swift_SendmailTransport::newInstance()`` with the command, including
- the correct command line flags. The default is to use ``/usr/sbin/sendmail
- -bs`` if this is not specified.
-
-* Use the returned object to create the Mailer.
-
A sendmail process will be started upon the first call to ``send()``. If the
process cannot be started successfully an Exception of type
-``Swift_TransportException`` will be thrown.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+``Swift_TransportException`` will be thrown::
// Create the Transport
- $transport = Swift_SendmailTransport::newInstance('/usr/sbin/exim -bs');
+ $transport = new Swift_SendmailTransport('/usr/sbin/exim -bs');
// Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
-
-The Mail Transport
-..................
-
-The Mail Transport sends messages by delegating to PHP's internal
-``mail()`` function.
-
-In my experience -- and others' -- the ``mail()`` function is not particularly
-predictable, or helpful.
-
-Quite notably, the ``mail()`` function behaves entirely differently between
-Linux and Windows servers. On linux it uses ``sendmail``, but on Windows it uses
-SMTP.
-
-In order for the ``mail()`` function to even work at all ``php.ini`` needs to be
-configured correctly, specifying the location of sendmail or of an SMTP server.
-
-The problem with ``mail()`` is that it "tries" to simplify things to the point
-that it actually makes things more complex due to poor interface design. The
-developers of Swift Mailer have gone to a lot of effort to make the Mail
-Transport work with a reasonable degree of consistency.
-
-Serious drawbacks when using this Transport are:
-
-* Unpredictable message headers
-
-* Lack of feedback regarding delivery failures
-
-* Lack of support for several plugins that require real-time delivery feedback
-
-It's a last resort, and we say that with a passion!
+ $mailer = new Swift_Mailer($transport);
Available Methods for Sending Messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-The Mailer class offers two methods for sending Messages -- ``send()``.
-Each behaves in a slightly different way.
+The Mailer class offers one method for sending Messages -- ``send()``.
When a message is sent in Swift Mailer, the Mailer class communicates with
whichever Transport class you have chosen to use.
@@ -359,8 +266,8 @@ whichever Transport class you have chosen to use.
Each recipient in the message should either be accepted or rejected by the
Transport. For example, if the domain name on the email address is not
reachable the SMTP Transport may reject the address because it cannot process
-it. Whichever method you use -- ``send()`` -- Swift Mailer will return
-an integer indicating the number of accepted recipients.
+it. ``send()`` will return an integer indicating the number of accepted
+recipients.
.. note::
@@ -374,40 +281,23 @@ The ``send()`` method of the ``Swift_Mailer`` class sends a message using
exactly the same logic as your Desktop mail client would use. Just pass it a
Message and get a result.
-To send a Message with ``send()``:
-
-* Create a Transport from one of the provided Transports --
- ``Swift_SmtpTransport``, ``Swift_SendmailTransport``,
- or one of the aggregate Transports.
-
-* Create an instance of the ``Swift_Mailer`` class, using the Transport as
- it's constructor parameter.
-
-* Create a Message.
-
-* Send the message via the ``send()`` method on the Mailer object.
-
The message will be sent just like it would be sent if you used your mail
client. An integer is returned which includes the number of successful
recipients. If none of the recipients could be sent to then zero will be
returned, which equates to a boolean ``false``. If you set two
``To:`` recipients and three ``Bcc:`` recipients in the message and all of the
-recipients are delivered to successfully then the value 5 will be returned.
-
-.. code-block:: php
-
- require_once 'lib/swift_required.php';
+recipients are delivered to successfully then the value 5 will be returned::
// Create the Transport
- $transport = Swift_SmtpTransport::newInstance('localhost', 25);
+ $transport = new Swift_SmtpTransport('localhost', 25);
// Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
+ $mailer = new Swift_Mailer($transport);
// Create a message
- $message = Swift_Message::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself')
;
@@ -433,8 +323,8 @@ recipients are delivered to successfully then the value 5 will be returned.
Sending Emails in Batch
.......................
-If you want to send a separate message to each recipient so that only their
-own address shows up in the ``To:`` field, follow the following recipe:
+If you want to send a separate message to each recipient so that only their own
+address shows up in the ``To:`` field, follow the following recipe:
* Create a Transport from one of the provided Transports --
``Swift_SmtpTransport``, ``Swift_SendmailTransport``,
@@ -457,10 +347,11 @@ Mailer will throw a ``Swift_RfcComplianceException``.
If you add recipients automatically based on a data source that may contain
invalid email addresses, you can prevent possible exceptions by validating the
-addresses using ``Swift_Validate::email($email)`` and only adding addresses
-that validate. Another way would be to wrap your ``setTo()``, ``setCc()`` and
-``setBcc()`` calls in a try-catch block and handle the
-``Swift_RfcComplianceException`` in the catch block.
+addresses using ``Egulias\EmailValidator\EmailValidator`` (a dependency that is
+installed with Swift Mailer) and only adding addresses that validate. Another
+way would be to wrap your ``setTo()``, ``setCc()`` and ``setBcc()`` calls in a
+try-catch block and handle the ``Swift_RfcComplianceException`` in the catch
+block.
Handling invalid addresses properly is especially important when sending emails
in large batches since a single invalid address might cause an unhandled
@@ -470,35 +361,31 @@ exception and stop the execution or your script early.
In the following example, two emails are sent. One to each of
``receiver@domain.org`` and ``other@domain.org``. These recipients will
- not be aware of each other.
-
- .. code-block:: php
-
- require_once 'lib/swift_required.php';
+ not be aware of each other::
// Create the Transport
- $transport = Swift_SmtpTransport::newInstance('localhost', 25);
+ $transport = new Swift_SmtpTransport('localhost', 25);
// Create the Mailer using your created Transport
- $mailer = Swift_Mailer::newInstance($transport);
+ $mailer = new Swift_Mailer($transport);
// Create a message
- $message = Swift_Message::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
->setBody('Here is the message itself')
;
// Send the message
- $failedRecipients = array();
+ $failedRecipients = [];
$numSent = 0;
- $to = array('receiver@domain.org', 'other@domain.org' => 'A name');
+ $to = ['receiver@domain.org', 'other@domain.org' => 'A name'];
foreach ($to as $address => $name)
{
if (is_int($address)) {
$message->setTo($name);
} else {
- $message->setTo(array($address => $name));
+ $message->setTo([$address => $name]);
}
$numSent += $mailer->send($message, $failedRecipients);
@@ -509,8 +396,8 @@ exception and stop the execution or your script early.
Finding out Rejected Addresses
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-It's possible to get a list of addresses that were rejected by the Transport
-by using a by-reference parameter to ``send()``.
+It's possible to get a list of addresses that were rejected by the Transport by
+using a by-reference parameter to ``send()``.
As Swift Mailer attempts to send the message to each address given to it, if a
recipient is rejected it will be added to the array. You can pass an existing
@@ -524,12 +411,34 @@ Getting Failures By-reference
.............................
Collecting delivery failures by-reference with the ``send()`` method is as
-simple as passing a variable name to the method call.
+simple as passing a variable name to the method call::
+
+ $mailer = new Swift_Mailer( ... );
+
+ $message = (new Swift_Message( ... ))
+ ->setFrom( ... )
+ ->setTo([
+ 'receiver@bad-domain.org' => 'Receiver Name',
+ 'other@domain.org' => 'A name',
+ 'other-receiver@bad-domain.org' => 'Other Name'
+ ))
+ ->setBody( ... )
+ ;
-To get failed recipients by-reference:
+ // Pass a variable name to the send() method
+ if (!$mailer->send($message, $failures))
+ {
+ echo "Failures:";
+ print_r($failures);
+ }
-* Pass a by-reference variable name to the ``send()`` method of the Mailer
- class.
+ /*
+ Failures:
+ Array (
+ 0 => receiver@bad-domain.org,
+ 1 => other-receiver@bad-domain.org
+ )
+ */
If the Transport rejects any of the recipients, the culprit addresses will be
added to the array provided by-reference.
@@ -541,31 +450,4 @@ added to the array provided by-reference.
already exists it will be type-cast to an array and failures will be added
to it.
- .. code-block:: php
-
- $mailer = Swift_Mailer::newInstance( ... );
-
- $message = Swift_Message::newInstance( ... )
- ->setFrom( ... )
- ->setTo(array(
- 'receiver@bad-domain.org' => 'Receiver Name',
- 'other@domain.org' => 'A name',
- 'other-receiver@bad-domain.org' => 'Other Name'
- ))
- ->setBody( ... )
- ;
-
- // Pass a variable name to the send() method
- if (!$mailer->send($message, $failures))
- {
- echo "Failures:";
- print_r($failures);
- }
-
- /*
- Failures:
- Array (
- 0 => receiver@bad-domain.org,
- 1 => other-receiver@bad-domain.org
- )
- */
+.. _Mailcatcher: https://mailcatcher.me/
diff --git a/vendor/swiftmailer/swiftmailer/doc/uml/Encoders.graffle b/vendor/swiftmailer/swiftmailer/doc/uml/Encoders.graffle
deleted file mode 100644
index f895752b70..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/uml/Encoders.graffle
+++ /dev/null
Binary files differ
diff --git a/vendor/swiftmailer/swiftmailer/doc/uml/Mime.graffle b/vendor/swiftmailer/swiftmailer/doc/uml/Mime.graffle
deleted file mode 100644
index e1e33cbf16..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/uml/Mime.graffle
+++ /dev/null
Binary files differ
diff --git a/vendor/swiftmailer/swiftmailer/doc/uml/Transports.graffle b/vendor/swiftmailer/swiftmailer/doc/uml/Transports.graffle
deleted file mode 100644
index 5670e2b65a..0000000000
--- a/vendor/swiftmailer/swiftmailer/doc/uml/Transports.graffle
+++ /dev/null
Binary files differ
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
index 82c381b73d..93e596cea2 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift.php
@@ -11,16 +11,14 @@
/**
* General utility class in Swift Mailer, not to be instantiated.
*
- *
* @author Chris Corbyn
*/
abstract class Swift
{
- /** Swift Mailer Version number generated during dist release process */
- const VERSION = '@SWIFT_VERSION_NUMBER@';
+ const VERSION = '6.1.3';
public static $initialized = false;
- public static $inits = array();
+ public static $inits = [];
/**
* Registers an initializer callable that will be called the first time
@@ -75,6 +73,6 @@ abstract class Swift
if (null !== $callable) {
self::$inits[] = $callable;
}
- spl_autoload_register(array('Swift', 'autoload'));
+ spl_autoload_register(['Swift', 'autoload']);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder.php
new file mode 100644
index 0000000000..7ec3e90b43
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder.php
@@ -0,0 +1,25 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Email address encoder.
+ *
+ * @author Christian Schmidt
+ */
+interface Swift_AddressEncoder
+{
+ /**
+ * Encodes an email address.
+ *
+ * @throws Swift_AddressEncoderException If the email cannot be represented in
+ * the encoding implemented by this class.
+ */
+ public function encodeString(string $address): string;
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php
new file mode 100644
index 0000000000..56935b13e7
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/IdnAddressEncoder.php
@@ -0,0 +1,69 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * An IDN email address encoder.
+ *
+ * Encodes the domain part of an address using IDN. This is compatible will all
+ * SMTP servers.
+ *
+ * This encoder does not support email addresses with non-ASCII characters in
+ * local-part (the substring before @). To send to such addresses, use
+ * Swift_AddressEncoder_Utf8AddressEncoder together with
+ * Swift_Transport_Esmtp_SmtpUtf8Handler. Your outbound SMTP server must support
+ * the SMTPUTF8 extension.
+ *
+ * @author Christian Schmidt
+ */
+class Swift_AddressEncoder_IdnAddressEncoder implements Swift_AddressEncoder
+{
+ /**
+ * Encodes the domain part of an address using IDN.
+ *
+ * @throws Swift_AddressEncoderException If local-part contains non-ASCII characters,
+ * or if no suitable IDN encoder is installed.
+ */
+ public function encodeString(string $address): string
+ {
+ $i = strrpos($address, '@');
+ if (false !== $i) {
+ $local = substr($address, 0, $i);
+ $domain = substr($address, $i + 1);
+
+ if (preg_match('/[^\x00-\x7F]/', $local)) {
+ throw new Swift_AddressEncoderException('Non-ASCII characters not supported in local-part', $address);
+ }
+
+ if (preg_match('/[^\x00-\x7F]/', $domain)) {
+ $address = sprintf('%s@%s', $local, $this->idnToAscii($domain));
+ }
+ }
+
+ return $address;
+ }
+
+ /**
+ * IDN-encodes a UTF-8 string to ASCII.
+ */
+ protected function idnToAscii(string $string): string
+ {
+ if (function_exists('idn_to_ascii')) {
+ return idn_to_ascii($string, 0, INTL_IDNA_VARIANT_UTS46);
+ }
+
+ if (class_exists('TrueBV\Punycode')) {
+ $punycode = new \TrueBV\Punycode();
+
+ return $punycode->encode($string);
+ }
+
+ throw new Swift_AddressEncoderException('Non-ASCII characters in address, but no IDN encoder found (install the intl extension or the true/punycode package)', $string);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/Utf8AddressEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/Utf8AddressEncoder.php
new file mode 100644
index 0000000000..1b45430567
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoder/Utf8AddressEncoder.php
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * A UTF-8 email address encoder.
+ *
+ * Returns the email address verbatimly in UTF-8 as permitted by RFC 6531 and
+ * RFC 6532. It supports addresses containing non-ASCII characters in both
+ * local-part and domain (i.e. on both sides of @).
+ *
+ * This encoder must be used together with Swift_Transport_Esmtp_SmtpUtf8Handler
+ * and requires that the outbound SMTP server supports the SMTPUTF8 extension.
+ *
+ * If your outbound SMTP server does not support SMTPUTF8, use
+ * Swift_AddressEncoder_IdnAddressEncoder instead. This allows sending to email
+ * addresses with non-ASCII characters in the domain, but not in local-part.
+ *
+ * @author Christian Schmidt
+ */
+class Swift_AddressEncoder_Utf8AddressEncoder implements Swift_AddressEncoder
+{
+ /**
+ * Returns the address verbatimly.
+ */
+ public function encodeString(string $address): string
+ {
+ return $address;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoderException.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoderException.php
new file mode 100644
index 0000000000..9b405476bc
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/AddressEncoderException.php
@@ -0,0 +1,32 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * AddressEncoderException when the specified email address is in a format that
+ * cannot be encoded by a given address encoder.
+ *
+ * @author Christian Schmidt
+ */
+class Swift_AddressEncoderException extends Swift_RfcComplianceException
+{
+ protected $address;
+
+ public function __construct(string $message, string $address)
+ {
+ parent::__construct($message);
+
+ $this->address = $address;
+ }
+
+ public function getAddress(): string
+ {
+ return $this->address;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php
index a95bccfdf9..79aac6a051 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Attachment.php
@@ -9,7 +9,7 @@
*/
/**
- * Attachment class for attaching files to a {@link Swift_Mime_Message}.
+ * Attachment class for attaching files to a {@link Swift_Mime_SimpleMessage}.
*
* @author Chris Corbyn
*/
@@ -27,30 +27,13 @@ class Swift_Attachment extends Swift_Mime_Attachment
public function __construct($data = null, $filename = null, $contentType = null)
{
call_user_func_array(
- array($this, 'Swift_Mime_Attachment::__construct'),
+ [$this, 'Swift_Mime_Attachment::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.attachment')
);
- $this->setBody($data);
+ $this->setBody($data, $contentType);
$this->setFilename($filename);
- if ($contentType) {
- $this->setContentType($contentType);
- }
- }
-
- /**
- * Create a new Attachment.
- *
- * @param string|Swift_OutputByteStream $data
- * @param string $filename
- * @param string $contentType
- *
- * @return Swift_Mime_Attachment
- */
- public static function newInstance($data = null, $filename = null, $contentType = null)
- {
- return new self($data, $filename, $contentType);
}
/**
@@ -63,9 +46,9 @@ class Swift_Attachment extends Swift_Mime_Attachment
*/
public static function fromPath($path, $contentType = null)
{
- return self::newInstance()->setFile(
+ return (new self())->setFile(
new Swift_ByteStream_FileByteStream($path),
$contentType
- );
+ );
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
index a7b0e3a620..3a69c15f1c 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
@@ -18,48 +18,47 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
/**
* Write sequence.
*/
- protected $_sequence = 0;
+ protected $sequence = 0;
/**
* StreamFilters.
*
* @var Swift_StreamFilter[]
*/
- private $_filters = array();
+ private $filters = [];
/**
* A buffer for writing.
*/
- private $_writeBuffer = '';
+ private $writeBuffer = '';
/**
* Bound streams.
*
* @var Swift_InputByteStream[]
*/
- private $_mirrors = array();
+ private $mirrors = [];
/**
* Commit the given bytes to the storage medium immediately.
*
* @param string $bytes
*/
- abstract protected function _commit($bytes);
+ abstract protected function doCommit($bytes);
/**
* Flush any buffers/content with immediate effect.
*/
- abstract protected function _flush();
+ abstract protected function flush();
/**
* Add a StreamFilter to this InputByteStream.
*
- * @param Swift_StreamFilter $filter
- * @param string $key
+ * @param string $key
*/
public function addFilter(Swift_StreamFilter $filter, $key)
{
- $this->_filters[$key] = $filter;
+ $this->filters[$key] = $filter;
}
/**
@@ -69,7 +68,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function removeFilter($key)
{
- unset($this->_filters[$key]);
+ unset($this->filters[$key]);
}
/**
@@ -83,15 +82,15 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function write($bytes)
{
- $this->_writeBuffer .= $bytes;
- foreach ($this->_filters as $filter) {
- if ($filter->shouldBuffer($this->_writeBuffer)) {
+ $this->writeBuffer .= $bytes;
+ foreach ($this->filters as $filter) {
+ if ($filter->shouldBuffer($this->writeBuffer)) {
return;
}
}
- $this->_doWrite($this->_writeBuffer);
+ $this->doWrite($this->writeBuffer);
- return ++$this->_sequence;
+ return ++$this->sequence;
}
/**
@@ -102,7 +101,7 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function commit()
{
- $this->_doWrite($this->_writeBuffer);
+ $this->doWrite($this->writeBuffer);
}
/**
@@ -110,12 +109,10 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
- $this->_mirrors[] = $is;
+ $this->mirrors[] = $is;
}
/**
@@ -124,17 +121,15 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
- foreach ($this->_mirrors as $k => $stream) {
+ foreach ($this->mirrors as $k => $stream) {
if ($is === $stream) {
- if ($this->_writeBuffer !== '') {
- $stream->write($this->_writeBuffer);
+ if ('' !== $this->writeBuffer) {
+ $stream->write($this->writeBuffer);
}
- unset($this->_mirrors[$k]);
+ unset($this->mirrors[$k]);
}
}
}
@@ -147,20 +142,20 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
*/
public function flushBuffers()
{
- if ($this->_writeBuffer !== '') {
- $this->_doWrite($this->_writeBuffer);
+ if ('' !== $this->writeBuffer) {
+ $this->doWrite($this->writeBuffer);
}
- $this->_flush();
+ $this->flush();
- foreach ($this->_mirrors as $stream) {
+ foreach ($this->mirrors as $stream) {
$stream->flushBuffers();
}
}
/** Run $bytes through all filters */
- private function _filter($bytes)
+ private function filter($bytes)
{
- foreach ($this->_filters as $filter) {
+ foreach ($this->filters as $filter) {
$bytes = $filter->filter($bytes);
}
@@ -168,14 +163,14 @@ abstract class Swift_ByteStream_AbstractFilterableInputStream implements Swift_I
}
/** Just write the bytes to the stream */
- private function _doWrite($bytes)
+ private function doWrite($bytes)
{
- $this->_commit($this->_filter($bytes));
+ $this->doCommit($this->filter($bytes));
- foreach ($this->_mirrors as $stream) {
+ foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
- $this->_writeBuffer = '';
+ $this->writeBuffer = '';
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
index ef05a6d5e6..68dc3b1eca 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php
@@ -11,7 +11,7 @@
/**
* Allows reading and writing of bytes to and from an array.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_OutputByteStream
{
@@ -20,28 +20,28 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* @var string[]
*/
- private $_array = array();
+ private $array = [];
/**
* The size of the stack.
*
* @var int
*/
- private $_arraySize = 0;
+ private $arraySize = 0;
/**
* The internal pointer offset.
*
* @var int
*/
- private $_offset = 0;
+ private $offset = 0;
/**
* Bound streams.
*
* @var Swift_InputByteStream[]
*/
- private $_mirrors = array();
+ private $mirrors = [];
/**
* Create a new ArrayByteStream.
@@ -53,12 +53,12 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
public function __construct($stack = null)
{
if (is_array($stack)) {
- $this->_array = $stack;
- $this->_arraySize = count($stack);
+ $this->array = $stack;
+ $this->arraySize = count($stack);
} elseif (is_string($stack)) {
$this->write($stack);
} else {
- $this->_array = array();
+ $this->array = [];
}
}
@@ -76,16 +76,16 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*/
public function read($length)
{
- if ($this->_offset == $this->_arraySize) {
+ if ($this->offset == $this->arraySize) {
return false;
}
// Don't use array slice
- $end = $length + $this->_offset;
- $end = $this->_arraySize < $end ? $this->_arraySize : $end;
+ $end = $length + $this->offset;
+ $end = $this->arraySize < $end ? $this->arraySize : $end;
$ret = '';
- for (; $this->_offset < $end; ++$this->_offset) {
- $ret .= $this->_array[$this->_offset];
+ for (; $this->offset < $end; ++$this->offset) {
+ $ret .= $this->array[$this->offset];
}
return $ret;
@@ -100,11 +100,11 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
{
$to_add = str_split($bytes);
foreach ($to_add as $value) {
- $this->_array[] = $value;
+ $this->array[] = $value;
}
- $this->_arraySize = count($this->_array);
+ $this->arraySize = count($this->array);
- foreach ($this->_mirrors as $stream) {
+ foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
}
@@ -121,12 +121,10 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
- $this->_mirrors[] = $is;
+ $this->mirrors[] = $is;
}
/**
@@ -135,14 +133,12 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
- foreach ($this->_mirrors as $k => $stream) {
+ foreach ($this->mirrors as $k => $stream) {
if ($is === $stream) {
- unset($this->_mirrors[$k]);
+ unset($this->mirrors[$k]);
}
}
}
@@ -156,13 +152,13 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*/
public function setReadPointer($byteOffset)
{
- if ($byteOffset > $this->_arraySize) {
- $byteOffset = $this->_arraySize;
+ if ($byteOffset > $this->arraySize) {
+ $byteOffset = $this->arraySize;
} elseif ($byteOffset < 0) {
$byteOffset = 0;
}
- $this->_offset = $byteOffset;
+ $this->offset = $byteOffset;
}
/**
@@ -171,11 +167,11 @@ class Swift_ByteStream_ArrayByteStream implements Swift_InputByteStream, Swift_O
*/
public function flushBuffers()
{
- $this->_offset = 0;
- $this->_array = array();
- $this->_arraySize = 0;
+ $this->offset = 0;
+ $this->array = [];
+ $this->arraySize = 0;
- foreach ($this->_mirrors as $stream) {
+ foreach ($this->mirrors as $stream) {
$stream->flushBuffers();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
index 9ed8523107..0c428f7966 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php
@@ -11,30 +11,27 @@
/**
* Allows reading and writing of bytes to and from a file.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_FileStream
{
/** The internal pointer offset */
- private $_offset = 0;
+ private $offset = 0;
/** The path to the file */
- private $_path;
+ private $path;
/** The mode this file is opened in for writing */
- private $_mode;
+ private $mode;
/** A lazy-loaded resource handle for reading the file */
- private $_reader;
+ private $reader;
/** A lazy-loaded resource handle for writing the file */
- private $_writer;
-
- /** If magic_quotes_runtime is on, this will be true */
- private $_quotes = false;
+ private $writer;
/** If stream is seekable true/false, or null if not known */
- private $_seekable = null;
+ private $seekable = null;
/**
* Create a new FileByteStream for $path.
@@ -47,12 +44,8 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
if (empty($path)) {
throw new Swift_IoException('The path cannot be empty');
}
- $this->_path = $path;
- $this->_mode = $writable ? 'w+b' : 'rb';
-
- if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {
- $this->_quotes = true;
- }
+ $this->path = $path;
+ $this->mode = $writable ? 'w+b' : 'rb';
}
/**
@@ -62,7 +55,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
*/
public function getPath()
{
- return $this->_path;
+ return $this->path;
}
/**
@@ -75,27 +68,21 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
*
* @param int $length
*
- * @throws Swift_IoException
- *
* @return string|bool
+ *
+ * @throws Swift_IoException
*/
public function read($length)
{
- $fp = $this->_getReadHandle();
+ $fp = $this->getReadHandle();
if (!feof($fp)) {
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 0);
- }
$bytes = fread($fp, $length);
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 1);
- }
- $this->_offset = ftell($fp);
+ $this->offset = ftell($fp);
// If we read one byte after reaching the end of the file
// feof() will return false and an empty string is returned
- if ($bytes === '' && feof($fp)) {
- $this->_resetReadHandle();
+ if ('' === $bytes && feof($fp)) {
+ $this->resetReadHandle();
return false;
}
@@ -103,7 +90,7 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
return $bytes;
}
- $this->_resetReadHandle();
+ $this->resetReadHandle();
return false;
}
@@ -117,95 +104,93 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
*/
public function setReadPointer($byteOffset)
{
- if (isset($this->_reader)) {
- $this->_seekReadStreamToPosition($byteOffset);
+ if (isset($this->reader)) {
+ $this->seekReadStreamToPosition($byteOffset);
}
- $this->_offset = $byteOffset;
+ $this->offset = $byteOffset;
}
/** Just write the bytes to the file */
- protected function _commit($bytes)
+ protected function doCommit($bytes)
{
- fwrite($this->_getWriteHandle(), $bytes);
- $this->_resetReadHandle();
+ fwrite($this->getWriteHandle(), $bytes);
+ $this->resetReadHandle();
}
/** Not used */
- protected function _flush()
+ protected function flush()
{
}
/** Get the resource for reading */
- private function _getReadHandle()
+ private function getReadHandle()
{
- if (!isset($this->_reader)) {
- $pointer = @fopen($this->_path, 'rb');
+ if (!isset($this->reader)) {
+ $pointer = @fopen($this->path, 'rb');
if (!$pointer) {
- throw new Swift_IoException(
- 'Unable to open file for reading ['.$this->_path.']'
- );
+ throw new Swift_IoException('Unable to open file for reading ['.$this->path.']');
}
- $this->_reader = $pointer;
- if ($this->_offset != 0) {
- $this->_getReadStreamSeekableStatus();
- $this->_seekReadStreamToPosition($this->_offset);
+ $this->reader = $pointer;
+ if (0 != $this->offset) {
+ $this->getReadStreamSeekableStatus();
+ $this->seekReadStreamToPosition($this->offset);
}
}
- return $this->_reader;
+ return $this->reader;
}
/** Get the resource for writing */
- private function _getWriteHandle()
+ private function getWriteHandle()
{
- if (!isset($this->_writer)) {
- if (!$this->_writer = fopen($this->_path, $this->_mode)) {
+ if (!isset($this->writer)) {
+ if (!$this->writer = fopen($this->path, $this->mode)) {
throw new Swift_IoException(
- 'Unable to open file for writing ['.$this->_path.']'
+ 'Unable to open file for writing ['.$this->path.']'
);
}
}
- return $this->_writer;
+ return $this->writer;
}
/** Force a reload of the resource for reading */
- private function _resetReadHandle()
+ private function resetReadHandle()
{
- if (isset($this->_reader)) {
- fclose($this->_reader);
- $this->_reader = null;
+ if (isset($this->reader)) {
+ fclose($this->reader);
+ $this->reader = null;
}
}
/** Check if ReadOnly Stream is seekable */
- private function _getReadStreamSeekableStatus()
+ private function getReadStreamSeekableStatus()
{
- $metas = stream_get_meta_data($this->_reader);
- $this->_seekable = $metas['seekable'];
+ $metas = stream_get_meta_data($this->reader);
+ $this->seekable = $metas['seekable'];
}
/** Streams in a readOnly stream ensuring copy if needed */
- private function _seekReadStreamToPosition($offset)
+ private function seekReadStreamToPosition($offset)
{
- if ($this->_seekable === null) {
- $this->_getReadStreamSeekableStatus();
+ if (null === $this->seekable) {
+ $this->getReadStreamSeekableStatus();
}
- if ($this->_seekable === false) {
- $currentPos = ftell($this->_reader);
+ if (false === $this->seekable) {
+ $currentPos = ftell($this->reader);
if ($currentPos < $offset) {
$toDiscard = $offset - $currentPos;
- fread($this->_reader, $toDiscard);
+ fread($this->reader, $toDiscard);
return;
}
- $this->_copyReadStream();
+ $this->copyReadStream();
}
- fseek($this->_reader, $offset, SEEK_SET);
+ fseek($this->reader, $offset, SEEK_SET);
}
/** Copy a readOnly Stream to ensure seekability */
- private function _copyReadStream()
+ private function copyReadStream()
{
if ($tmpFile = fopen('php://temp/maxmemory:4096', 'w+b')) {
/* We have opened a php:// Stream Should work without problem */
@@ -214,11 +199,11 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
} else {
throw new Swift_IoException('Unable to copy the file to make it seekable, sys_temp_dir is not writable, php://memory not available');
}
- $currentPos = ftell($this->_reader);
- fclose($this->_reader);
- $source = fopen($this->_path, 'rb');
+ $currentPos = ftell($this->reader);
+ fclose($this->reader);
+ $source = fopen($this->path, 'rb');
if (!$source) {
- throw new Swift_IoException('Unable to open file for copying ['.$this->_path.']');
+ throw new Swift_IoException('Unable to open file for copying ['.$this->path.']');
}
fseek($tmpFile, 0, SEEK_SET);
while (!feof($source)) {
@@ -226,6 +211,6 @@ class Swift_ByteStream_FileByteStream extends Swift_ByteStream_AbstractFilterabl
}
fseek($tmpFile, $currentPos, SEEK_SET);
fclose($source);
- $this->_reader = $tmpFile;
+ $this->reader = $tmpFile;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
index 1c9a80c037..2d00b6a0f6 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ByteStream/TemporaryFileByteStream.php
@@ -17,7 +17,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
{
$filePath = tempnam(sys_get_temp_dir(), 'FileByteStream');
- if ($filePath === false) {
+ if (false === $filePath) {
throw new Swift_IoException('Failed to retrieve temporary file name.');
}
@@ -26,7 +26,7 @@ class Swift_ByteStream_TemporaryFileByteStream extends Swift_ByteStream_FileByte
public function getContent()
{
- if (($content = file_get_contents($this->getPath())) === false) {
+ if (false === ($content = file_get_contents($this->getPath()))) {
throw new Swift_IoException('Failed to get temporary file content.');
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
index 6a18e1dd1f..b09bb5b6c3 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php
@@ -11,8 +11,8 @@
/**
* Provides fixed-width byte sizes for reading fixed-width character sets.
*
- * @author Chris Corbyn
- * @author Xavier De Cock <xdecock@gmail.com>
+ * @author Chris Corbyn
+ * @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterReader
{
@@ -21,7 +21,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
*
* @var int
*/
- private $_width;
+ private $width;
/**
* Creates a new GenericFixedWidthReader using $width bytes per character.
@@ -30,7 +30,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
*/
public function __construct($width)
{
- $this->_width = $width;
+ $this->width = $width;
}
/**
@@ -47,11 +47,11 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
{
$strlen = strlen($string);
// % and / are CPU intensive, so, maybe find a better way
- $ignored = $strlen % $this->_width;
+ $ignored = $strlen % $this->width;
$ignoredChars = $ignored ? substr($string, -$ignored) : '';
- $currentMap = $this->_width;
+ $currentMap = $this->width;
- return ($strlen - $ignored) / $this->_width;
+ return ($strlen - $ignored) / $this->width;
}
/**
@@ -80,7 +80,7 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
*/
public function validateByteSequence($bytes, $size)
{
- $needed = $this->_width - $size;
+ $needed = $this->width - $size;
return $needed > -1 ? $needed : -1;
}
@@ -92,6 +92,6 @@ class Swift_CharacterReader_GenericFixedWidthReader implements Swift_CharacterRe
*/
public function getInitialByteSize()
{
- return $this->_width;
+ return $this->width;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
index 22746bd857..4a2df31db3 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReader/Utf8Reader.php
@@ -17,7 +17,7 @@
class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
{
/** Pre-computed for optimization */
- private static $length_map = array(
+ private static $length_map = [
// 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
@@ -35,9 +35,9 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
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(
+ private static $s_length_map = [
"\x00" => 1, "\x01" => 1, "\x02" => 1, "\x03" => 1, "\x04" => 1, "\x05" => 1, "\x06" => 1, "\x07" => 1,
"\x08" => 1, "\x09" => 1, "\x0a" => 1, "\x0b" => 1, "\x0c" => 1, "\x0d" => 1, "\x0e" => 1, "\x0f" => 1,
"\x10" => 1, "\x11" => 1, "\x12" => 1, "\x13" => 1, "\x14" => 1, "\x15" => 1, "\x16" => 1, "\x17" => 1,
@@ -70,7 +70,7 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
"\xe8" => 3, "\xe9" => 3, "\xea" => 3, "\xeb" => 3, "\xec" => 3, "\xed" => 3, "\xee" => 3, "\xef" => 3,
"\xf0" => 4, "\xf1" => 4, "\xf2" => 4, "\xf3" => 4, "\xf4" => 4, "\xf5" => 4, "\xf6" => 4, "\xf7" => 4,
"\xf8" => 5, "\xf9" => 5, "\xfa" => 5, "\xfb" => 5, "\xfc" => 6, "\xfd" => 6, "\xfe" => 0, "\xff" => 0,
- );
+ ];
/**
* Returns the complete character map.
@@ -85,7 +85,7 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars)
{
if (!isset($currentMap['i']) || !isset($currentMap['p'])) {
- $currentMap['p'] = $currentMap['i'] = array();
+ $currentMap['p'] = $currentMap['i'] = [];
}
$strlen = strlen($string);
@@ -95,12 +95,12 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
for ($i = 0; $i < $strlen; ++$i) {
$char = $string[$i];
$size = self::$s_length_map[$char];
- if ($size == 0) {
+ if (0 == $size) {
/* char is invalid, we must wait for a resync */
$invalid = true;
continue;
} else {
- if ($invalid == true) {
+ if (true === $invalid) {
/* We mark the chars as invalid and start a new char */
$currentMap['p'][$charPos + $foundChars] = $startOffset + $i;
$currentMap['i'][$charPos + $foundChars] = true;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
index 9171a0bacb..78fffa9870 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
@@ -20,14 +20,14 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
*
* @var array
*/
- private static $_map = array();
+ private static $map = [];
/**
* Factories which have already been loaded.
*
* @var Swift_CharacterReaderFactory[]
*/
- private static $_loaded = array();
+ private static $loaded = [];
/**
* Creates a new CharacterReaderFactory.
@@ -44,54 +44,54 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
public function init()
{
- if (count(self::$_map) > 0) {
+ if (count(self::$map) > 0) {
return;
}
$prefix = 'Swift_CharacterReader_';
- $singleByte = array(
+ $singleByte = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(1),
- );
+ 'constructor' => [1],
+ ];
- $doubleByte = array(
+ $doubleByte = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(2),
- );
+ 'constructor' => [2],
+ ];
- $fourBytes = array(
+ $fourBytes = [
'class' => $prefix.'GenericFixedWidthReader',
- 'constructor' => array(4),
- );
+ 'constructor' => [4],
+ ];
// Utf-8
- self::$_map['utf-?8'] = array(
+ self::$map['utf-?8'] = [
'class' => $prefix.'Utf8Reader',
- 'constructor' => array(),
- );
+ 'constructor' => [],
+ ];
//7-8 bit charsets
- self::$_map['(us-)?ascii'] = $singleByte;
- self::$_map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
- self::$_map['windows-?125[0-9]'] = $singleByte;
- self::$_map['cp-?[0-9]+'] = $singleByte;
- self::$_map['ansi'] = $singleByte;
- self::$_map['macintosh'] = $singleByte;
- self::$_map['koi-?7'] = $singleByte;
- self::$_map['koi-?8-?.+'] = $singleByte;
- self::$_map['mik'] = $singleByte;
- self::$_map['(cork|t1)'] = $singleByte;
- self::$_map['v?iscii'] = $singleByte;
+ self::$map['(us-)?ascii'] = $singleByte;
+ self::$map['(iso|iec)-?8859-?[0-9]+'] = $singleByte;
+ self::$map['windows-?125[0-9]'] = $singleByte;
+ self::$map['cp-?[0-9]+'] = $singleByte;
+ self::$map['ansi'] = $singleByte;
+ self::$map['macintosh'] = $singleByte;
+ self::$map['koi-?7'] = $singleByte;
+ self::$map['koi-?8-?.+'] = $singleByte;
+ self::$map['mik'] = $singleByte;
+ self::$map['(cork|t1)'] = $singleByte;
+ self::$map['v?iscii'] = $singleByte;
//16 bits
- self::$_map['(ucs-?2|utf-?16)'] = $doubleByte;
+ self::$map['(ucs-?2|utf-?16)'] = $doubleByte;
//32 bits
- self::$_map['(ucs-?4|utf-?32)'] = $fourBytes;
+ self::$map['(ucs-?4|utf-?32)'] = $fourBytes;
// Fallback
- self::$_map['.*'] = $singleByte;
+ self::$map['.*'] = $singleByte;
}
/**
@@ -103,21 +103,21 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactory implements Swift
*/
public function getReaderFor($charset)
{
- $charset = trim(strtolower($charset));
- foreach (self::$_map as $pattern => $spec) {
+ $charset = strtolower(trim($charset));
+ foreach (self::$map as $pattern => $spec) {
$re = '/^'.$pattern.'$/D';
if (preg_match($re, $charset)) {
- if (!array_key_exists($pattern, self::$_loaded)) {
+ if (!array_key_exists($pattern, self::$loaded)) {
$reflector = new ReflectionClass($spec['class']);
if ($reflector->getConstructor()) {
$reader = $reflector->newInstanceArgs($spec['constructor']);
} else {
$reader = $reflector->newInstance();
}
- self::$_loaded[$pattern] = $reader;
+ self::$loaded[$pattern] = $reader;
}
- return self::$_loaded[$pattern];
+ return self::$loaded[$pattern];
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
index 7213a40d78..887658c53b 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
@@ -16,28 +16,28 @@
class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStream
{
/** A map of byte values and their respective characters */
- private static $_charMap;
+ private static $charMap;
/** A map of characters and their derivative byte values */
- private static $_byteMap;
+ private static $byteMap;
/** The char reader (lazy-loaded) for the current charset */
- private $_charReader;
+ private $charReader;
/** A factory for creating CharacterReader instances */
- private $_charReaderFactory;
+ private $charReaderFactory;
/** The character set this stream is using */
- private $_charset;
+ private $charset;
/** Array of characters */
- private $_array = array();
+ private $array = [];
/** Size of the array of character */
- private $_array_size = array();
+ private $array_size = [];
/** The current character offset in the stream */
- private $_offset = 0;
+ private $offset = 0;
/**
* Create a new CharacterStream with the given $chars, if set.
@@ -47,7 +47,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
{
- self::_initializeMaps();
+ self::initializeMaps();
$this->setCharacterReaderFactory($factory);
$this->setCharacterSet($charset);
}
@@ -59,18 +59,16 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function setCharacterSet($charset)
{
- $this->_charset = $charset;
- $this->_charReader = null;
+ $this->charset = $charset;
+ $this->charReader = null;
}
/**
* Set the CharacterReaderFactory for multi charset support.
- *
- * @param Swift_CharacterReaderFactory $factory
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
- $this->_charReaderFactory = $factory;
+ $this->charReaderFactory = $factory;
}
/**
@@ -80,28 +78,28 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function importByteStream(Swift_OutputByteStream $os)
{
- if (!isset($this->_charReader)) {
- $this->_charReader = $this->_charReaderFactory
- ->getReaderFor($this->_charset);
+ if (!isset($this->charReader)) {
+ $this->charReader = $this->charReaderFactory
+ ->getReaderFor($this->charset);
}
- $startLength = $this->_charReader->getInitialByteSize();
+ $startLength = $this->charReader->getInitialByteSize();
while (false !== $bytes = $os->read($startLength)) {
- $c = array();
+ $c = [];
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
- $c[] = self::$_byteMap[$bytes[$i]];
+ $c[] = self::$byteMap[$bytes[$i]];
}
$size = count($c);
- $need = $this->_charReader
+ $need = $this->charReader
->validateByteSequence($c, $size);
if ($need > 0 &&
false !== $bytes = $os->read($need)) {
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
- $c[] = self::$_byteMap[$bytes[$i]];
+ $c[] = self::$byteMap[$bytes[$i]];
}
}
- $this->_array[] = $c;
- ++$this->_array_size;
+ $this->array[] = $c;
+ ++$this->array_size;
}
}
@@ -127,20 +125,20 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function read($length)
{
- if ($this->_offset == $this->_array_size) {
+ if ($this->offset == $this->array_size) {
return false;
}
// Don't use array slice
- $arrays = array();
- $end = $length + $this->_offset;
- for ($i = $this->_offset; $i < $end; ++$i) {
- if (!isset($this->_array[$i])) {
+ $arrays = [];
+ $end = $length + $this->offset;
+ for ($i = $this->offset; $i < $end; ++$i) {
+ if (!isset($this->array[$i])) {
break;
}
- $arrays[] = $this->_array[$i];
+ $arrays[] = $this->array[$i];
}
- $this->_offset += $i - $this->_offset; // Limit function calls
+ $this->offset += $i - $this->offset; // Limit function calls
$chars = false;
foreach ($arrays as $array) {
$chars .= implode('', array_map('chr', $array));
@@ -159,20 +157,20 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function readBytes($length)
{
- if ($this->_offset == $this->_array_size) {
+ if ($this->offset == $this->array_size) {
return false;
}
- $arrays = array();
- $end = $length + $this->_offset;
- for ($i = $this->_offset; $i < $end; ++$i) {
- if (!isset($this->_array[$i])) {
+ $arrays = [];
+ $end = $length + $this->offset;
+ for ($i = $this->offset; $i < $end; ++$i) {
+ if (!isset($this->array[$i])) {
break;
}
- $arrays[] = $this->_array[$i];
+ $arrays[] = $this->array[$i];
}
- $this->_offset += ($i - $this->_offset); // Limit function calls
+ $this->offset += ($i - $this->offset); // Limit function calls
- return call_user_func_array('array_merge', $arrays);
+ return array_merge(...$arrays);
}
/**
@@ -182,28 +180,28 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function write($chars)
{
- if (!isset($this->_charReader)) {
- $this->_charReader = $this->_charReaderFactory->getReaderFor(
- $this->_charset);
+ if (!isset($this->charReader)) {
+ $this->charReader = $this->charReaderFactory->getReaderFor(
+ $this->charset);
}
- $startLength = $this->_charReader->getInitialByteSize();
+ $startLength = $this->charReader->getInitialByteSize();
$fp = fopen('php://memory', 'w+b');
fwrite($fp, $chars);
unset($chars);
fseek($fp, 0, SEEK_SET);
- $buffer = array(0);
+ $buffer = [0];
$buf_pos = 1;
$buf_len = 1;
$has_datas = true;
do {
- $bytes = array();
+ $bytes = [];
// Buffer Filing
if ($buf_len - $buf_pos < $startLength) {
$buf = array_splice($buffer, $buf_pos);
- $new = $this->_reloadBuffer($fp, 100);
+ $new = $this->reloadBuffer($fp, 100);
if ($new) {
$buffer = array_merge($buf, $new);
$buf_len = count($buffer);
@@ -218,11 +216,11 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
++$size;
$bytes[] = $buffer[$buf_pos++];
}
- $need = $this->_charReader->validateByteSequence(
+ $need = $this->charReader->validateByteSequence(
$bytes, $size);
if ($need > 0) {
if ($buf_len - $buf_pos < $need) {
- $new = $this->_reloadBuffer($fp, $need);
+ $new = $this->reloadBuffer($fp, $need);
if ($new) {
$buffer = array_merge($buffer, $new);
@@ -233,8 +231,8 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
$bytes[] = $buffer[$buf_pos++];
}
}
- $this->_array[] = $bytes;
- ++$this->_array_size;
+ $this->array[] = $bytes;
+ ++$this->array_size;
}
} while ($has_datas);
@@ -248,12 +246,12 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function setPointer($charOffset)
{
- if ($charOffset > $this->_array_size) {
- $charOffset = $this->_array_size;
+ if ($charOffset > $this->array_size) {
+ $charOffset = $this->array_size;
} elseif ($charOffset < 0) {
$charOffset = 0;
}
- $this->_offset = $charOffset;
+ $this->offset = $charOffset;
}
/**
@@ -261,17 +259,17 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
*/
public function flushContents()
{
- $this->_offset = 0;
- $this->_array = array();
- $this->_array_size = 0;
+ $this->offset = 0;
+ $this->array = [];
+ $this->array_size = 0;
}
- private function _reloadBuffer($fp, $len)
+ private function reloadBuffer($fp, $len)
{
- if (!feof($fp) && ($bytes = fread($fp, $len)) !== false) {
- $buf = array();
+ if (!feof($fp) && false !== ($bytes = fread($fp, $len))) {
+ $buf = [];
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
- $buf[] = self::$_byteMap[$bytes[$i]];
+ $buf[] = self::$byteMap[$bytes[$i]];
}
return $buf;
@@ -280,14 +278,14 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
return false;
}
- private static function _initializeMaps()
+ private static function initializeMaps()
{
- if (!isset(self::$_charMap)) {
- self::$_charMap = array();
+ if (!isset(self::$charMap)) {
+ self::$charMap = [];
for ($byte = 0; $byte < 256; ++$byte) {
- self::$_charMap[$byte] = chr($byte);
+ self::$charMap[$byte] = chr($byte);
}
- self::$_byteMap = array_flip(self::$_charMap);
+ self::$byteMap = array_flip(self::$charMap);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
index 58bd140fd2..a733063c91 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/CharacterStream/NgCharacterStream.php
@@ -11,7 +11,7 @@
/**
* A CharacterStream implementation which stores characters in an internal array.
*
- * @author Xavier De Cock <xdecock@gmail.com>
+ * @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
{
@@ -20,69 +20,68 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*
* @var Swift_CharacterReader
*/
- private $_charReader;
+ private $charReader;
/**
* A factory for creating CharacterReader instances.
*
* @var Swift_CharacterReaderFactory
*/
- private $_charReaderFactory;
+ private $charReaderFactory;
/**
* The character set this stream is using.
*
* @var string
*/
- private $_charset;
+ private $charset;
/**
* The data's stored as-is.
*
* @var string
*/
- private $_datas = '';
+ private $datas = '';
/**
* Number of bytes in the stream.
*
* @var int
*/
- private $_datasSize = 0;
+ private $datasSize = 0;
/**
* Map.
*
* @var mixed
*/
- private $_map;
+ private $map;
/**
* Map Type.
*
* @var int
*/
- private $_mapType = 0;
+ private $mapType = 0;
/**
* Number of characters in the stream.
*
* @var int
*/
- private $_charCount = 0;
+ private $charCount = 0;
/**
* Position in the stream.
*
* @var int
*/
- private $_currentPos = 0;
+ private $currentPos = 0;
/**
* Constructor.
*
- * @param Swift_CharacterReaderFactory $factory
- * @param string $charset
+ * @param string $charset
*/
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
{
@@ -99,19 +98,17 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*/
public function setCharacterSet($charset)
{
- $this->_charset = $charset;
- $this->_charReader = null;
- $this->_mapType = 0;
+ $this->charset = $charset;
+ $this->charReader = null;
+ $this->mapType = 0;
}
/**
* Set the CharacterReaderFactory for multi charset support.
- *
- * @param Swift_CharacterReaderFactory $factory
*/
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
{
- $this->_charReaderFactory = $factory;
+ $this->charReaderFactory = $factory;
}
/**
@@ -119,17 +116,15 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*/
public function flushContents()
{
- $this->_datas = null;
- $this->_map = null;
- $this->_charCount = 0;
- $this->_currentPos = 0;
- $this->_datasSize = 0;
+ $this->datas = null;
+ $this->map = null;
+ $this->charCount = 0;
+ $this->currentPos = 0;
+ $this->datasSize = 0;
}
/**
* @see Swift_CharacterStream::importByteStream()
- *
- * @param Swift_OutputByteStream $os
*/
public function importByteStream(Swift_OutputByteStream $os)
{
@@ -161,49 +156,49 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*/
public function read($length)
{
- if ($this->_currentPos >= $this->_charCount) {
+ if ($this->currentPos >= $this->charCount) {
return false;
}
$ret = false;
- $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length;
- switch ($this->_mapType) {
+ $length = ($this->currentPos + $length > $this->charCount) ? $this->charCount - $this->currentPos : $length;
+ switch ($this->mapType) {
case Swift_CharacterReader::MAP_TYPE_FIXED_LEN:
- $len = $length * $this->_map;
- $ret = substr($this->_datas,
- $this->_currentPos * $this->_map,
+ $len = $length * $this->map;
+ $ret = substr($this->datas,
+ $this->currentPos * $this->map,
$len);
- $this->_currentPos += $length;
+ $this->currentPos += $length;
break;
case Swift_CharacterReader::MAP_TYPE_INVALID:
$ret = '';
- for (; $this->_currentPos < $length; ++$this->_currentPos) {
- if (isset($this->_map[$this->_currentPos])) {
+ for (; $this->currentPos < $length; ++$this->currentPos) {
+ if (isset($this->map[$this->currentPos])) {
$ret .= '?';
} else {
- $ret .= $this->_datas[$this->_currentPos];
+ $ret .= $this->datas[$this->currentPos];
}
}
break;
case Swift_CharacterReader::MAP_TYPE_POSITIONS:
- $end = $this->_currentPos + $length;
- $end = $end > $this->_charCount ? $this->_charCount : $end;
+ $end = $this->currentPos + $length;
+ $end = $end > $this->charCount ? $this->charCount : $end;
$ret = '';
$start = 0;
- if ($this->_currentPos > 0) {
- $start = $this->_map['p'][$this->_currentPos - 1];
+ if ($this->currentPos > 0) {
+ $start = $this->map['p'][$this->currentPos - 1];
}
$to = $start;
- for (; $this->_currentPos < $end; ++$this->_currentPos) {
- if (isset($this->_map['i'][$this->_currentPos])) {
- $ret .= substr($this->_datas, $start, $to - $start).'?';
- $start = $this->_map['p'][$this->_currentPos];
+ for (; $this->currentPos < $end; ++$this->currentPos) {
+ if (isset($this->map['i'][$this->currentPos])) {
+ $ret .= substr($this->datas, $start, $to - $start).'?';
+ $start = $this->map['p'][$this->currentPos];
} else {
- $to = $this->_map['p'][$this->_currentPos];
+ $to = $this->map['p'][$this->currentPos];
}
}
- $ret .= substr($this->_datas, $start, $to - $start);
+ $ret .= substr($this->datas, $start, $to - $start);
break;
}
@@ -220,7 +215,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
public function readBytes($length)
{
$read = $this->read($length);
- if ($read !== false) {
+ if (false !== $read) {
$ret = array_map('ord', str_split($read, 1));
return $ret;
@@ -236,10 +231,10 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*/
public function setPointer($charOffset)
{
- if ($this->_charCount < $charOffset) {
- $charOffset = $this->_charCount;
+ if ($this->charCount < $charOffset) {
+ $charOffset = $this->charCount;
}
- $this->_currentPos = $charOffset;
+ $this->currentPos = $charOffset;
}
/**
@@ -249,19 +244,19 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
*/
public function write($chars)
{
- if (!isset($this->_charReader)) {
- $this->_charReader = $this->_charReaderFactory->getReaderFor(
- $this->_charset);
- $this->_map = array();
- $this->_mapType = $this->_charReader->getMapType();
+ if (!isset($this->charReader)) {
+ $this->charReader = $this->charReaderFactory->getReaderFor(
+ $this->charset);
+ $this->map = [];
+ $this->mapType = $this->charReader->getMapType();
}
$ignored = '';
- $this->_datas .= $chars;
- $this->_charCount += $this->_charReader->getCharPositions(substr($this->_datas, $this->_datasSize), $this->_datasSize, $this->_map, $ignored);
- if ($ignored !== false) {
- $this->_datasSize = strlen($this->_datas) - strlen($ignored);
+ $this->datas .= $chars;
+ $this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
+ if (false !== $ignored) {
+ $this->datasSize = strlen($this->datas) - strlen($ignored);
} else {
- $this->_datasSize = strlen($this->_datas);
+ $this->datasSize = strlen($this->datas);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php
index 4ae5bacfc4..a711bac478 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/ConfigurableSpool.php
@@ -16,10 +16,10 @@
abstract class Swift_ConfigurableSpool implements Swift_Spool
{
/** The maximum number of messages to send per flush */
- private $_message_limit;
+ private $message_limit;
/** The time limit per flush */
- private $_time_limit;
+ private $time_limit;
/**
* Sets the maximum number of messages to send per flush.
@@ -28,7 +28,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
*/
public function setMessageLimit($limit)
{
- $this->_message_limit = (int) $limit;
+ $this->message_limit = (int) $limit;
}
/**
@@ -38,7 +38,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
*/
public function getMessageLimit()
{
- return $this->_message_limit;
+ return $this->message_limit;
}
/**
@@ -48,7 +48,7 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
*/
public function setTimeLimit($limit)
{
- $this->_time_limit = (int) $limit;
+ $this->time_limit = (int) $limit;
}
/**
@@ -58,6 +58,6 @@ abstract class Swift_ConfigurableSpool implements Swift_Spool
*/
public function getTimeLimit()
{
- return $this->_time_limit;
+ return $this->time_limit;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php
index befec9ac02..b38f8ce512 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/DependencyContainer.php
@@ -11,30 +11,33 @@
/**
* Dependency Injection container.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_DependencyContainer
{
/** Constant for literal value types */
- const TYPE_VALUE = 0x0001;
+ const TYPE_VALUE = 0x00001;
/** Constant for new instance types */
- const TYPE_INSTANCE = 0x0010;
+ const TYPE_INSTANCE = 0x00010;
/** Constant for shared instance types */
- const TYPE_SHARED = 0x0100;
+ const TYPE_SHARED = 0x00100;
/** Constant for aliases */
- const TYPE_ALIAS = 0x1000;
+ const TYPE_ALIAS = 0x01000;
+
+ /** Constant for arrays */
+ const TYPE_ARRAY = 0x10000;
/** Singleton instance */
- private static $_instance = null;
+ private static $instance = null;
/** The data container */
- private $_store = array();
+ private $store = [];
/** The current endpoint in the data container */
- private $_endPoint;
+ private $endPoint;
/**
* Constructor should not be used.
@@ -52,11 +55,11 @@ class Swift_DependencyContainer
*/
public static function getInstance()
{
- if (!isset(self::$_instance)) {
- self::$_instance = new self();
+ if (!isset(self::$instance)) {
+ self::$instance = new self();
}
- return self::$_instance;
+ return self::$instance;
}
/**
@@ -66,7 +69,7 @@ class Swift_DependencyContainer
*/
public function listItems()
{
- return array_keys($this->_store);
+ return array_keys($this->store);
}
/**
@@ -80,8 +83,8 @@ class Swift_DependencyContainer
*/
public function has($itemName)
{
- return array_key_exists($itemName, $this->_store)
- && isset($this->_store[$itemName]['lookupType']);
+ return array_key_exists($itemName, $this->store)
+ && isset($this->store[$itemName]['lookupType']);
}
/**
@@ -91,9 +94,9 @@ class Swift_DependencyContainer
*
* @param string $itemName
*
- * @throws Swift_DependencyException If the dependency is not found
- *
* @return mixed
+ *
+ * @throws Swift_DependencyException If the dependency is not found
*/
public function lookup($itemName)
{
@@ -103,15 +106,17 @@ class Swift_DependencyContainer
);
}
- switch ($this->_store[$itemName]['lookupType']) {
+ switch ($this->store[$itemName]['lookupType']) {
case self::TYPE_ALIAS:
- return $this->_createAlias($itemName);
+ return $this->createAlias($itemName);
case self::TYPE_VALUE:
- return $this->_getValue($itemName);
+ return $this->getValue($itemName);
case self::TYPE_INSTANCE:
- return $this->_createNewInstance($itemName);
+ return $this->createNewInstance($itemName);
case self::TYPE_SHARED:
- return $this->_createSharedInstance($itemName);
+ return $this->createSharedInstance($itemName);
+ case self::TYPE_ARRAY:
+ return $this->createDependenciesFor($itemName);
}
}
@@ -124,9 +129,9 @@ class Swift_DependencyContainer
*/
public function createDependenciesFor($itemName)
{
- $args = array();
- if (isset($this->_store[$itemName]['args'])) {
- $args = $this->_resolveArgs($this->_store[$itemName]['args']);
+ $args = [];
+ if (isset($this->store[$itemName]['args'])) {
+ $args = $this->resolveArgs($this->store[$itemName]['args']);
}
return $args;
@@ -147,8 +152,8 @@ class Swift_DependencyContainer
*/
public function register($itemName)
{
- $this->_store[$itemName] = array();
- $this->_endPoint = &$this->_store[$itemName];
+ $this->store[$itemName] = [];
+ $this->endPoint = &$this->store[$itemName];
return $this;
}
@@ -164,7 +169,7 @@ class Swift_DependencyContainer
*/
public function asValue($value)
{
- $endPoint = &$this->_getEndPoint();
+ $endPoint = &$this->getEndPoint();
$endPoint['lookupType'] = self::TYPE_VALUE;
$endPoint['value'] = $value;
@@ -180,7 +185,7 @@ class Swift_DependencyContainer
*/
public function asAliasOf($lookup)
{
- $endPoint = &$this->_getEndPoint();
+ $endPoint = &$this->getEndPoint();
$endPoint['lookupType'] = self::TYPE_ALIAS;
$endPoint['ref'] = $lookup;
@@ -202,7 +207,7 @@ class Swift_DependencyContainer
*/
public function asNewInstanceOf($className)
{
- $endPoint = &$this->_getEndPoint();
+ $endPoint = &$this->getEndPoint();
$endPoint['lookupType'] = self::TYPE_INSTANCE;
$endPoint['className'] = $className;
@@ -220,7 +225,7 @@ class Swift_DependencyContainer
*/
public function asSharedInstanceOf($className)
{
- $endPoint = &$this->_getEndPoint();
+ $endPoint = &$this->getEndPoint();
$endPoint['lookupType'] = self::TYPE_SHARED;
$endPoint['className'] = $className;
@@ -228,20 +233,33 @@ class Swift_DependencyContainer
}
/**
+ * Specify the previously registered item as array of dependencies.
+ *
+ * {@link register()} must be called before this will work.
+ *
+ * @return $this
+ */
+ public function asArray()
+ {
+ $endPoint = &$this->getEndPoint();
+ $endPoint['lookupType'] = self::TYPE_ARRAY;
+
+ return $this;
+ }
+
+ /**
* Specify a list of injected dependencies for the previously registered item.
*
* This method takes an array of lookup names.
*
* @see addConstructorValue(), addConstructorLookup()
*
- * @param array $lookups
- *
* @return $this
*/
public function withDependencies(array $lookups)
{
- $endPoint = &$this->_getEndPoint();
- $endPoint['args'] = array();
+ $endPoint = &$this->getEndPoint();
+ $endPoint['args'] = [];
foreach ($lookups as $lookup) {
$this->addConstructorLookup($lookup);
}
@@ -261,11 +279,11 @@ class Swift_DependencyContainer
*/
public function addConstructorValue($value)
{
- $endPoint = &$this->_getEndPoint();
+ $endPoint = &$this->getEndPoint();
if (!isset($endPoint['args'])) {
- $endPoint['args'] = array();
+ $endPoint['args'] = [];
}
- $endPoint['args'][] = array('type' => 'value', 'item' => $value);
+ $endPoint['args'][] = ['type' => 'value', 'item' => $value];
return $this;
}
@@ -282,31 +300,31 @@ class Swift_DependencyContainer
*/
public function addConstructorLookup($lookup)
{
- $endPoint = &$this->_getEndPoint();
- if (!isset($this->_endPoint['args'])) {
- $endPoint['args'] = array();
+ $endPoint = &$this->getEndPoint();
+ if (!isset($this->endPoint['args'])) {
+ $endPoint['args'] = [];
}
- $endPoint['args'][] = array('type' => 'lookup', 'item' => $lookup);
+ $endPoint['args'][] = ['type' => 'lookup', 'item' => $lookup];
return $this;
}
/** Get the literal value with $itemName */
- private function _getValue($itemName)
+ private function getValue($itemName)
{
- return $this->_store[$itemName]['value'];
+ return $this->store[$itemName]['value'];
}
/** Resolve an alias to another item */
- private function _createAlias($itemName)
+ private function createAlias($itemName)
{
- return $this->lookup($this->_store[$itemName]['ref']);
+ return $this->lookup($this->store[$itemName]['ref']);
}
/** Create a fresh instance of $itemName */
- private function _createNewInstance($itemName)
+ private function createNewInstance($itemName)
{
- $reflector = new ReflectionClass($this->_store[$itemName]['className']);
+ $reflector = new ReflectionClass($this->store[$itemName]['className']);
if ($reflector->getConstructor()) {
return $reflector->newInstanceArgs(
$this->createDependenciesFor($itemName)
@@ -317,35 +335,35 @@ class Swift_DependencyContainer
}
/** Create and register a shared instance of $itemName */
- private function _createSharedInstance($itemName)
+ private function createSharedInstance($itemName)
{
- if (!isset($this->_store[$itemName]['instance'])) {
- $this->_store[$itemName]['instance'] = $this->_createNewInstance($itemName);
+ if (!isset($this->store[$itemName]['instance'])) {
+ $this->store[$itemName]['instance'] = $this->createNewInstance($itemName);
}
- return $this->_store[$itemName]['instance'];
+ return $this->store[$itemName]['instance'];
}
/** Get the current endpoint in the store */
- private function &_getEndPoint()
+ private function &getEndPoint()
{
- if (!isset($this->_endPoint)) {
+ if (!isset($this->endPoint)) {
throw new BadMethodCallException(
'Component must first be registered by calling register()'
);
}
- return $this->_endPoint;
+ return $this->endPoint;
}
/** Get an argument list with dependencies resolved */
- private function _resolveArgs(array $args)
+ private function resolveArgs(array $args)
{
- $resolved = array();
+ $resolved = [];
foreach ($args as $argDefinition) {
switch ($argDefinition['type']) {
case 'lookup':
- $resolved[] = $this->_lookupRecursive($argDefinition['item']);
+ $resolved[] = $this->lookupRecursive($argDefinition['item']);
break;
case 'value':
$resolved[] = $argDefinition['item'];
@@ -357,12 +375,12 @@ class Swift_DependencyContainer
}
/** Resolve a single dependency with an collections */
- private function _lookupRecursive($item)
+ private function lookupRecursive($item)
{
if (is_array($item)) {
- $collection = array();
+ $collection = [];
foreach ($item as $k => $v) {
- $collection[$k] = $this->_lookupRecursive($v);
+ $collection[$k] = $this->lookupRecursive($v);
}
return $collection;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php
index d8c72ad4df..20b81412ec 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/EmbeddedFile.php
@@ -27,7 +27,7 @@ class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile
public function __construct($data = null, $filename = null, $contentType = null)
{
call_user_func_array(
- array($this, 'Swift_Mime_EmbeddedFile::__construct'),
+ [$this, 'Swift_Mime_EmbeddedFile::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.embeddedfile')
);
@@ -40,20 +40,6 @@ class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile
}
/**
- * Create a new EmbeddedFile.
- *
- * @param string|Swift_OutputByteStream $data
- * @param string $filename
- * @param string $contentType
- *
- * @return Swift_Mime_EmbeddedFile
- */
- public static function newInstance($data = null, $filename = null, $contentType = null)
- {
- return new self($data, $filename, $contentType);
- }
-
- /**
* Create a new EmbeddedFile from a filesystem path.
*
* @param string $path
@@ -62,8 +48,6 @@ class Swift_EmbeddedFile extends Swift_Mime_EmbeddedFile
*/
public static function fromPath($path)
{
- return self::newInstance()->setFile(
- new Swift_ByteStream_FileByteStream($path)
- );
+ return (new self())->setFile(new Swift_ByteStream_FileByteStream($path));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
index edec10c517..95b4ae97b8 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/QpEncoder.php
@@ -13,7 +13,7 @@
*
* Possibly the most accurate RFC 2045 QP implementation found in PHP.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_Encoder_QpEncoder implements Swift_Encoder
{
@@ -22,21 +22,21 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*
* @var Swift_CharacterStream
*/
- protected $_charStream;
+ protected $charStream;
/**
* A filter used if input should be canonicalized.
*
* @var Swift_StreamFilter
*/
- protected $_filter;
+ protected $filter;
/**
* Pre-computed QP for HUGE optimization.
*
* @var string[]
*/
- protected static $_qpMap = array(
+ protected static $qpMap = [
0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',
5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',
10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',
@@ -89,16 +89,16 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9',
250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE',
255 => '=FF',
- );
+ ];
- protected static $_safeMapShare = array();
+ protected static $safeMapShare = [];
/**
* A map of non-encoded ascii characters.
*
* @var string[]
*/
- protected $_safeMap = array();
+ protected $safeMap = [];
/**
* Creates a new QpEncoder for the given CharacterStream.
@@ -108,28 +108,28 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*/
public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null)
{
- $this->_charStream = $charStream;
- if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) {
+ $this->charStream = $charStream;
+ if (!isset(self::$safeMapShare[$this->getSafeMapShareId()])) {
$this->initSafeMap();
- self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;
+ self::$safeMapShare[$this->getSafeMapShareId()] = $this->safeMap;
} else {
- $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];
+ $this->safeMap = self::$safeMapShare[$this->getSafeMapShareId()];
}
- $this->_filter = $filter;
+ $this->filter = $filter;
}
public function __sleep()
{
- return array('_charStream', '_filter');
+ return ['charStream', 'filter'];
}
public function __wakeup()
{
- if (!isset(self::$_safeMapShare[$this->getSafeMapShareId()])) {
+ if (!isset(self::$safeMapShare[$this->getSafeMapShareId()])) {
$this->initSafeMap();
- self::$_safeMapShare[$this->getSafeMapShareId()] = $this->_safeMap;
+ self::$safeMapShare[$this->getSafeMapShareId()] = $this->safeMap;
} else {
- $this->_safeMap = self::$_safeMapShare[$this->getSafeMapShareId()];
+ $this->safeMap = self::$safeMapShare[$this->getSafeMapShareId()];
}
}
@@ -141,8 +141,8 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
protected function initSafeMap()
{
foreach (array_merge(
- array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
- $this->_safeMap[$byte] = chr($byte);
+ [0x09, 0x20], range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
+ $this->safeMap[$byte] = chr($byte);
}
}
@@ -153,9 +153,9 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
* If the first line needs to be shorter, indicate the difference with
* $firstLineOffset.
*
- * @param string $string to encode
- * @param int $firstLineOffset, optional
- * @param int $maxLineLength, optional 0 indicates the default of 76 chars
+ * @param string $string to encode
+ * @param int $firstLineOffset optional
+ * @param int $maxLineLength optional 0 indicates the default of 76 chars
*
* @return string
*/
@@ -167,25 +167,25 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$thisLineLength = $maxLineLength - $firstLineOffset;
- $lines = array();
+ $lines = [];
$lNo = 0;
$lines[$lNo] = '';
$currentLine = &$lines[$lNo++];
$size = $lineLen = 0;
- $this->_charStream->flushContents();
- $this->_charStream->importString($string);
+ $this->charStream->flushContents();
+ $this->charStream->importString($string);
// Fetching more than 4 chars at one is slower, as is fetching fewer bytes
// Conveniently 4 chars is the UTF-8 safe number since UTF-8 has up to 6
// bytes per char and (6 * 4 * 3 = 72 chars per line) * =NN is 3 bytes
- while (false !== $bytes = $this->_nextSequence()) {
+ while (false !== $bytes = $this->nextSequence()) {
// If we're filtering the input
- if (isset($this->_filter)) {
+ if (isset($this->filter)) {
// If we can't filter because we need more bytes
- while ($this->_filter->shouldBuffer($bytes)) {
+ while ($this->filter->shouldBuffer($bytes)) {
// Then collect bytes into the buffer
- if (false === $moreBytes = $this->_nextSequence(1)) {
+ if (false === $moreBytes = $this->nextSequence(1)) {
break;
}
@@ -194,13 +194,13 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
}
}
// And filter them
- $bytes = $this->_filter->filter($bytes);
+ $bytes = $this->filter->filter($bytes);
}
- $enc = $this->_encodeByteSequence($bytes, $size);
+ $enc = $this->encodeByteSequence($bytes, $size);
$i = strpos($enc, '=0D=0A');
- $newLineLength = $lineLen + ($i === false ? $size : $i);
+ $newLineLength = $lineLen + (false === $i ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
$lines[$lNo] = '';
@@ -211,7 +211,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
$currentLine .= $enc;
- if ($i === false) {
+ if (false === $i) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
@@ -219,7 +219,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
}
}
- return $this->_standardize(implode("=\r\n", $lines));
+ return $this->standardize(implode("=\r\n", $lines));
}
/**
@@ -229,7 +229,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*/
public function charsetChanged($charset)
{
- $this->_charStream->setCharacterSet($charset);
+ $this->charStream->setCharacterSet($charset);
}
/**
@@ -240,16 +240,16 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*
* @return string
*/
- protected function _encodeByteSequence(array $bytes, &$size)
+ protected function encodeByteSequence(array $bytes, &$size)
{
$ret = '';
$size = 0;
foreach ($bytes as $b) {
- if (isset($this->_safeMap[$b])) {
- $ret .= $this->_safeMap[$b];
+ if (isset($this->safeMap[$b])) {
+ $ret .= $this->safeMap[$b];
++$size;
} else {
- $ret .= self::$_qpMap[$b];
+ $ret .= self::$qpMap[$b];
$size += 3;
}
}
@@ -264,9 +264,9 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*
* @return int[]
*/
- protected function _nextSequence($size = 4)
+ protected function nextSequence($size = 4)
{
- return $this->_charStream->readBytes($size);
+ return $this->charStream->readBytes($size);
}
/**
@@ -276,15 +276,15 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*
* @return string
*/
- protected function _standardize($string)
+ protected function standardize($string)
{
- $string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'),
- array("=09\r\n", "=20\r\n", "\r\n"), $string
+ $string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'],
+ ["=09\r\n", "=20\r\n", "\r\n"], $string
);
switch ($end = ord(substr($string, -1))) {
case 0x09:
case 0x20:
- $string = substr_replace($string, self::$_qpMap[$end], -1);
+ $string = substr_replace($string, self::$qpMap[$end], -1);
}
return $string;
@@ -295,6 +295,6 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
*/
public function __clone()
{
- $this->_charStream = clone $this->_charStream;
+ $this->charStream = clone $this->charStream;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
index b0215e8838..2458515ad7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoder/Rfc2231Encoder.php
@@ -20,16 +20,14 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
*
* @var Swift_CharacterStream
*/
- private $_charStream;
+ private $charStream;
/**
* Creates a new Rfc2231Encoder using the given character stream instance.
- *
- * @param Swift_CharacterStream
*/
public function __construct(Swift_CharacterStream $charStream)
{
- $this->_charStream = $charStream;
+ $this->charStream = $charStream;
}
/**
@@ -44,7 +42,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- $lines = array();
+ $lines = [];
$lineCount = 0;
$lines[] = '';
$currentLine = &$lines[$lineCount++];
@@ -53,12 +51,12 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
$maxLineLength = 75;
}
- $this->_charStream->flushContents();
- $this->_charStream->importString($string);
+ $this->charStream->flushContents();
+ $this->charStream->importString($string);
$thisLineLength = $maxLineLength - $firstLineOffset;
- while (false !== $char = $this->_charStream->read(4)) {
+ while (false !== $char = $this->charStream->read(4)) {
$encodedChar = rawurlencode($char);
if (0 != strlen($currentLine)
&& strlen($currentLine.$encodedChar) > $thisLineLength) {
@@ -79,7 +77,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
*/
public function charsetChanged($charset)
{
- $this->_charStream->setCharacterSet($charset);
+ $this->charStream->setCharacterSet($charset);
}
/**
@@ -87,6 +85,6 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
*/
public function __clone()
{
- $this->_charStream = clone $this->_charStream;
+ $this->charStream = clone $this->charStream;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php
deleted file mode 100644
index 245878706d..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Encoding.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Provides quick access to each encoding type.
- *
- * @author Chris Corbyn
- */
-class Swift_Encoding
-{
- /**
- * Get the Encoder that provides 7-bit encoding.
- *
- * @return Swift_Mime_ContentEncoder
- */
- public static function get7BitEncoding()
- {
- return self::_lookup('mime.7bitcontentencoder');
- }
-
- /**
- * Get the Encoder that provides 8-bit encoding.
- *
- * @return Swift_Mime_ContentEncoder
- */
- public static function get8BitEncoding()
- {
- return self::_lookup('mime.8bitcontentencoder');
- }
-
- /**
- * Get the Encoder that provides Quoted-Printable (QP) encoding.
- *
- * @return Swift_Mime_ContentEncoder
- */
- public static function getQpEncoding()
- {
- return self::_lookup('mime.qpcontentencoder');
- }
-
- /**
- * Get the Encoder that provides Base64 encoding.
- *
- * @return Swift_Mime_ContentEncoder
- */
- public static function getBase64Encoding()
- {
- return self::_lookup('mime.base64contentencoder');
- }
-
- 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 674e6b5e41..18994c184f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/CommandEvent.php
@@ -20,27 +20,26 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
*
* @var string
*/
- private $_command;
+ private $command;
/**
* An array of codes which a successful response will contain.
*
* @var int[]
*/
- private $_successCodes = array();
+ private $successCodes = [];
/**
* Create a new CommandEvent for $source with $command.
*
- * @param Swift_Transport $source
- * @param string $command
- * @param array $successCodes
+ * @param string $command
+ * @param array $successCodes
*/
- public function __construct(Swift_Transport $source, $command, $successCodes = array())
+ public function __construct(Swift_Transport $source, $command, $successCodes = [])
{
parent::__construct($source);
- $this->_command = $command;
- $this->_successCodes = $successCodes;
+ $this->command = $command;
+ $this->successCodes = $successCodes;
}
/**
@@ -50,7 +49,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
*/
public function getCommand()
{
- return $this->_command;
+ return $this->command;
}
/**
@@ -60,6 +59,6 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
*/
public function getSuccessCodes()
{
- return $this->_successCodes;
+ return $this->successCodes;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
index aac36aaa76..a01dfa2606 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventDispatcher.php
@@ -19,11 +19,11 @@ interface Swift_Events_EventDispatcher
* Create a new SendEvent for $source and $message.
*
* @param Swift_Transport $source
- * @param Swift_Mime_Message
+ * @param Swift_Mime_SimpleMessage
*
* @return Swift_Events_SendEvent
*/
- public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message);
+ public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message);
/**
* Create a new CommandEvent for $source and $command.
@@ -34,7 +34,7 @@ interface Swift_Events_EventDispatcher
*
* @return Swift_Events_CommandEvent
*/
- public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array());
+ public function createCommandEvent(Swift_Transport $source, $command, $successCodes = []);
/**
* Create a new ResponseEvent for $source and $response.
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php
index 90694a9a60..24a11f44e2 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/EventObject.php
@@ -16,10 +16,10 @@
class Swift_Events_EventObject implements Swift_Events_Event
{
/** The source of this Event */
- private $_source;
+ private $source;
/** The state of this Event (should it bubble up the stack?) */
- private $_bubbleCancelled = false;
+ private $bubbleCancelled = false;
/**
* Create a new EventObject originating at $source.
@@ -28,7 +28,7 @@ class Swift_Events_EventObject implements Swift_Events_Event
*/
public function __construct($source)
{
- $this->_source = $source;
+ $this->source = $source;
}
/**
@@ -38,17 +38,15 @@ class Swift_Events_EventObject implements Swift_Events_Event
*/
public function getSource()
{
- return $this->_source;
+ return $this->source;
}
/**
* Prevent this Event from bubbling any further up the stack.
- *
- * @param bool $cancel, optional
*/
public function cancelBubble($cancel = true)
{
- $this->_bubbleCancelled = $cancel;
+ $this->bubbleCancelled = $cancel;
}
/**
@@ -58,6 +56,6 @@ class Swift_Events_EventObject implements Swift_Events_Event
*/
public function bubbleCancelled()
{
- return $this->_bubbleCancelled;
+ return $this->bubbleCancelled;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
index 2e92ba9404..ff7c37116b 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/ResponseEvent.php
@@ -20,27 +20,26 @@ class Swift_Events_ResponseEvent extends Swift_Events_EventObject
*
* @var bool
*/
- private $_valid;
+ private $valid;
/**
* The response received from the server.
*
* @var string
*/
- private $_response;
+ private $response;
/**
* Create a new ResponseEvent for $source and $response.
*
- * @param Swift_Transport $source
- * @param string $response
- * @param bool $valid
+ * @param string $response
+ * @param bool $valid
*/
public function __construct(Swift_Transport $source, $response, $valid = false)
{
parent::__construct($source);
- $this->_response = $response;
- $this->_valid = $valid;
+ $this->response = $response;
+ $this->valid = $valid;
}
/**
@@ -50,7 +49,7 @@ class Swift_Events_ResponseEvent extends Swift_Events_EventObject
*/
public function getResponse()
{
- return $this->_response;
+ return $this->response;
}
/**
@@ -60,6 +59,6 @@ class Swift_Events_ResponseEvent extends Swift_Events_EventObject
*/
public function isValid()
{
- return $this->_valid;
+ return $this->valid;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php
index 10da8080f0..a435691e0b 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SendEvent.php
@@ -33,35 +33,32 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
/**
* The Message being sent.
*
- * @var Swift_Mime_Message
+ * @var Swift_Mime_SimpleMessage
*/
- private $_message;
+ private $message;
/**
* Any recipients which failed after sending.
*
* @var string[]
*/
- private $_failedRecipients = array();
+ private $failedRecipients = [];
/**
* The overall result as a bitmask from the class constants.
*
* @var int
*/
- private $_result;
+ private $result;
/**
* Create a new SendEvent for $source and $message.
- *
- * @param Swift_Transport $source
- * @param Swift_Mime_Message $message
*/
- public function __construct(Swift_Transport $source, Swift_Mime_Message $message)
+ public function __construct(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
{
parent::__construct($source);
- $this->_message = $message;
- $this->_result = self::RESULT_PENDING;
+ $this->message = $message;
+ $this->result = self::RESULT_PENDING;
}
/**
@@ -77,11 +74,11 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
/**
* Get the Message being sent.
*
- * @return Swift_Mime_Message
+ * @return Swift_Mime_SimpleMessage
*/
public function getMessage()
{
- return $this->_message;
+ return $this->message;
}
/**
@@ -91,7 +88,7 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
*/
public function setFailedRecipients($recipients)
{
- $this->_failedRecipients = $recipients;
+ $this->failedRecipients = $recipients;
}
/**
@@ -101,7 +98,7 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
*/
public function getFailedRecipients()
{
- return $this->_failedRecipients;
+ return $this->failedRecipients;
}
/**
@@ -111,7 +108,7 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
*/
public function setResult($result)
{
- $this->_result = $result;
+ $this->result = $result;
}
/**
@@ -124,6 +121,6 @@ class Swift_Events_SendEvent extends Swift_Events_EventObject
*/
public function getResult()
{
- return $this->_result;
+ return $this->result;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
index e8aca752f0..1396f6164c 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/SimpleEventDispatcher.php
@@ -16,37 +16,34 @@
class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
{
/** A map of event types to their associated listener types */
- private $_eventMap = array();
+ private $eventMap = [];
/** Event listeners bound to this dispatcher */
- private $_listeners = array();
+ private $listeners = [];
/** Listeners queued to have an Event bubbled up the stack to them */
- private $_bubbleQueue = array();
+ private $bubbleQueue = [];
/**
* Create a new EventDispatcher.
*/
public function __construct()
{
- $this->_eventMap = array(
+ $this->eventMap = [
'Swift_Events_CommandEvent' => 'Swift_Events_CommandListener',
'Swift_Events_ResponseEvent' => 'Swift_Events_ResponseListener',
'Swift_Events_SendEvent' => 'Swift_Events_SendListener',
'Swift_Events_TransportChangeEvent' => 'Swift_Events_TransportChangeListener',
'Swift_Events_TransportExceptionEvent' => 'Swift_Events_TransportExceptionListener',
- );
+ ];
}
/**
* Create a new SendEvent for $source and $message.
*
- * @param Swift_Transport $source
- * @param Swift_Mime_Message
- *
* @return Swift_Events_SendEvent
*/
- public function createSendEvent(Swift_Transport $source, Swift_Mime_Message $message)
+ public function createSendEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
{
return new Swift_Events_SendEvent($source, $message);
}
@@ -54,13 +51,12 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new CommandEvent for $source and $command.
*
- * @param Swift_Transport $source
- * @param string $command That will be executed
- * @param array $successCodes That are needed
+ * @param string $command That will be executed
+ * @param array $successCodes That are needed
*
* @return Swift_Events_CommandEvent
*/
- public function createCommandEvent(Swift_Transport $source, $command, $successCodes = array())
+ public function createCommandEvent(Swift_Transport $source, $command, $successCodes = [])
{
return new Swift_Events_CommandEvent($source, $command, $successCodes);
}
@@ -68,9 +64,8 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new ResponseEvent for $source and $response.
*
- * @param Swift_Transport $source
- * @param string $response
- * @param bool $valid If the response is valid
+ * @param string $response
+ * @param bool $valid If the response is valid
*
* @return Swift_Events_ResponseEvent
*/
@@ -82,8 +77,6 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new TransportChangeEvent for $source.
*
- * @param Swift_Transport $source
- *
* @return Swift_Events_TransportChangeEvent
*/
public function createTransportChangeEvent(Swift_Transport $source)
@@ -94,9 +87,6 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Create a new TransportExceptionEvent for $source.
*
- * @param Swift_Transport $source
- * @param Swift_TransportException $ex
- *
* @return Swift_Events_TransportExceptionEvent
*/
public function createTransportExceptionEvent(Swift_Transport $source, Swift_TransportException $ex)
@@ -106,51 +96,48 @@ class Swift_Events_SimpleEventDispatcher implements Swift_Events_EventDispatcher
/**
* Bind an event listener to this dispatcher.
- *
- * @param Swift_Events_EventListener $listener
*/
public function bindEventListener(Swift_Events_EventListener $listener)
{
- foreach ($this->_listeners as $l) {
+ foreach ($this->listeners as $l) {
// Already loaded
if ($l === $listener) {
return;
}
}
- $this->_listeners[] = $listener;
+ $this->listeners[] = $listener;
}
/**
* Dispatch the given Event to all suitable listeners.
*
- * @param Swift_Events_EventObject $evt
- * @param string $target method
+ * @param string $target method
*/
public function dispatchEvent(Swift_Events_EventObject $evt, $target)
{
- $this->_prepareBubbleQueue($evt);
- $this->_bubble($evt, $target);
+ $this->prepareBubbleQueue($evt);
+ $this->bubble($evt, $target);
}
/** Queue listeners on a stack ready for $evt to be bubbled up it */
- private function _prepareBubbleQueue(Swift_Events_EventObject $evt)
+ private function prepareBubbleQueue(Swift_Events_EventObject $evt)
{
- $this->_bubbleQueue = array();
+ $this->bubbleQueue = [];
$evtClass = get_class($evt);
- foreach ($this->_listeners as $listener) {
- if (array_key_exists($evtClass, $this->_eventMap)
- && ($listener instanceof $this->_eventMap[$evtClass])) {
- $this->_bubbleQueue[] = $listener;
+ foreach ($this->listeners as $listener) {
+ if (array_key_exists($evtClass, $this->eventMap)
+ && ($listener instanceof $this->eventMap[$evtClass])) {
+ $this->bubbleQueue[] = $listener;
}
}
}
/** Bubble $evt up the stack calling $target() on each listener */
- private function _bubble(Swift_Events_EventObject $evt, $target)
+ private function bubble(Swift_Events_EventObject $evt, $target)
{
- if (!$evt->bubbleCancelled() && $listener = array_shift($this->_bubbleQueue)) {
+ if (!$evt->bubbleCancelled() && $listener = array_shift($this->bubbleQueue)) {
$listener->$target($evt);
- $this->_bubble($evt, $target);
+ $this->bubble($evt, $target);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
index f87154fb9b..df442cc70f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Events/TransportExceptionEvent.php
@@ -20,18 +20,15 @@ class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
*
* @var Swift_TransportException
*/
- private $_exception;
+ private $exception;
/**
* Create a new TransportExceptionEvent for $transport.
- *
- * @param Swift_Transport $transport
- * @param Swift_TransportException $ex
*/
public function __construct(Swift_Transport $transport, Swift_TransportException $ex)
{
parent::__construct($transport);
- $this->_exception = $ex;
+ $this->exception = $ex;
}
/**
@@ -41,6 +38,6 @@ class Swift_Events_TransportExceptionEvent extends Swift_Events_EventObject
*/
public function getException()
{
- return $this->_exception;
+ return $this->exception;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php
index 9951c59774..0044be59b7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FailoverTransport.php
@@ -20,26 +20,14 @@ class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
*
* @param Swift_Transport[] $transports
*/
- public function __construct($transports = array())
+ public function __construct($transports = [])
{
call_user_func_array(
- array($this, 'Swift_Transport_FailoverTransport::__construct'),
+ [$this, 'Swift_Transport_FailoverTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.failover')
);
$this->setTransports($transports);
}
-
- /**
- * Create a new FailoverTransport instance.
- *
- * @param Swift_Transport[] $transports
- *
- * @return self
- */
- public static function newInstance($transports = array())
- {
- return new self($transports);
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php
index c82c5dbf11..d16c47cd6a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/FileSpool.php
@@ -17,14 +17,14 @@
class Swift_FileSpool extends Swift_ConfigurableSpool
{
/** The spool directory */
- private $_path;
+ private $path;
/**
* File WriteRetry Limit.
*
* @var int
*/
- private $_retryLimit = 10;
+ private $retryLimit = 10;
/**
* Create a new FileSpool.
@@ -35,11 +35,11 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*/
public function __construct($path)
{
- $this->_path = $path;
+ $this->path = $path;
- if (!file_exists($this->_path)) {
- if (!mkdir($this->_path, 0777, true)) {
- throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->_path));
+ if (!file_exists($this->path)) {
+ if (!mkdir($this->path, 0777, true)) {
+ throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->path));
}
}
}
@@ -77,25 +77,25 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*/
public function setRetryLimit($limit)
{
- $this->_retryLimit = $limit;
+ $this->retryLimit = $limit;
}
/**
* Queues a message.
*
- * @param Swift_Mime_Message $message The message to store
+ * @param Swift_Mime_SimpleMessage $message The message to store
*
* @throws Swift_IoException
*
* @return bool
*/
- public function queueMessage(Swift_Mime_Message $message)
+ public function queueMessage(Swift_Mime_SimpleMessage $message)
{
$ser = serialize($message);
- $fileName = $this->_path.'/'.$this->getRandomString(10);
- for ($i = 0; $i < $this->_retryLimit; ++$i) {
+ $fileName = $this->path.'/'.$this->getRandomString(10);
+ for ($i = 0; $i < $this->retryLimit; ++$i) {
/* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */
- $fp = @fopen($fileName.'.message', 'x');
+ $fp = @fopen($fileName.'.message', 'xb');
if (false !== $fp) {
if (false === fwrite($fp, $ser)) {
return false;
@@ -108,7 +108,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
}
}
- throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->_path));
+ throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->path));
}
/**
@@ -118,10 +118,10 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*/
public function recover($timeout = 900)
{
- foreach (new DirectoryIterator($this->_path) as $file) {
+ foreach (new DirectoryIterator($this->path) as $file) {
$file = $file->getRealPath();
- if (substr($file, -16) == '.message.sending') {
+ if ('.message.sending' == substr($file, -16)) {
$lockedtime = filectime($file);
if ((time() - $lockedtime) > $timeout) {
rename($file, substr($file, 0, -8));
@@ -140,12 +140,12 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
*/
public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
{
- $directoryIterator = new DirectoryIterator($this->_path);
+ $directoryIterator = new DirectoryIterator($this->path);
/* Start the transport only if there are queued files to send */
if (!$transport->isStarted()) {
foreach ($directoryIterator as $file) {
- if (substr($file->getRealPath(), -8) == '.message') {
+ if ('.message' == substr($file->getRealPath(), -8)) {
$transport->start();
break;
}
@@ -158,7 +158,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
foreach ($directoryIterator as $file) {
$file = $file->getRealPath();
- if (substr($file, -8) != '.message') {
+ if ('.message' != substr($file, -8)) {
continue;
}
@@ -200,7 +200,7 @@ class Swift_FileSpool extends Swift_ConfigurableSpool
$ret = '';
$strlen = strlen($base);
for ($i = 0; $i < $count; ++$i) {
- $ret .= $base[((int) rand(0, $strlen - 1))];
+ $ret .= $base[random_int(0, $strlen - 1)];
}
return $ret;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IdGenerator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IdGenerator.php
new file mode 100644
index 0000000000..c845d85e3b
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IdGenerator.php
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Message ID generator.
+ */
+interface Swift_IdGenerator
+{
+ /**
+ * Returns a globally unique string to use for Message-ID or Content-ID.
+ *
+ * @return string
+ */
+ public function generateId();
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php
index 4213ee27e3..34c253547d 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Image.php
@@ -30,20 +30,6 @@ class Swift_Image extends Swift_EmbeddedFile
}
/**
- * Create a new Image.
- *
- * @param string|Swift_OutputByteStream $data
- * @param string $filename
- * @param string $contentType
- *
- * @return self
- */
- public static function newInstance($data = null, $filename = null, $contentType = null)
- {
- return new self($data, $filename, $contentType);
- }
-
- /**
* Create a new Image from a filesystem path.
*
* @param string $path
@@ -52,6 +38,6 @@ class Swift_Image extends Swift_EmbeddedFile
*/
public static function fromPath($path)
{
- return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path));
+ return (new self())->setFile(new Swift_ByteStream_FileByteStream($path));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php
index 56efc7593a..379a5a1787 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/InputByteStream.php
@@ -52,7 +52,7 @@ interface Swift_InputByteStream
*
* @param Swift_InputByteStream $is
*/
- public function bind(Swift_InputByteStream $is);
+ public function bind(self $is);
/**
* Remove an already bound stream.
@@ -63,7 +63,7 @@ interface Swift_InputByteStream
*
* @param Swift_InputByteStream $is
*/
- public function unbind(Swift_InputByteStream $is);
+ public function unbind(self $is);
/**
* Flush the contents of the stream (empty it) and set the internal pointer
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php
index c405f352b5..5452bd416a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/IoException.php
@@ -18,9 +18,8 @@ class Swift_IoException extends Swift_SwiftException
/**
* Create a new IoException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
index b37f07f74b..76fafdfc6a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/ArrayKeyCache.php
@@ -20,24 +20,22 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @var array
*/
- private $_contents = array();
+ private $contents = [];
/**
* An InputStream for cloning.
*
* @var Swift_KeyCache_KeyCacheInputStream
*/
- private $_stream;
+ private $stream;
/**
* Create a new ArrayKeyCache with the given $stream for cloning to make
* InputByteStreams.
- *
- * @param Swift_KeyCache_KeyCacheInputStream $stream
*/
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream)
{
- $this->_stream = $stream;
+ $this->stream = $stream;
}
/**
@@ -52,16 +50,16 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function setString($nsKey, $itemKey, $string, $mode)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
switch ($mode) {
case self::MODE_WRITE:
- $this->_contents[$nsKey][$itemKey] = $string;
+ $this->contents[$nsKey][$itemKey] = $string;
break;
case self::MODE_APPEND:
if (!$this->hasKey($nsKey, $itemKey)) {
- $this->_contents[$nsKey][$itemKey] = '';
+ $this->contents[$nsKey][$itemKey] = '';
}
- $this->_contents[$nsKey][$itemKey] .= $string;
+ $this->contents[$nsKey][$itemKey] .= $string;
break;
default:
throw new Swift_SwiftException(
@@ -76,23 +74,23 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
switch ($mode) {
case self::MODE_WRITE:
$this->clearKey($nsKey, $itemKey);
+ // no break
case self::MODE_APPEND:
if (!$this->hasKey($nsKey, $itemKey)) {
- $this->_contents[$nsKey][$itemKey] = '';
+ $this->contents[$nsKey][$itemKey] = '';
}
while (false !== $bytes = $os->read(8192)) {
- $this->_contents[$nsKey][$itemKey] .= $bytes;
+ $this->contents[$nsKey][$itemKey] .= $bytes;
}
break;
default:
@@ -108,15 +106,14 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null)
{
- $is = clone $this->_stream;
+ $is = clone $this->stream;
$is->setKeyCache($this);
$is->setNsKey($nsKey);
$is->setItemKey($itemKey);
@@ -137,9 +134,9 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function getString($nsKey, $itemKey)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
if ($this->hasKey($nsKey, $itemKey)) {
- return $this->_contents[$nsKey][$itemKey];
+ return $this->contents[$nsKey][$itemKey];
}
}
@@ -152,7 +149,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
$is->write($this->getString($nsKey, $itemKey));
}
@@ -166,9 +163,9 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function hasKey($nsKey, $itemKey)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
- return array_key_exists($itemKey, $this->_contents[$nsKey]);
+ return array_key_exists($itemKey, $this->contents[$nsKey]);
}
/**
@@ -179,7 +176,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function clearKey($nsKey, $itemKey)
{
- unset($this->_contents[$nsKey][$itemKey]);
+ unset($this->contents[$nsKey][$itemKey]);
}
/**
@@ -189,7 +186,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*/
public function clearAll($nsKey)
{
- unset($this->_contents[$nsKey]);
+ unset($this->contents[$nsKey]);
}
/**
@@ -197,10 +194,10 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
*
* @param string $nsKey
*/
- private function _prepareCache($nsKey)
+ private function prepareCache($nsKey)
{
- if (!array_key_exists($nsKey, $this->_contents)) {
- $this->_contents[$nsKey] = array();
+ if (!array_key_exists($nsKey, $this->contents)) {
+ $this->contents[$nsKey] = [];
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
index 453f50a15d..7dc2886cca 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/DiskKeyCache.php
@@ -29,44 +29,32 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @var Swift_KeyCache_KeyCacheInputStream
*/
- private $_stream;
+ private $stream;
/**
* A path to write to.
*
* @var string
*/
- private $_path;
+ private $path;
/**
* Stored keys.
*
* @var array
*/
- private $_keys = array();
-
- /**
- * Will be true if magic_quotes_runtime is turned on.
- *
- * @var bool
- */
- private $_quotes = false;
+ private $keys = [];
/**
* Create a new DiskKeyCache with the given $stream for cloning to make
* InputByteStreams, and the given $path to save to.
*
- * @param Swift_KeyCache_KeyCacheInputStream $stream
- * @param string $path to save to
+ * @param string $path to save to
*/
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path)
{
- $this->_stream = $stream;
- $this->_path = $path;
-
- if (function_exists('get_magic_quotes_runtime') && @get_magic_quotes_runtime() == 1) {
- $this->_quotes = true;
- }
+ $this->stream = $stream;
+ $this->path = $path;
}
/**
@@ -83,13 +71,13 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function setString($nsKey, $itemKey, $string, $mode)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
switch ($mode) {
case self::MODE_WRITE:
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
break;
case self::MODE_APPEND:
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END);
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
break;
default:
throw new Swift_SwiftException(
@@ -99,7 +87,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
break;
}
fwrite($fp, $string);
- $this->_freeHandle($nsKey, $itemKey);
+ $this->freeHandle($nsKey, $itemKey);
}
/**
@@ -107,22 +95,21 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*
* @throws Swift_IoException
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
switch ($mode) {
case self::MODE_WRITE:
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
break;
case self::MODE_APPEND:
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_END);
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
break;
default:
throw new Swift_SwiftException(
@@ -134,7 +121,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
while (false !== $bytes = $os->read(8192)) {
fwrite($fp, $bytes);
}
- $this->_freeHandle($nsKey, $itemKey);
+ $this->freeHandle($nsKey, $itemKey);
}
/**
@@ -142,15 +129,14 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
public function getInputByteStream($nsKey, $itemKey, Swift_InputByteStream $writeThrough = null)
{
- $is = clone $this->_stream;
+ $is = clone $this->stream;
$is->setKeyCache($this);
$is->setNsKey($nsKey);
$is->setItemKey($itemKey);
@@ -173,20 +159,14 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function getString($nsKey, $itemKey)
{
- $this->_prepareCache($nsKey);
+ $this->prepareCache($nsKey);
if ($this->hasKey($nsKey, $itemKey)) {
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 0);
- }
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
$str = '';
while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {
$str .= $bytes;
}
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 1);
- }
- $this->_freeHandle($nsKey, $itemKey);
+ $this->freeHandle($nsKey, $itemKey);
return $str;
}
@@ -202,17 +182,11 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
public function exportToByteStream($nsKey, $itemKey, Swift_InputByteStream $is)
{
if ($this->hasKey($nsKey, $itemKey)) {
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_START);
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 0);
- }
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_START);
while (!feof($fp) && false !== $bytes = fread($fp, 8192)) {
$is->write($bytes);
}
- if ($this->_quotes) {
- ini_set('magic_quotes_runtime', 1);
- }
- $this->_freeHandle($nsKey, $itemKey);
+ $this->freeHandle($nsKey, $itemKey);
}
}
@@ -226,7 +200,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function hasKey($nsKey, $itemKey)
{
- return is_file($this->_path.'/'.$nsKey.'/'.$itemKey);
+ return is_file($this->path.'/'.$nsKey.'/'.$itemKey);
}
/**
@@ -238,8 +212,8 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
public function clearKey($nsKey, $itemKey)
{
if ($this->hasKey($nsKey, $itemKey)) {
- $this->_freeHandle($nsKey, $itemKey);
- unlink($this->_path.'/'.$nsKey.'/'.$itemKey);
+ $this->freeHandle($nsKey, $itemKey);
+ unlink($this->path.'/'.$nsKey.'/'.$itemKey);
}
}
@@ -250,14 +224,14 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function clearAll($nsKey)
{
- if (array_key_exists($nsKey, $this->_keys)) {
- foreach ($this->_keys[$nsKey] as $itemKey => $null) {
+ if (array_key_exists($nsKey, $this->keys)) {
+ foreach ($this->keys[$nsKey] as $itemKey => $null) {
$this->clearKey($nsKey, $itemKey);
}
- if (is_dir($this->_path.'/'.$nsKey)) {
- rmdir($this->_path.'/'.$nsKey);
+ if (is_dir($this->path.'/'.$nsKey)) {
+ rmdir($this->path.'/'.$nsKey);
}
- unset($this->_keys[$nsKey]);
+ unset($this->keys[$nsKey]);
}
}
@@ -266,14 +240,14 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @param string $nsKey
*/
- private function _prepareCache($nsKey)
+ private function prepareCache($nsKey)
{
- $cacheDir = $this->_path.'/'.$nsKey;
+ $cacheDir = $this->path.'/'.$nsKey;
if (!is_dir($cacheDir)) {
if (!mkdir($cacheDir)) {
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
}
- $this->_keys[$nsKey] = array();
+ $this->keys[$nsKey] = [];
}
}
@@ -286,27 +260,27 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*
* @return resource
*/
- private function _getHandle($nsKey, $itemKey, $position)
+ private function getHandle($nsKey, $itemKey, $position)
{
- if (!isset($this->_keys[$nsKey][$itemKey])) {
+ if (!isset($this->keys[$nsKey][$itemKey])) {
$openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b';
- $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode);
- $this->_keys[$nsKey][$itemKey] = $fp;
+ $fp = fopen($this->path.'/'.$nsKey.'/'.$itemKey, $openMode);
+ $this->keys[$nsKey][$itemKey] = $fp;
}
if (self::POSITION_START == $position) {
- fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_SET);
+ fseek($this->keys[$nsKey][$itemKey], 0, SEEK_SET);
} elseif (self::POSITION_END == $position) {
- fseek($this->_keys[$nsKey][$itemKey], 0, SEEK_END);
+ fseek($this->keys[$nsKey][$itemKey], 0, SEEK_END);
}
- return $this->_keys[$nsKey][$itemKey];
+ return $this->keys[$nsKey][$itemKey];
}
- private function _freeHandle($nsKey, $itemKey)
+ private function freeHandle($nsKey, $itemKey)
{
- $fp = $this->_getHandle($nsKey, $itemKey, self::POSITION_CURRENT);
+ $fp = $this->getHandle($nsKey, $itemKey, self::POSITION_CURRENT);
fclose($fp);
- $this->_keys[$nsKey][$itemKey] = null;
+ $this->keys[$nsKey][$itemKey] = null;
}
/**
@@ -314,7 +288,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
*/
public function __destruct()
{
- foreach ($this->_keys as $nsKey => $null) {
+ foreach ($this->keys as $nsKey => $null) {
$this->clearAll($nsKey);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
index 4efe785648..957b1b2a00 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/NullKeyCache.php
@@ -34,10 +34,9 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
*
* @see MODE_WRITE, MODE_APPEND
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_OutputByteStream $os
- * @param int $mode
+ * @param string $nsKey
+ * @param string $itemKey
+ * @param int $mode
*/
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
{
@@ -48,9 +47,8 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
*
* NOTE: The stream will always write in append mode.
*
- * @param string $nsKey
- * @param string $itemKey
- * @param Swift_InputByteStream $writeThrough
+ * @param string $nsKey
+ * @param string $itemKey
*
* @return Swift_InputByteStream
*/
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
index b00d458a6d..03bab481ea 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
@@ -16,35 +16,31 @@
class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream
{
/** The KeyCache being written to */
- private $_keyCache;
+ private $keyCache;
/** The nsKey of the KeyCache being written to */
- private $_nsKey;
+ private $nsKey;
/** The itemKey of the KeyCache being written to */
- private $_itemKey;
+ private $itemKey;
/** A stream to write through on each write() */
- private $_writeThrough = null;
+ private $writeThrough = null;
/**
* Set the KeyCache to wrap.
- *
- * @param Swift_KeyCache $keyCache
*/
public function setKeyCache(Swift_KeyCache $keyCache)
{
- $this->_keyCache = $keyCache;
+ $this->keyCache = $keyCache;
}
/**
* Specify a stream to write through for each write().
- *
- * @param Swift_InputByteStream $is
*/
public function setWriteThroughStream(Swift_InputByteStream $is)
{
- $this->_writeThrough = $is;
+ $this->writeThrough = $is;
}
/**
@@ -55,14 +51,14 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
*/
public function write($bytes, Swift_InputByteStream $is = null)
{
- $this->_keyCache->setString(
- $this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND
+ $this->keyCache->setString(
+ $this->nsKey, $this->itemKey, $bytes, Swift_KeyCache::MODE_APPEND
);
if (isset($is)) {
$is->write($bytes);
}
- if (isset($this->_writeThrough)) {
- $this->_writeThrough->write($bytes);
+ if (isset($this->writeThrough)) {
+ $this->writeThrough->write($bytes);
}
}
@@ -93,7 +89,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
*/
public function flushBuffers()
{
- $this->_keyCache->clearKey($this->_nsKey, $this->_itemKey);
+ $this->keyCache->clearKey($this->nsKey, $this->itemKey);
}
/**
@@ -103,7 +99,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
*/
public function setNsKey($nsKey)
{
- $this->_nsKey = $nsKey;
+ $this->nsKey = $nsKey;
}
/**
@@ -113,7 +109,7 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
*/
public function setItemKey($itemKey)
{
- $this->_itemKey = $itemKey;
+ $this->itemKey = $itemKey;
}
/**
@@ -122,6 +118,6 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
*/
public function __clone()
{
- $this->_writeThrough = null;
+ $this->writeThrough = null;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
index e151b8a9c7..ce732af5f9 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/LoadBalancedTransport.php
@@ -20,26 +20,14 @@ class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport
*
* @param array $transports
*/
- public function __construct($transports = array())
+ public function __construct($transports = [])
{
call_user_func_array(
- array($this, 'Swift_Transport_LoadBalancedTransport::__construct'),
+ [$this, 'Swift_Transport_LoadBalancedTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.loadbalanced')
);
$this->setTransports($transports);
}
-
- /**
- * Create a new LoadBalancedTransport instance.
- *
- * @param array $transports
- *
- * @return self
- */
- public static function newInstance($transports = array())
- {
- return new self($transports);
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php
deleted file mode 100644
index 18556989a8..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MailTransport.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Sends Messages using the mail() function.
- *
- * @author Chris Corbyn
- *
- * @deprecated since 5.4.5 (to be removed in 6.0)
- */
-class Swift_MailTransport extends Swift_Transport_MailTransport
-{
- /**
- * Create a new MailTransport, optionally specifying $extraParams.
- *
- * @param string $extraParams
- */
- public function __construct($extraParams = '-f%s')
- {
- call_user_func_array(
- array($this, 'Swift_Transport_MailTransport::__construct'),
- Swift_DependencyContainer::getInstance()
- ->createDependenciesFor('transport.mail')
- );
-
- $this->setExtraParams($extraParams);
- }
-
- /**
- * Create a new MailTransport instance.
- *
- * @param string $extraParams To be passed to mail()
- *
- * @return self
- */
- public static function newInstance($extraParams = '-f%s')
- {
- return new self($extraParams);
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php
index 8314fe8fca..57630074cd 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php
@@ -16,28 +16,14 @@
class Swift_Mailer
{
/** The Transport used to send messages */
- private $_transport;
+ private $transport;
/**
* Create a new Mailer using $transport for delivery.
- *
- * @param Swift_Transport $transport
*/
public function __construct(Swift_Transport $transport)
{
- $this->_transport = $transport;
- }
-
- /**
- * Create a new Mailer instance.
- *
- * @param Swift_Transport $transport
- *
- * @return self
- */
- public static function newInstance(Swift_Transport $transport)
- {
- return new self($transport);
+ $this->transport = $transport;
}
/**
@@ -66,23 +52,23 @@ class Swift_Mailer
* The return value is the number of recipients who were accepted for
* delivery.
*
- * @param Swift_Mime_Message $message
- * @param array $failedRecipients An array of failures by-reference
+ * @param array $failedRecipients An array of failures by-reference
*
* @return int The number of successful recipients. Can be 0 which indicates failure
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$failedRecipients = (array) $failedRecipients;
- if (!$this->_transport->isStarted()) {
- $this->_transport->start();
+ // FIXME: to be removed in 7.0 (as transport must now start itself on send)
+ if (!$this->transport->isStarted()) {
+ $this->transport->start();
}
$sent = 0;
try {
- $sent = $this->_transport->send($message, $failedRecipients);
+ $sent = $this->transport->send($message, $failedRecipients);
} catch (Swift_RfcComplianceException $e) {
foreach ($message->getTo() as $address => $name) {
$failedRecipients[] = $address;
@@ -94,12 +80,10 @@ class Swift_Mailer
/**
* Register a plugin using a known unique key (e.g. myPlugin).
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
- $this->_transport->registerPlugin($plugin);
+ $this->transport->registerPlugin($plugin);
}
/**
@@ -109,6 +93,6 @@ class Swift_Mailer
*/
public function getTransport()
{
- return $this->_transport;
+ return $this->transport;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
index e3e6cad05b..19aa82a9c4 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ArrayRecipientIterator.php
@@ -20,16 +20,14 @@ class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientItera
*
* @var array
*/
- private $_recipients = array();
+ private $recipients = [];
/**
* Create a new ArrayRecipientIterator from $recipients.
- *
- * @param array $recipients
*/
public function __construct(array $recipients)
{
- $this->_recipients = $recipients;
+ $this->recipients = $recipients;
}
/**
@@ -39,7 +37,7 @@ class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientItera
*/
public function hasNext()
{
- return !empty($this->_recipients);
+ return !empty($this->recipients);
}
/**
@@ -50,6 +48,6 @@ class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientItera
*/
public function nextRecipient()
{
- return array_splice($this->_recipients, 0, 1);
+ return array_splice($this->recipients, 0, 1);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php
index 2cafb67517..e3b0894d87 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MemorySpool.php
@@ -15,7 +15,7 @@
*/
class Swift_MemorySpool implements Swift_Spool
{
- protected $messages = array();
+ protected $messages = [];
private $flushRetries = 3;
/**
@@ -53,11 +53,11 @@ class Swift_MemorySpool implements Swift_Spool
/**
* Stores a message in the queue.
*
- * @param Swift_Mime_Message $message The message to store
+ * @param Swift_Mime_SimpleMessage $message The message to store
*
* @return bool Whether the operation has succeeded
*/
- public function queueMessage(Swift_Mime_Message $message)
+ public function queueMessage(Swift_Mime_SimpleMessage $message)
{
//clone the message to make sure it is not changed while in the queue
$this->messages[] = clone $message;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php
index 242cbf314f..42b861fc12 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Message.php
@@ -18,17 +18,17 @@ class Swift_Message extends Swift_Mime_SimpleMessage
/**
* @var Swift_Signers_HeaderSigner[]
*/
- private $headerSigners = array();
+ private $headerSigners = [];
/**
* @var Swift_Signers_BodySigner[]
*/
- private $bodySigners = array();
+ private $bodySigners = [];
/**
* @var array
*/
- private $savedMessage = array();
+ private $savedMessage = [];
/**
* Create a new Message.
@@ -43,7 +43,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
public function __construct($subject = null, $body = null, $contentType = null, $charset = null)
{
call_user_func_array(
- array($this, 'Swift_Mime_SimpleMessage::__construct'),
+ [$this, 'Swift_Mime_SimpleMessage::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.message')
);
@@ -61,21 +61,6 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
- * Create a new Message.
- *
- * @param string $subject
- * @param string $body
- * @param string $contentType
- * @param string $charset
- *
- * @return $this
- */
- public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null)
- {
- return new self($subject, $body, $contentType, $charset);
- }
-
- /**
* Add a MimePart to this Message.
*
* @param string|Swift_OutputByteStream $body
@@ -86,13 +71,11 @@ class Swift_Message extends Swift_Mime_SimpleMessage
*/
public function addPart($body, $contentType = null, $charset = null)
{
- return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder()));
+ return $this->attach((new Swift_MimePart($body, $contentType, $charset))->setEncoder($this->getEncoder()));
}
/**
- * Detach a signature handler from a message.
- *
- * @param Swift_Signer $signer
+ * Attach a new signature handler to the message.
*
* @return $this
*/
@@ -108,9 +91,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
- * Attach a new signature handler to the message.
- *
- * @param Swift_Signer $signer
+ * Detach a signature handler from a message.
*
* @return $this
*/
@@ -138,6 +119,19 @@ class Swift_Message extends Swift_Mime_SimpleMessage
}
/**
+ * Clear all signature handlers attached to the message.
+ *
+ * @return $this
+ */
+ public function clearSigners()
+ {
+ $this->headerSigners = [];
+ $this->bodySigners = [];
+
+ return $this;
+ }
+
+ /**
* Get this message as a complete string.
*
* @return string
@@ -161,8 +155,6 @@ class Swift_Message extends Swift_Mime_SimpleMessage
/**
* Write this message to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream $is
*/
public function toByteStream(Swift_InputByteStream $is)
{
@@ -205,7 +197,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
$signer->setHeaders($this->getHeaders());
$signer->startBody();
- $this->_bodyToByteStream($signer);
+ $this->bodyToByteStream($signer);
$signer->endBody();
$signer->addSignature($this->getHeaders());
@@ -217,19 +209,17 @@ class Swift_Message extends Swift_Mime_SimpleMessage
*/
protected function saveMessage()
{
- $this->savedMessage = array('headers' => array());
+ $this->savedMessage = ['headers' => []];
$this->savedMessage['body'] = $this->getBody();
$this->savedMessage['children'] = $this->getChildren();
- if (count($this->savedMessage['children']) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->_becomeMimePart()), $this->savedMessage['children']));
+ if (count($this->savedMessage['children']) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $this->savedMessage['children']));
$this->setBody('');
}
}
/**
* save the original headers.
- *
- * @param array $altered
*/
protected function saveHeaders(array $altered)
{
@@ -267,7 +257,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
$this->setChildren($this->savedMessage['children']);
$this->restoreHeaders();
- $this->savedMessage = array();
+ $this->savedMessage = [];
}
/**
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php
index d5ba14b91c..917007e464 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Attachment.php
@@ -16,23 +16,19 @@
class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
{
/** Recognized MIME types */
- private $_mimeTypes = array();
+ private $mimeTypes = [];
/**
* Create a new Attachment with $headers, $encoder and $cache.
*
- * @param Swift_Mime_HeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_Mime_Grammar $grammar
- * @param array $mimeTypes optional
+ * @param array $mimeTypes
*/
- public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $mimeTypes = array())
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
{
- parent::__construct($headers, $encoder, $cache, $grammar);
+ parent::__construct($headers, $encoder, $cache, $idGenerator);
$this->setDisposition('attachment');
$this->setContentType('application/octet-stream');
- $this->_mimeTypes = $mimeTypes;
+ $this->mimeTypes = $mimeTypes;
}
/**
@@ -56,7 +52,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function getDisposition()
{
- return $this->_getHeaderFieldModel('Content-Disposition');
+ return $this->getHeaderFieldModel('Content-Disposition');
}
/**
@@ -68,7 +64,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function setDisposition($disposition)
{
- if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) {
+ if (!$this->setHeaderFieldModel('Content-Disposition', $disposition)) {
$this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition);
}
@@ -82,7 +78,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function getFilename()
{
- return $this->_getHeaderParameter('Content-Disposition', 'filename');
+ return $this->getHeaderParameter('Content-Disposition', 'filename');
}
/**
@@ -94,8 +90,8 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function setFilename($filename)
{
- $this->_setHeaderParameter('Content-Disposition', 'filename', $filename);
- $this->_setHeaderParameter('Content-Type', 'name', $filename);
+ $this->setHeaderParameter('Content-Disposition', 'filename', $filename);
+ $this->setHeaderParameter('Content-Type', 'name', $filename);
return $this;
}
@@ -107,7 +103,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function getSize()
{
- return $this->_getHeaderParameter('Content-Disposition', 'size');
+ return $this->getHeaderParameter('Content-Disposition', 'size');
}
/**
@@ -119,7 +115,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
*/
public function setSize($size)
{
- $this->_setHeaderParameter('Content-Disposition', 'size', $size);
+ $this->setHeaderParameter('Content-Disposition', 'size', $size);
return $this;
}
@@ -127,8 +123,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
/**
* Set the file that this attachment is for.
*
- * @param Swift_FileStream $file
- * @param string $contentType optional
+ * @param string $contentType optional
*
* @return $this
*/
@@ -139,8 +134,8 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
if (!isset($contentType)) {
$extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1));
- if (array_key_exists($extension, $this->_mimeTypes)) {
- $this->setContentType($this->_mimeTypes[$extension]);
+ if (array_key_exists($extension, $this->mimeTypes)) {
+ $this->setContentType($this->mimeTypes[$extension]);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
index 8f76d70f35..8c4e2266f4 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/Base64ContentEncoder.php
@@ -18,10 +18,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset
- * @param int $maxLineLength, optional, 0 indicates the default of 76 bytes
+ * @param int $firstLineOffset
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
@@ -41,7 +38,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
// When the OutputStream is empty, we must flush any remainder bytes.
while (true) {
$readBytes = $os->read(8192);
- $atEOF = ($readBytes === false);
+ $atEOF = (false === $readBytes);
if ($atEOF) {
$streamTheseBytes = $base64ReadBufferRemainderBytes;
@@ -51,7 +48,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
$base64ReadBufferRemainderBytes = null;
$bytesLength = strlen($streamTheseBytes);
- if ($bytesLength === 0) { // no data left to encode
+ if (0 === $bytesLength) { // no data left to encode
break;
}
@@ -59,7 +56,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoder extends Swift_Encoder_Base6
// and carry over remainder 1-2 bytes to the next loop iteration
if (!$atEOF) {
$excessBytes = $bytesLength % 3;
- if ($excessBytes !== 0) {
+ if (0 !== $excessBytes) {
$base64ReadBufferRemainderBytes = substr($streamTheseBytes, -$excessBytes);
$streamTheseBytes = substr($streamTheseBytes, 0, $bytesLength - $excessBytes);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
index 710b5ac9ed..9aae487180 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NativeQpContentEncoder.php
@@ -50,7 +50,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
- if ($this->charset !== 'utf-8') {
+ if ('utf-8' !== $this->charset) {
throw new RuntimeException(
sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
@@ -87,12 +87,12 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- if ($this->charset !== 'utf-8') {
+ if ('utf-8' !== $this->charset) {
throw new RuntimeException(
sprintf('Charset "%s" not supported. NativeQpContentEncoder only supports "utf-8"', $this->charset));
}
- return $this->_standardize(quoted_printable_encode($string));
+ return $this->standardize(quoted_printable_encode($string));
}
/**
@@ -102,14 +102,14 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoder implements Swift_Mime_Con
*
* @return string
*/
- protected function _standardize($string)
+ protected function standardize($string)
{
// transform CR or LF to CRLF
$string = preg_replace('~=0D(?!=0A)|(?<!=0D)=0A~', '=0D=0A', $string);
// transform =0D=0A to CRLF
- $string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'), array("=09\r\n", "=20\r\n", "\r\n"), $string);
+ $string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'], ["=09\r\n", "=20\r\n", "\r\n"], $string);
- switch ($end = ord(substr($string, -1))) {
+ switch (ord(substr($string, -1))) {
case 0x09:
$string = substr_replace($string, '=09', -1);
break;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php
new file mode 100644
index 0000000000..e23507337c
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/NullContentEncoder.php
@@ -0,0 +1,79 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Handles the case where the email body is already encoded and you just need specify the correct
+ * encoding without actually changing the encoding of the body.
+ *
+ * @author Jan Flora <jf@penneo.com>
+ */
+class Swift_Mime_ContentEncoder_NullContentEncoder implements Swift_Mime_ContentEncoder
+{
+ /**
+ * The name of this encoding scheme (probably 7bit or 8bit).
+ *
+ * @var string
+ */
+ private $_name;
+
+ /**
+ * Creates a new NullContentEncoder with $name (probably 7bit or 8bit).
+ *
+ * @param string $name
+ */
+ public function __construct($name)
+ {
+ $this->_name = $name;
+ }
+
+ /**
+ * Encode a given string to produce an encoded string.
+ *
+ * @param string $string
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
+ *
+ * @return string
+ */
+ public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
+ {
+ return $string;
+ }
+
+ /**
+ * Encode stream $in to stream $out.
+ *
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
+ */
+ public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
+ {
+ while (false !== ($bytes = $os->read(8192))) {
+ $is->write($bytes);
+ }
+ }
+
+ /**
+ * Get the name of this encoding scheme.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->_name;
+ }
+
+ /**
+ * Not used.
+ */
+ public function charsetChanged($charset)
+ {
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
index 219f482ce8..aa634f54ee 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
@@ -11,6 +11,10 @@
/**
* Handles binary/7/8-bit Transfer Encoding in Swift Mailer.
*
+ * When sending 8-bit content over SMTP, you should use
+ * Swift_Transport_Esmtp_EightBitMimeHandler to enable the 8BITMIME SMTP
+ * extension.
+ *
* @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_ContentEncoder
@@ -20,14 +24,14 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*
* @var string
*/
- private $_name;
+ private $name;
/**
* True if canonical transformations should be done.
*
* @var bool
*/
- private $_canonical;
+ private $canonical;
/**
* Creates a new PlainContentEncoder with $name (probably 7bit or 8bit).
@@ -37,8 +41,8 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*/
public function __construct($name, $canonical = false)
{
- $this->_name = $name;
- $this->_canonical = $canonical;
+ $this->name = $name;
+ $this->canonical = $canonical;
}
/**
@@ -52,30 +56,28 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- if ($this->_canonical) {
- $string = $this->_canonicalize($string);
+ if ($this->canonical) {
+ $string = $this->canonicalize($string);
}
- return $this->_safeWordWrap($string, $maxLineLength, "\r\n");
+ return $this->safeWordwrap($string, $maxLineLength, "\r\n");
}
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $os
- * @param Swift_InputByteStream $is
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength optional, 0 means no wrapping will occur
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength optional, 0 means no wrapping will occur
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
$leftOver = '';
while (false !== $bytes = $os->read(8192)) {
$toencode = $leftOver.$bytes;
- if ($this->_canonical) {
- $toencode = $this->_canonicalize($toencode);
+ if ($this->canonical) {
+ $toencode = $this->canonicalize($toencode);
}
- $wrapped = $this->_safeWordWrap($toencode, $maxLineLength, "\r\n");
+ $wrapped = $this->safeWordwrap($toencode, $maxLineLength, "\r\n");
$lastLinePos = strrpos($wrapped, "\r\n");
$leftOver = substr($wrapped, $lastLinePos);
$wrapped = substr($wrapped, 0, $lastLinePos);
@@ -94,7 +96,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*/
public function getName()
{
- return $this->_name;
+ return $this->name;
}
/**
@@ -113,7 +115,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*
* @return string
*/
- private function _safeWordwrap($string, $length = 75, $le = "\r\n")
+ private function safeWordwrap($string, $length = 75, $le = "\r\n")
{
if (0 >= $length) {
return $string;
@@ -121,7 +123,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
$originalLines = explode($le, $string);
- $lines = array();
+ $lines = [];
$lineCount = 0;
foreach ($originalLines as $originalLine) {
@@ -151,11 +153,11 @@ class Swift_Mime_ContentEncoder_PlainContentEncoder implements Swift_Mime_Conten
*
* @return string
*/
- private function _canonicalize($string)
+ private function canonicalize($string)
{
return str_replace(
- array("\r\n", "\r", "\n"),
- array("\n", "\n", "\r\n"),
+ ["\r\n", "\r", "\n"],
+ ["\n", "\n", "\r\n"],
$string
);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
index 5cc907b8e7..84e3d2475d 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
@@ -11,11 +11,11 @@
/**
* Handles Quoted Printable (QP) Transfer Encoding in Swift Mailer.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder implements Swift_Mime_ContentEncoder
{
- protected $_dotEscape;
+ protected $dotEscape;
/**
* Creates a new QpContentEncoder for the given CharacterStream.
@@ -26,26 +26,26 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
*/
public function __construct(Swift_CharacterStream $charStream, Swift_StreamFilter $filter = null, $dotEscape = false)
{
- $this->_dotEscape = $dotEscape;
+ $this->dotEscape = $dotEscape;
parent::__construct($charStream, $filter);
}
public function __sleep()
{
- return array('_charStream', '_filter', '_dotEscape');
+ return ['charStream', 'filter', 'dotEscape'];
}
protected function getSafeMapShareId()
{
- return get_class($this).($this->_dotEscape ? '.dotEscape' : '');
+ return get_class($this).($this->dotEscape ? '.dotEscape' : '');
}
protected function initSafeMap()
{
parent::initSafeMap();
- if ($this->_dotEscape) {
+ if ($this->dotEscape) {
/* Encode . as =2e for buggy remote servers */
- unset($this->_safeMap[0x2e]);
+ unset($this->safeMap[0x2e]);
}
}
@@ -69,20 +69,20 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
$thisLineLength = $maxLineLength - $firstLineOffset;
- $this->_charStream->flushContents();
- $this->_charStream->importByteStream($os);
+ $this->charStream->flushContents();
+ $this->charStream->importByteStream($os);
$currentLine = '';
$prepend = '';
$size = $lineLen = 0;
- while (false !== $bytes = $this->_nextSequence()) {
+ while (false !== $bytes = $this->nextSequence()) {
// If we're filtering the input
- if (isset($this->_filter)) {
+ if (isset($this->filter)) {
// If we can't filter because we need more bytes
- while ($this->_filter->shouldBuffer($bytes)) {
+ while ($this->filter->shouldBuffer($bytes)) {
// Then collect bytes into the buffer
- if (false === $moreBytes = $this->_nextSequence(1)) {
+ if (false === $moreBytes = $this->nextSequence(1)) {
break;
}
@@ -91,16 +91,16 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
}
}
// And filter them
- $bytes = $this->_filter->filter($bytes);
+ $bytes = $this->filter->filter($bytes);
}
- $enc = $this->_encodeByteSequence($bytes, $size);
+ $enc = $this->encodeByteSequence($bytes, $size);
$i = strpos($enc, '=0D=0A');
- $newLineLength = $lineLen + ($i === false ? $size : $i);
+ $newLineLength = $lineLen + (false === $i ? $size : $i);
if ($currentLine && $newLineLength >= $thisLineLength) {
- $is->write($prepend.$this->_standardize($currentLine));
+ $is->write($prepend.$this->standardize($currentLine));
$currentLine = '';
$prepend = "=\r\n";
$thisLineLength = $maxLineLength;
@@ -109,7 +109,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
$currentLine .= $enc;
- if ($i === false) {
+ if (false === $i) {
$lineLen += $size;
} else {
// 6 is the length of '=0D=0A'.
@@ -117,7 +117,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoder extends Swift_Encoder_QpEncoder
}
}
if (strlen($currentLine)) {
- $is->write($prepend.$this->_standardize($currentLine));
+ $is->write($prepend.$this->standardize($currentLine));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
index 3214e1cf3f..1b06da8c73 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
@@ -35,9 +35,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderProxy implements Swift_Mime_Cont
/**
* Constructor.
*
- * @param Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder
- * @param Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder
- * @param string|null $charset
+ * @param string|null $charset
*/
public function __construct(Swift_Mime_ContentEncoder_QpContentEncoder $safeEncoder, Swift_Mime_ContentEncoder_NativeQpContentEncoder $nativeEncoder, $charset)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
index 0b8526e38c..870e7f41a9 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ContentEncoder/RawContentEncoder.php
@@ -11,6 +11,9 @@
/**
* Handles raw Transfer Encoding in Swift Mailer.
*
+ * When sending 8-bit content over SMTP, you should use
+ * Swift_Transport_Esmtp_EightBitMimeHandler to enable the 8BITMIME SMTP
+ * extension.
*
* @author Sebastiaan Stok <s.stok@rollerscapes.net>
*/
@@ -33,10 +36,8 @@ class Swift_Mime_ContentEncoder_RawContentEncoder implements Swift_Mime_ContentE
/**
* Encode stream $in to stream $out.
*
- * @param Swift_OutputByteStream $in
- * @param Swift_InputByteStream $out
- * @param int $firstLineOffset ignored
- * @param int $maxLineLength ignored
+ * @param int $firstLineOffset ignored
+ * @param int $maxLineLength ignored
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
index 6af757124d..42a51770c7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/EmbeddedFile.php
@@ -18,15 +18,11 @@ class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment
/**
* Creates a new Attachment with $headers and $encoder.
*
- * @param Swift_Mime_HeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_Mime_Grammar $grammar
- * @param array $mimeTypes optional
+ * @param array $mimeTypes optional
*/
- public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $mimeTypes = array())
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = [])
{
- parent::__construct($headers, $encoder, $cache, $grammar, $mimeTypes);
+ parent::__construct($headers, $encoder, $cache, $idGenerator, $mimeTypes);
$this->setDisposition('inline');
$this->setId($this->getId());
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php
deleted file mode 100644
index a09f338315..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Grammar.php
+++ /dev/null
@@ -1,176 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Defines the grammar to use for validation, implements the RFC 2822 (and friends) ABNF grammar definitions.
- *
- * @author Fabien Potencier
- * @author Chris Corbyn
- */
-class Swift_Mime_Grammar
-{
- /**
- * Special characters used in the syntax which need to be escaped.
- *
- * @var string[]
- */
- private static $_specials = array();
-
- /**
- * Tokens defined in RFC 2822 (and some related RFCs).
- *
- * @var string[]
- */
- private static $_grammar = array();
-
- /**
- * Initialize some RFC 2822 (and friends) ABNF grammar definitions.
- */
- public function __construct()
- {
- $this->init();
- }
-
- public function __wakeup()
- {
- $this->init();
- }
-
- protected function init()
- {
- if (count(self::$_specials) > 0) {
- return;
- }
-
- self::$_specials = array(
- '(', ')', '<', '>', '[', ']',
- ':', ';', '@', ',', '.', '"',
- );
-
- /*** Refer to RFC 2822 for ABNF grammar ***/
-
- // All basic building blocks
- self::$_grammar['NO-WS-CTL'] = '[\x01-\x08\x0B\x0C\x0E-\x19\x7F]';
- self::$_grammar['WSP'] = '[ \t]';
- self::$_grammar['CRLF'] = '(?:\r\n)';
- self::$_grammar['FWS'] = '(?:(?:'.self::$_grammar['WSP'].'*'.
- self::$_grammar['CRLF'].')?'.self::$_grammar['WSP'].')';
- self::$_grammar['text'] = '[\x00-\x08\x0B\x0C\x0E-\x7F]';
- self::$_grammar['quoted-pair'] = '(?:\\\\'.self::$_grammar['text'].')';
- self::$_grammar['ctext'] = '(?:'.self::$_grammar['NO-WS-CTL'].
- '|[\x21-\x27\x2A-\x5B\x5D-\x7E])';
- // Uses recursive PCRE (?1) -- could be a weak point??
- self::$_grammar['ccontent'] = '(?:'.self::$_grammar['ctext'].'|'.
- self::$_grammar['quoted-pair'].'|(?1))';
- self::$_grammar['comment'] = '(\((?:'.self::$_grammar['FWS'].'|'.
- self::$_grammar['ccontent'].')*'.self::$_grammar['FWS'].'?\))';
- self::$_grammar['CFWS'] = '(?:(?:'.self::$_grammar['FWS'].'?'.
- self::$_grammar['comment'].')*(?:(?:'.self::$_grammar['FWS'].'?'.
- self::$_grammar['comment'].')|'.self::$_grammar['FWS'].'))';
- self::$_grammar['qtext'] = '(?:'.self::$_grammar['NO-WS-CTL'].
- '|[\x21\x23-\x5B\x5D-\x7E])';
- self::$_grammar['qcontent'] = '(?:'.self::$_grammar['qtext'].'|'.
- self::$_grammar['quoted-pair'].')';
- self::$_grammar['quoted-string'] = '(?:'.self::$_grammar['CFWS'].'?"'.
- '('.self::$_grammar['FWS'].'?'.self::$_grammar['qcontent'].')*'.
- self::$_grammar['FWS'].'?"'.self::$_grammar['CFWS'].'?)';
- self::$_grammar['atext'] = '[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]';
- self::$_grammar['atom'] = '(?:'.self::$_grammar['CFWS'].'?'.
- self::$_grammar['atext'].'+'.self::$_grammar['CFWS'].'?)';
- self::$_grammar['dot-atom-text'] = '(?:'.self::$_grammar['atext'].'+'.
- '(\.'.self::$_grammar['atext'].'+)*)';
- self::$_grammar['dot-atom'] = '(?:'.self::$_grammar['CFWS'].'?'.
- self::$_grammar['dot-atom-text'].'+'.self::$_grammar['CFWS'].'?)';
- self::$_grammar['word'] = '(?:'.self::$_grammar['atom'].'|'.
- self::$_grammar['quoted-string'].')';
- self::$_grammar['phrase'] = '(?:'.self::$_grammar['word'].'+?)';
- self::$_grammar['no-fold-quote'] = '(?:"(?:'.self::$_grammar['qtext'].
- '|'.self::$_grammar['quoted-pair'].')*")';
- self::$_grammar['dtext'] = '(?:'.self::$_grammar['NO-WS-CTL'].
- '|[\x21-\x5A\x5E-\x7E])';
- self::$_grammar['no-fold-literal'] = '(?:\[(?:'.self::$_grammar['dtext'].
- '|'.self::$_grammar['quoted-pair'].')*\])';
-
- // Message IDs
- self::$_grammar['id-left'] = '(?:'.self::$_grammar['dot-atom-text'].'|'.
- self::$_grammar['no-fold-quote'].')';
- self::$_grammar['id-right'] = '(?:'.self::$_grammar['dot-atom-text'].'|'.
- self::$_grammar['no-fold-literal'].')';
-
- // Addresses, mailboxes and paths
- self::$_grammar['local-part'] = '(?:'.self::$_grammar['dot-atom'].'|'.
- self::$_grammar['quoted-string'].')';
- self::$_grammar['dcontent'] = '(?:'.self::$_grammar['dtext'].'|'.
- self::$_grammar['quoted-pair'].')';
- self::$_grammar['domain-literal'] = '(?:'.self::$_grammar['CFWS'].'?\[('.
- self::$_grammar['FWS'].'?'.self::$_grammar['dcontent'].')*?'.
- self::$_grammar['FWS'].'?\]'.self::$_grammar['CFWS'].'?)';
- self::$_grammar['domain'] = '(?:'.self::$_grammar['dot-atom'].'|'.
- self::$_grammar['domain-literal'].')';
- self::$_grammar['addr-spec'] = '(?:'.self::$_grammar['local-part'].'@'.
- self::$_grammar['domain'].')';
- }
-
- /**
- * Get the grammar defined for $name token.
- *
- * @param string $name exactly as written in the RFC
- *
- * @return string
- */
- public function getDefinition($name)
- {
- if (array_key_exists($name, self::$_grammar)) {
- return self::$_grammar[$name];
- }
-
- throw new Swift_RfcComplianceException(
- "No such grammar '".$name."' defined."
- );
- }
-
- /**
- * Returns the tokens defined in RFC 2822 (and some related RFCs).
- *
- * @return array
- */
- public function getGrammarDefinitions()
- {
- return self::$_grammar;
- }
-
- /**
- * Returns the current special characters used in the syntax which need to be escaped.
- *
- * @return array
- */
- public function getSpecials()
- {
- return self::$_specials;
- }
-
- /**
- * Escape special characters in a string (convert to quoted-pairs).
- *
- * @param string $token
- * @param string[] $include additional chars to escape
- * @param string[] $exclude chars from escaping
- *
- * @return string
- */
- public function escapeSpecials($token, $include = array(), $exclude = array())
- {
- foreach (array_merge(array('\\'), array_diff(self::$_specials, $exclude), $include) as $char) {
- $token = str_replace($char, '\\'.$char, $token);
- }
-
- return $token;
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php
index a8ddd27216..ca712f35aa 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Header.php
@@ -85,7 +85,7 @@ interface Swift_Mime_Header
public function getFieldBody();
/**
- * Get this Header rendered as a compliant string.
+ * Get this Header rendered as a compliant string, including trailing CRLF.
*
* @return string
*/
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
index 83a4f2f3b2..c440357516 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/Base64HeaderEncoder.php
@@ -41,7 +41,7 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoder extends Swift_Encoder_Base64E
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0, $charset = 'utf-8')
{
- if (strtolower($charset) === 'iso-2022-jp') {
+ if ('iso-2022-jp' === strtolower($charset)) {
$old = mb_internal_encoding();
mb_internal_encoding('utf-8');
$newstring = mb_encode_mimeheader($string, $charset, $this->getName(), "\r\n");
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
index 510dd6637b..0eef3e1e76 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderEncoder/QpHeaderEncoder.php
@@ -29,9 +29,9 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder i
{
foreach (array_merge(
range(0x61, 0x7A), range(0x41, 0x5A),
- range(0x30, 0x39), array(0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F)
+ range(0x30, 0x39), [0x20, 0x21, 0x2A, 0x2B, 0x2D, 0x2F]
) as $byte) {
- $this->_safeMap[$byte] = chr($byte);
+ $this->safeMap[$byte] = chr($byte);
}
}
@@ -58,7 +58,7 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoder extends Swift_Encoder_QpEncoder i
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
- return str_replace(array(' ', '=20', "=\r\n"), array('_', '_', "\r\n"),
+ return str_replace([' ', '=20', "=\r\n"], ['_', '_', "\r\n"],
parent::encodeString($string, $firstLineOffset, $maxLineLength)
);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php
deleted file mode 100644
index c65f26d721..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderFactory.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Creates MIME headers.
- *
- * @author Chris Corbyn
- */
-interface Swift_Mime_HeaderFactory extends Swift_Mime_CharsetObserver
-{
- /**
- * Create a new Mailbox Header with a list of $addresses.
- *
- * @param string $name
- * @param array|string $addresses
- *
- * @return Swift_Mime_Header
- */
- public function createMailboxHeader($name, $addresses = null);
-
- /**
- * Create a new Date header using $timestamp (UNIX time).
- *
- * @param string $name
- * @param int $timestamp
- *
- * @return Swift_Mime_Header
- */
- public function createDateHeader($name, $timestamp = null);
-
- /**
- * Create a new basic text header with $name and $value.
- *
- * @param string $name
- * @param string $value
- *
- * @return Swift_Mime_Header
- */
- public function createTextHeader($name, $value = null);
-
- /**
- * Create a new ParameterizedHeader with $name, $value and $params.
- *
- * @param string $name
- * @param string $value
- * @param array $params
- *
- * @return Swift_Mime_ParameterizedHeader
- */
- public function createParameterizedHeader($name, $value = null, $params = array());
-
- /**
- * Create a new ID header for Message-ID or Content-ID.
- *
- * @param string $name
- * @param string|array $ids
- *
- * @return Swift_Mime_Header
- */
- public function createIdHeader($name, $ids = null);
-
- /**
- * Create a new Path header with an address (path) in it.
- *
- * @param string $name
- * @param string $path
- *
- * @return Swift_Mime_Header
- */
- public function createPathHeader($name, $path = null);
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php
deleted file mode 100644
index 1768709e92..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/HeaderSet.php
+++ /dev/null
@@ -1,169 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * A collection of MIME headers.
- *
- * @author Chris Corbyn
- */
-interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
-{
- /**
- * Add a new Mailbox Header with a list of $addresses.
- *
- * @param string $name
- * @param array|string $addresses
- */
- public function addMailboxHeader($name, $addresses = null);
-
- /**
- * Add a new Date header using $timestamp (UNIX time).
- *
- * @param string $name
- * @param int $timestamp
- */
- public function addDateHeader($name, $timestamp = null);
-
- /**
- * Add a new basic text header with $name and $value.
- *
- * @param string $name
- * @param string $value
- */
- public function addTextHeader($name, $value = null);
-
- /**
- * Add a new ParameterizedHeader with $name, $value and $params.
- *
- * @param string $name
- * @param string $value
- * @param array $params
- */
- public function addParameterizedHeader($name, $value = null, $params = array());
-
- /**
- * Add a new ID header for Message-ID or Content-ID.
- *
- * @param string $name
- * @param string|array $ids
- */
- public function addIdHeader($name, $ids = null);
-
- /**
- * Add a new Path header with an address (path) in it.
- *
- * @param string $name
- * @param string $path
- */
- public function addPathHeader($name, $path = null);
-
- /**
- * Returns true if at least one header with the given $name exists.
- *
- * If multiple headers match, the actual one may be specified by $index.
- *
- * @param string $name
- * @param int $index
- *
- * @return bool
- */
- public function has($name, $index = 0);
-
- /**
- * Set a header in the HeaderSet.
- *
- * The header may be a previously fetched header via {@link get()} or it may
- * be one that has been created separately.
- *
- * If $index is specified, the header will be inserted into the set at this
- * offset.
- *
- * @param Swift_Mime_Header $header
- * @param int $index
- */
- public function set(Swift_Mime_Header $header, $index = 0);
-
- /**
- * Get the header with the given $name.
- * If multiple headers match, the actual one may be specified by $index.
- * Returns NULL if none present.
- *
- * @param string $name
- * @param int $index
- *
- * @return Swift_Mime_Header
- */
- public function get($name, $index = 0);
-
- /**
- * Get all headers with the given $name.
- *
- * @param string $name
- *
- * @return array
- */
- public function getAll($name = null);
-
- /**
- * Return the name of all Headers.
- *
- * @return array
- */
- public function listAll();
-
- /**
- * Remove the header with the given $name if it's set.
- *
- * If multiple headers match, the actual one may be specified by $index.
- *
- * @param string $name
- * @param int $index
- */
- public function remove($name, $index = 0);
-
- /**
- * Remove all headers with the given $name.
- *
- * @param string $name
- */
- public function removeAll($name);
-
- /**
- * Create a new instance of this HeaderSet.
- *
- * @return self
- */
- public function newInstance();
-
- /**
- * Define a list of Header names as an array in the correct order.
- *
- * These Headers will be output in the given order where present.
- *
- * @param array $sequence
- */
- public function defineOrdering(array $sequence);
-
- /**
- * Set a list of header names which must always be displayed when set.
- *
- * Usually headers without a field value won't be output unless set here.
- *
- * @param array $names
- */
- public function setAlwaysDisplayed(array $names);
-
- /**
- * Returns a string with a representation of all headers.
- *
- * @return string
- */
- public function toString();
-}
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 3a6d7b39e8..3a19404a6f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/AbstractHeader.php
@@ -11,68 +11,53 @@
/**
* An abstract base MIME Header.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
{
+ const PHRASE_PATTERN = '(?:(?:(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]+(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?)|(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?"((?:(?:[ \t]*(?:\r\n))?[ \t])?(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21\x23-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])))*(?:(?:[ \t]*(?:\r\n))?[ \t])?"(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?))+?)';
+
/**
* The name of this Header.
*
* @var string
*/
- private $_name;
-
- /**
- * The Grammar used for this Header.
- *
- * @var Swift_Mime_Grammar
- */
- private $_grammar;
+ private $name;
/**
* The Encoder used to encode this Header.
*
* @var Swift_Encoder
*/
- private $_encoder;
+ private $encoder;
/**
* The maximum length of a line in the header.
*
* @var int
*/
- private $_lineLength = 78;
+ private $lineLength = 78;
/**
* The language used in this Header.
*
* @var string
*/
- private $_lang;
+ private $lang;
/**
* The character set of the text in this Header.
*
* @var string
*/
- private $_charset = 'utf-8';
+ private $charset = 'utf-8';
/**
* The value of this Header, cached.
*
* @var string
*/
- private $_cachedValue = null;
-
- /**
- * Creates a new Header.
- *
- * @param Swift_Mime_Grammar $grammar
- */
- public function __construct(Swift_Mime_Grammar $grammar)
- {
- $this->setGrammar($grammar);
- }
+ private $cachedValue = null;
/**
* Set the character set used in this Header.
@@ -81,10 +66,10 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function setCharset($charset)
{
- $this->clearCachedValueIf($charset != $this->_charset);
- $this->_charset = $charset;
- if (isset($this->_encoder)) {
- $this->_encoder->charsetChanged($charset);
+ $this->clearCachedValueIf($charset != $this->charset);
+ $this->charset = $charset;
+ if (isset($this->encoder)) {
+ $this->encoder->charsetChanged($charset);
}
}
@@ -95,7 +80,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function getCharset()
{
- return $this->_charset;
+ return $this->charset;
}
/**
@@ -108,8 +93,8 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function setLanguage($lang)
{
- $this->clearCachedValueIf($this->_lang != $lang);
- $this->_lang = $lang;
+ $this->clearCachedValueIf($this->lang != $lang);
+ $this->lang = $lang;
}
/**
@@ -119,17 +104,15 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function getLanguage()
{
- return $this->_lang;
+ return $this->lang;
}
/**
* Set the encoder used for encoding the header.
- *
- * @param Swift_Mime_HeaderEncoder $encoder
*/
public function setEncoder(Swift_Mime_HeaderEncoder $encoder)
{
- $this->_encoder = $encoder;
+ $this->encoder = $encoder;
$this->setCachedValue(null);
}
@@ -140,28 +123,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function getEncoder()
{
- return $this->_encoder;
- }
-
- /**
- * Set the grammar used for the header.
- *
- * @param Swift_Mime_Grammar $grammar
- */
- public function setGrammar(Swift_Mime_Grammar $grammar)
- {
- $this->_grammar = $grammar;
- $this->setCachedValue(null);
- }
-
- /**
- * Get the grammar used for this Header.
- *
- * @return Swift_Mime_Grammar
- */
- public function getGrammar()
- {
- return $this->_grammar;
+ return $this->encoder;
}
/**
@@ -171,7 +133,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function getFieldName()
{
- return $this->_name;
+ return $this->name;
}
/**
@@ -181,8 +143,8 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function setMaxLineLength($lineLength)
{
- $this->clearCachedValueIf($this->_lineLength != $lineLength);
- $this->_lineLength = $lineLength;
+ $this->clearCachedValueIf($this->lineLength != $lineLength);
+ $this->lineLength = $lineLength;
}
/**
@@ -192,19 +154,19 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
public function getMaxLineLength()
{
- return $this->_lineLength;
+ return $this->lineLength;
}
/**
* Get this Header rendered as a RFC 2822 compliant string.
*
- * @throws Swift_RfcComplianceException
- *
* @return string
+ *
+ * @throws Swift_RfcComplianceException
*/
public function toString()
{
- return $this->_tokensToString($this->toTokens());
+ return $this->tokensToString($this->toTokens());
}
/**
@@ -226,17 +188,15 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function setFieldName($name)
{
- $this->_name = $name;
+ $this->name = $name;
}
/**
* Produces a compliant, formatted RFC 2822 'phrase' based on the string given.
*
- * @param Swift_Mime_Header $header
- * @param string $string as displayed
- * @param string $charset of the text
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param bool $shorten the first line to make remove for header name
+ * @param string $string as displayed
+ * @param string $charset of the text
+ * @param bool $shorten the first line to make remove for header name
*
* @return string
*/
@@ -245,13 +205,12 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
// Treat token as exactly what was given
$phraseStr = $string;
// If it's not valid
- if (!preg_match('/^'.$this->getGrammar()->getDefinition('phrase').'$/D', $phraseStr)) {
+
+ if (!preg_match('/^'.self::PHRASE_PATTERN.'$/D', $phraseStr)) {
// .. but it is just ascii text, try escaping some characters
// and make it a quoted-string
- if (preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $phraseStr)) {
- $phraseStr = $this->getGrammar()->escapeSpecials(
- $phraseStr, array('"'), $this->getGrammar()->getSpecials()
- );
+ if (preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $phraseStr)) {
+ $phraseStr = $this->escapeSpecials($phraseStr, ['"']);
$phraseStr = '"'.$phraseStr.'"';
} else {
// ... otherwise it needs encoding
@@ -269,11 +228,27 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
}
/**
+ * Escape special characters in a string (convert to quoted-pairs).
+ *
+ * @param string $token
+ * @param string[] $include additional chars to escape
+ *
+ * @return string
+ */
+ private function escapeSpecials($token, $include = [])
+ {
+ foreach (array_merge(['\\'], $include) as $char) {
+ $token = str_replace($char, '\\'.$char, $token);
+ }
+
+ return $token;
+ }
+
+ /**
* Encode needed word tokens within a string of input.
*
- * @param Swift_Mime_Header $header
- * @param string $input
- * @param string $usedLength optional
+ * @param string $input
+ * @param string $usedLength optional
*
* @return string
*/
@@ -330,7 +305,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function getEncodableWordTokens($string)
{
- $tokens = array();
+ $tokens = [];
$encodedToken = '';
// Split at all whitespace boundaries
@@ -363,12 +338,12 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
protected function getTokenAsEncodedWord($token, $firstLineOffset = 0)
{
// Adjust $firstLineOffset to account for space needed for syntax
- $charsetDecl = $this->_charset;
- if (isset($this->_lang)) {
- $charsetDecl .= '*'.$this->_lang;
+ $charsetDecl = $this->charset;
+ if (isset($this->lang)) {
+ $charsetDecl .= '*'.$this->lang;
}
$encodingWrapperLength = strlen(
- '=?'.$charsetDecl.'?'.$this->_encoder->getName().'??='
+ '=?'.$charsetDecl.'?'.$this->encoder->getName().'??='
);
if ($firstLineOffset >= 75) {
@@ -377,16 +352,16 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
}
$encodedTextLines = explode("\r\n",
- $this->_encoder->encodeString(
- $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->_charset
+ $this->encoder->encodeString(
+ $token, $firstLineOffset, 75 - $encodingWrapperLength, $this->charset
)
);
- if (strtolower($this->_charset) !== 'iso-2022-jp') {
+ if ('iso-2022-jp' !== strtolower($this->charset)) {
// special encoding for iso-2022-jp using mb_encode_mimeheader
foreach ($encodedTextLines as $lineNum => $line) {
$encodedTextLines[$lineNum] = '=?'.$charsetDecl.
- '?'.$this->_encoder->getName().
+ '?'.$this->encoder->getName().
'?'.$line.'?=';
}
}
@@ -413,7 +388,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function setCachedValue($value)
{
- $this->_cachedValue = $value;
+ $this->cachedValue = $value;
}
/**
@@ -423,7 +398,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*/
protected function getCachedValue()
{
- return $this->_cachedValue;
+ return $this->cachedValue;
}
/**
@@ -451,7 +426,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
$string = $this->getFieldBody();
}
- $tokens = array();
+ $tokens = [];
// Generate atoms; split at all invisible boundaries followed by WSP
foreach (preg_split('~(?=[ \t])~', $string) as $token) {
@@ -472,18 +447,18 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
*
* @return string
*/
- private function _tokensToString(array $tokens)
+ private function tokensToString(array $tokens)
{
$lineCount = 0;
- $headerLines = array();
- $headerLines[] = $this->_name.': ';
+ $headerLines = [];
+ $headerLines[] = $this->name.': ';
$currentLine = &$headerLines[$lineCount++];
// Build all tokens back into compliant header
foreach ($tokens as $i => $token) {
// Line longer than specified maximum or token was just a new line
if (("\r\n" == $token) ||
- ($i > 0 && strlen($currentLine.$token) > $this->_lineLength)
+ ($i > 0 && strlen($currentLine.$token) > $this->lineLength)
&& 0 < strlen($currentLine)) {
$headerLines[] = '';
$currentLine = &$headerLines[$lineCount++];
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 4075cbfa11..efe1dad661 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/DateHeader.php
@@ -16,29 +16,20 @@
class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
{
/**
- * The UNIX timestamp value of this Header.
+ * Date-time value of this Header.
*
- * @var int
+ * @var DateTimeImmutable
*/
- private $_timestamp;
+ private $dateTime;
/**
- * Creates a new DateHeader with $name and $timestamp.
+ * Creates a new DateHeader with $name.
*
- * Example:
- * <code>
- * <?php
- * $header = new Swift_Mime_Headers_DateHeader('Date', time());
- * ?>
- * </code>
- *
- * @param string $name of Header
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name of Header
*/
- public function __construct($name, Swift_Mime_Grammar $grammar)
+ public function __construct($name)
{
$this->setFieldName($name);
- parent::__construct($grammar);
}
/**
@@ -57,49 +48,46 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
/**
* Set the model for the field body.
*
- * This method takes a UNIX timestamp.
- *
- * @param int $model
+ * @param DateTimeInterface $model
*/
public function setFieldBodyModel($model)
{
- $this->setTimestamp($model);
+ $this->setDateTime($model);
}
/**
* Get the model for the field body.
*
- * This method returns a UNIX timestamp.
- *
- * @return mixed
+ * @return DateTimeImmutable
*/
public function getFieldBodyModel()
{
- return $this->getTimestamp();
+ return $this->getDateTime();
}
/**
- * Get the UNIX timestamp of the Date in this Header.
+ * Get the date-time representing the Date in this Header.
*
- * @return int
+ * @return DateTimeImmutable
*/
- public function getTimestamp()
+ public function getDateTime()
{
- return $this->_timestamp;
+ return $this->dateTime;
}
/**
- * Set the UNIX timestamp of the Date in this Header.
+ * Set the date-time of the Date in this Header.
*
- * @param int $timestamp
+ * If a DateTime instance is provided, it is converted to DateTimeImmutable.
*/
- public function setTimestamp($timestamp)
+ public function setDateTime(DateTimeInterface $dateTime)
{
- if (null !== $timestamp) {
- $timestamp = (int) $timestamp;
+ $this->clearCachedValueIf($this->getCachedValue() != $dateTime->format(DateTime::RFC2822));
+ if ($dateTime instanceof DateTime) {
+ $immutable = new DateTimeImmutable('@'.$dateTime->getTimestamp());
+ $dateTime = $immutable->setTimezone($dateTime->getTimezone());
}
- $this->clearCachedValueIf($this->_timestamp != $timestamp);
- $this->_timestamp = $timestamp;
+ $this->dateTime = $dateTime;
}
/**
@@ -115,8 +103,8 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
public function getFieldBody()
{
if (!$this->getCachedValue()) {
- if (isset($this->_timestamp)) {
- $this->setCachedValue(date('r', $this->_timestamp));
+ if (isset($this->dateTime)) {
+ $this->setCachedValue($this->dateTime->format(DateTime::RFC2822));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
index b114506b4a..cadc63f852 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/IdentificationHeader.php
@@ -8,6 +8,9 @@
* file that was distributed with this source code.
*/
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
/**
* An ID MIME Header for something like Message-ID or Content-ID.
*
@@ -22,18 +25,27 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*
* @var string[]
*/
- private $_ids = array();
+ private $ids = [];
+
+ /**
+ * The strict EmailValidator.
+ *
+ * @var EmailValidator
+ */
+ private $emailValidator;
+
+ private $addressEncoder;
/**
* Creates a new IdentificationHeader with the given $name and $id.
*
- * @param string $name
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name
*/
- public function __construct($name, Swift_Mime_Grammar $grammar)
+ public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
- parent::__construct($grammar);
+ $this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -84,7 +96,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function setId($id)
{
- $this->setIds(is_array($id) ? $id : array($id));
+ $this->setIds(is_array($id) ? $id : [$id]);
}
/**
@@ -96,8 +108,8 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function getId()
{
- if (count($this->_ids) > 0) {
- return $this->_ids[0];
+ if (count($this->ids) > 0) {
+ return $this->ids[0];
}
}
@@ -110,15 +122,15 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function setIds(array $ids)
{
- $actualIds = array();
+ $actualIds = [];
foreach ($ids as $id) {
- $this->_assertValidId($id);
+ $this->assertValidId($id);
$actualIds[] = $id;
}
- $this->clearCachedValueIf($this->_ids != $actualIds);
- $this->_ids = $actualIds;
+ $this->clearCachedValueIf($this->ids != $actualIds);
+ $this->ids = $actualIds;
}
/**
@@ -128,7 +140,7 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*/
public function getIds()
{
- return $this->_ids;
+ return $this->ids;
}
/**
@@ -146,10 +158,10 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
public function getFieldBody()
{
if (!$this->getCachedValue()) {
- $angleAddrs = array();
+ $angleAddrs = [];
- foreach ($this->_ids as $id) {
- $angleAddrs[] = '<'.$id.'>';
+ foreach ($this->ids as $id) {
+ $angleAddrs[] = '<'.$this->addressEncoder->encodeString($id).'>';
}
$this->setCachedValue(implode(' ', $angleAddrs));
@@ -165,16 +177,10 @@ class Swift_Mime_Headers_IdentificationHeader extends Swift_Mime_Headers_Abstrac
*
* @throws Swift_RfcComplianceException
*/
- private function _assertValidId($id)
+ private function assertValidId($id)
{
- if (!preg_match(
- '/^'.$this->getGrammar()->getDefinition('id-left').'@'.
- $this->getGrammar()->getDefinition('id-right').'$/D',
- $id
- )) {
- throw new Swift_RfcComplianceException(
- 'Invalid ID given <'.$id.'>'
- );
+ if (!$this->emailValidator->isValid($id, new RFCValidation())) {
+ throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');
}
}
}
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 e4567fc80d..9f1fe1749a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php
@@ -8,6 +8,9 @@
* file that was distributed with this source code.
*/
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
/**
* A Mailbox Address MIME Header for something like From or Sender.
*
@@ -20,20 +23,28 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @var string[]
*/
- private $_mailboxes = array();
+ private $mailboxes = [];
+
+ /**
+ * The strict EmailValidator.
+ *
+ * @var EmailValidator
+ */
+ private $emailValidator;
+
+ private $addressEncoder;
/**
* Creates a new MailboxHeader with $name.
*
- * @param string $name of Header
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name of Header
*/
- public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar)
+ public function __construct($name, Swift_Mime_HeaderEncoder $encoder, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
$this->setEncoder($encoder);
- parent::__construct($grammar);
+ $this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -103,7 +114,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function setNameAddresses($mailboxes)
{
- $this->_mailboxes = $this->normalizeMailboxes((array) $mailboxes);
+ $this->mailboxes = $this->normalizeMailboxes((array) $mailboxes);
$this->setCachedValue(null); //Clear any cached value
}
@@ -134,7 +145,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function getNameAddressStrings()
{
- return $this->_createNameAddressStrings($this->getNameAddresses());
+ return $this->createNameAddressStrings($this->getNameAddresses());
}
/**
@@ -163,7 +174,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function getNameAddresses()
{
- return $this->_mailboxes;
+ return $this->mailboxes;
}
/**
@@ -200,7 +211,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function getAddresses()
{
- return array_keys($this->_mailboxes);
+ return array_keys($this->mailboxes);
}
/**
@@ -212,7 +223,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
{
$this->setCachedValue(null);
foreach ((array) $addresses as $address) {
- unset($this->_mailboxes[$address]);
+ unset($this->mailboxes[$address]);
}
}
@@ -232,7 +243,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
{
// Compute the string value of the header only if needed
if (null === $this->getCachedValue()) {
- $this->setCachedValue($this->createMailboxListString($this->_mailboxes));
+ $this->setCachedValue($this->createMailboxListString($this->mailboxes));
}
return $this->getCachedValue();
@@ -247,7 +258,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
protected function normalizeMailboxes(array $mailboxes)
{
- $actualMailboxes = array();
+ $actualMailboxes = [];
foreach ($mailboxes as $key => $value) {
if (is_string($key)) {
@@ -258,7 +269,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
$address = $value;
$name = null;
}
- $this->_assertValidAddress($address);
+ $this->assertValidAddress($address);
$actualMailboxes[$address] = $name;
}
@@ -289,7 +300,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*/
protected function createMailboxListString(array $mailboxes)
{
- return implode(', ', $this->_createNameAddressStrings($mailboxes));
+ return implode(', ', $this->createNameAddressStrings($mailboxes));
}
/**
@@ -315,12 +326,12 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @return string[]
*/
- private function _createNameAddressStrings(array $mailboxes)
+ private function createNameAddressStrings(array $mailboxes)
{
- $strings = array();
+ $strings = [];
foreach ($mailboxes as $email => $name) {
- $mailboxStr = $email;
+ $mailboxStr = $this->addressEncoder->encodeString($email);
if (null !== $name) {
$nameStr = $this->createDisplayNameString($name, empty($strings));
$mailboxStr = $nameStr.' <'.$mailboxStr.'>';
@@ -338,14 +349,12 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
*
* @throws Swift_RfcComplianceException If invalid.
*/
- private function _assertValidAddress($address)
+ private function assertValidAddress($address)
{
- if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',
- $address)) {
+ if (!$this->emailValidator->isValid($address, new RFCValidation())) {
throw new Swift_RfcComplianceException(
- 'Address in mailbox given ['.$address.
- '] does not comply with RFC 2822, 3.6.2.'
- );
+ 'Address in mailbox given ['.$address.'] does not comply with RFC 2822, 3.6.2.'
+ );
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
index d749550079..fafb5bae21 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
@@ -12,6 +12,8 @@
* An OpenDKIM Specific Header using only raw header datas without encoding.
*
* @author De Cock Xavier <xdecock@gmail.com>
+ *
+ * @deprecated since SwiftMailer 6.1.0; use Swift_Signers_DKIMSigner instead.
*/
class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
{
@@ -20,21 +22,21 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*
* @var string
*/
- private $_value;
+ private $value;
/**
* The name of this Header.
*
* @var string
*/
- private $_fieldName;
+ private $fieldName;
/**
* @param string $name
*/
public function __construct($name)
{
- $this->_fieldName = $name;
+ $this->fieldName = $name;
}
/**
@@ -81,7 +83,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function getValue()
{
- return $this->_value;
+ return $this->value;
}
/**
@@ -91,7 +93,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function setValue($value)
{
- $this->_value = $value;
+ $this->value = $value;
}
/**
@@ -101,7 +103,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function getFieldBody()
{
- return $this->_value;
+ return $this->value;
}
/**
@@ -111,7 +113,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function toString()
{
- return $this->_fieldName.': '.$this->_value;
+ return $this->fieldName.': '.$this->value."\r\n";
}
/**
@@ -121,7 +123,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
*/
public function getFieldName()
{
- return $this->_fieldName;
+ return $this->fieldName;
}
/**
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 c1777d3336..02933c417a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
@@ -13,7 +13,7 @@
*
* @author Chris Corbyn
*/
-class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_UnstructuredHeader implements Swift_Mime_ParameterizedHeader
+class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_UnstructuredHeader
{
/**
* RFC 2231's definition of a token.
@@ -27,27 +27,24 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*
* @var Swift_Encoder
*/
- private $_paramEncoder;
+ private $paramEncoder;
/**
* The parameters as an associative array.
*
* @var string[]
*/
- private $_params = array();
+ private $params = [];
/**
* Creates a new ParameterizedHeader with $name.
*
- * @param string $name
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Encoder $paramEncoder, optional
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name
*/
- public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder = null, Swift_Mime_Grammar $grammar)
+ public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder = null)
{
- parent::__construct($name, $encoder, $grammar);
- $this->_paramEncoder = $paramEncoder;
+ parent::__construct($name, $encoder);
+ $this->paramEncoder = $paramEncoder;
}
/**
@@ -71,8 +68,8 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
public function setCharset($charset)
{
parent::setCharset($charset);
- if (isset($this->_paramEncoder)) {
- $this->_paramEncoder->charsetChanged($charset);
+ if (isset($this->paramEncoder)) {
+ $this->paramEncoder->charsetChanged($charset);
}
}
@@ -84,7 +81,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*/
public function setParameter($parameter, $value)
{
- $this->setParameters(array_merge($this->getParameters(), array($parameter => $value)));
+ $this->setParameters(array_merge($this->getParameters(), [$parameter => $value]));
}
/**
@@ -98,7 +95,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
{
$params = $this->getParameters();
- return array_key_exists($parameter, $params) ? $params[$parameter] : null;
+ return $params[$parameter] ?? null;
}
/**
@@ -108,8 +105,8 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*/
public function setParameters(array $parameters)
{
- $this->clearCachedValueIf($this->_params != $parameters);
- $this->_params = $parameters;
+ $this->clearCachedValueIf($this->params != $parameters);
+ $this->params = $parameters;
}
/**
@@ -119,7 +116,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*/
public function getParameters()
{
- return $this->_params;
+ return $this->params;
}
/**
@@ -130,10 +127,10 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
public function getFieldBody() //TODO: Check caching here
{
$body = parent::getFieldBody();
- foreach ($this->_params as $name => $value) {
+ foreach ($this->params as $name => $value) {
if (null !== $value) {
// Add the parameter
- $body .= '; '.$this->_createParameter($name, $value);
+ $body .= '; '.$this->createParameter($name, $value);
}
}
@@ -155,12 +152,12 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
$tokens = parent::toTokens(parent::getFieldBody());
// Try creating any parameters
- foreach ($this->_params as $name => $value) {
+ foreach ($this->params as $name => $value) {
if (null !== $value) {
// Add the semi-colon separator
$tokens[count($tokens) - 1] .= ';';
$tokens = array_merge($tokens, $this->generateTokenLines(
- ' '.$this->_createParameter($name, $value)
+ ' '.$this->createParameter($name, $value)
));
}
}
@@ -176,7 +173,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*
* @return string
*/
- private function _createParameter($name, $value)
+ private function createParameter($name, $value)
{
$origValue = $value;
@@ -189,7 +186,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
// TODO: text, or something else??
// ... and it's not ascii
- if (!preg_match('/^'.$this->getGrammar()->getDefinition('text').'*$/D', $value)) {
+ if (!preg_match('/^[\x00-\x08\x0B\x0C\x0E-\x7F]*$/D', $value)) {
$encoded = true;
// Allow space for the indices, charset and language
$maxValueLength = $this->getMaxLineLength() - strlen($name.'*N*="";') - 1;
@@ -201,8 +198,8 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
// Encode if we need to
if ($encoded || strlen($value) > $maxValueLength) {
- if (isset($this->_paramEncoder)) {
- $value = $this->_paramEncoder->encodeString(
+ if (isset($this->paramEncoder)) {
+ $value = $this->paramEncoder->encodeString(
$origValue, $firstLineOffset, $maxValueLength, $this->getCharset()
);
} else {
@@ -212,19 +209,19 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
}
}
- $valueLines = isset($this->_paramEncoder) ? explode("\r\n", $value) : array($value);
+ $valueLines = isset($this->paramEncoder) ? explode("\r\n", $value) : [$value];
// Need to add indices
if (count($valueLines) > 1) {
- $paramLines = array();
+ $paramLines = [];
foreach ($valueLines as $i => $line) {
$paramLines[] = $name.'*'.$i.
- $this->_getEndOfParameterValue($line, true, $i == 0);
+ $this->getEndOfParameterValue($line, true, 0 == $i);
}
return implode(";\r\n ", $paramLines);
} else {
- return $name.$this->_getEndOfParameterValue(
+ return $name.$this->getEndOfParameterValue(
$valueLines[0], $encoded, true
);
}
@@ -239,7 +236,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
*
* @return string
*/
- private function _getEndOfParameterValue($value, $encoded = false, $firstLine = false)
+ private function getEndOfParameterValue($value, $encoded = false, $firstLine = false)
{
if (!preg_match('/^'.self::TOKEN_REGEX.'$/D', $value)) {
$value = '"'.$value.'"';
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 4a814b122a..d22afbfe90 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/PathHeader.php
@@ -8,6 +8,9 @@
* file that was distributed with this source code.
*/
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
/**
* A Path Header in Swift Mailer, such a Return-Path.
*
@@ -20,18 +23,27 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
*
* @var string
*/
- private $_address;
+ private $address;
+
+ /**
+ * The strict EmailValidator.
+ *
+ * @var EmailValidator
+ */
+ private $emailValidator;
+
+ private $addressEncoder;
/**
* Creates a new PathHeader with the given $name.
*
- * @param string $name
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name
*/
- public function __construct($name, Swift_Mime_Grammar $grammar)
+ public function __construct($name, EmailValidator $emailValidator, Swift_AddressEncoder $addressEncoder = null)
{
$this->setFieldName($name);
- parent::__construct($grammar);
+ $this->emailValidator = $emailValidator;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -81,12 +93,12 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
public function setAddress($address)
{
if (null === $address) {
- $this->_address = null;
+ $this->address = null;
} elseif ('' == $address) {
- $this->_address = '';
+ $this->address = '';
} else {
- $this->_assertValidAddress($address);
- $this->_address = $address;
+ $this->assertValidAddress($address);
+ $this->address = $address;
}
$this->setCachedValue(null);
}
@@ -100,7 +112,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
*/
public function getAddress()
{
- return $this->_address;
+ return $this->address;
}
/**
@@ -116,8 +128,9 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
public function getFieldBody()
{
if (!$this->getCachedValue()) {
- if (isset($this->_address)) {
- $this->setCachedValue('<'.$this->_address.'>');
+ if (isset($this->address)) {
+ $address = $this->addressEncoder->encodeString($this->address);
+ $this->setCachedValue('<'.$address.'>');
}
}
@@ -131,13 +144,12 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
*
* @throws Swift_RfcComplianceException If address is invalid
*/
- private function _assertValidAddress($address)
+ private function assertValidAddress($address)
{
- if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',
- $address)) {
+ if (!$this->emailValidator->isValid($address, new RFCValidation())) {
throw new Swift_RfcComplianceException(
'Address set in PathHeader does not comply with addr-spec of RFC 2822.'
- );
+ );
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
index 86177f14a1..64f160dec7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
@@ -20,20 +20,17 @@ class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractH
*
* @var string
*/
- private $_value;
+ private $value;
/**
* Creates a new SimpleHeader with $name.
*
- * @param string $name
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Mime_Grammar $grammar
+ * @param string $name
*/
- public function __construct($name, Swift_Mime_HeaderEncoder $encoder, Swift_Mime_Grammar $grammar)
+ public function __construct($name, Swift_Mime_HeaderEncoder $encoder)
{
$this->setFieldName($name);
$this->setEncoder($encoder);
- parent::__construct($grammar);
}
/**
@@ -80,7 +77,7 @@ class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractH
*/
public function getValue()
{
- return $this->_value;
+ return $this->value;
}
/**
@@ -90,8 +87,8 @@ class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractH
*/
public function setValue($value)
{
- $this->clearCachedValueIf($this->_value != $value);
- $this->_value = $value;
+ $this->clearCachedValueIf($this->value != $value);
+ $this->value = $value;
}
/**
@@ -103,7 +100,7 @@ class Swift_Mime_Headers_UnstructuredHeader extends Swift_Mime_Headers_AbstractH
{
if (!$this->getCachedValue()) {
$this->setCachedValue(
- $this->encodeWords($this, $this->_value)
+ $this->encodeWords($this, $this->value)
);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php
new file mode 100644
index 0000000000..3ce35f27c0
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/IdGenerator.php
@@ -0,0 +1,54 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2004-2009 Chris Corbyn
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * Message ID generator.
+ */
+class Swift_Mime_IdGenerator implements Swift_IdGenerator
+{
+ private $idRight;
+
+ /**
+ * @param string $idRight
+ */
+ public function __construct($idRight)
+ {
+ $this->idRight = $idRight;
+ }
+
+ /**
+ * Returns the right-hand side of the "@" used in all generated IDs.
+ *
+ * @return string
+ */
+ public function getIdRight()
+ {
+ return $this->idRight;
+ }
+
+ /**
+ * Sets the right-hand side of the "@" to use in all generated IDs.
+ *
+ * @param string $idRight
+ */
+ public function setIdRight($idRight)
+ {
+ $this->idRight = $idRight;
+ }
+
+ /**
+ * @return string
+ */
+ public function generateId()
+ {
+ // 32 hex values for the left part
+ return bin2hex(random_bytes(16)).'@'.$this->idRight;
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Message.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Message.php
deleted file mode 100644
index 9b36d21627..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Message.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * A Message (RFC 2822) object.
- *
- * @author Chris Corbyn
- */
-interface Swift_Mime_Message extends Swift_Mime_MimeEntity
-{
- /**
- * Generates a valid Message-ID and switches to it.
- *
- * @return string
- */
- public function generateId();
-
- /**
- * Set the subject of the message.
- *
- * @param string $subject
- */
- public function setSubject($subject);
-
- /**
- * Get the subject of the message.
- *
- * @return string
- */
- public function getSubject();
-
- /**
- * Set the origination date of the message as a UNIX timestamp.
- *
- * @param int $date
- */
- public function setDate($date);
-
- /**
- * Get the origination date of the message as a UNIX timestamp.
- *
- * @return int
- */
- public function getDate();
-
- /**
- * Set the return-path (bounce-detect) address.
- *
- * @param string $address
- */
- public function setReturnPath($address);
-
- /**
- * Get the return-path (bounce-detect) address.
- *
- * @return string
- */
- public function getReturnPath();
-
- /**
- * Set the sender of this message.
- *
- * If multiple addresses are present in the From field, this SHOULD be set.
- *
- * According to RFC 2822 it is a requirement when there are multiple From
- * addresses, but Swift itself does not require it directly.
- *
- * An associative array (with one element!) can be used to provide a display-
- * name: i.e. array('email@address' => 'Real Name').
- *
- * If the second parameter is provided and the first is a string, then $name
- * is associated with the address.
- *
- * @param mixed $address
- * @param string $name optional
- */
- public function setSender($address, $name = null);
-
- /**
- * Get the sender address for this message.
- *
- * This has a higher significance than the From address.
- *
- * @return string
- */
- public function getSender();
-
- /**
- * Set the From address of this message.
- *
- * It is permissible for multiple From addresses to be set using an array.
- *
- * If multiple From addresses are used, you SHOULD set the Sender address and
- * according to RFC 2822, MUST set the sender address.
- *
- * An array can be used if display names are to be provided: i.e.
- * array('email@address.com' => 'Real Name').
- *
- * If the second parameter is provided and the first is a string, then $name
- * is associated with the address.
- *
- * @param mixed $addresses
- * @param string $name optional
- */
- public function setFrom($addresses, $name = null);
-
- /**
- * Get the From address(es) of this message.
- *
- * This method always returns an associative array where the keys are the
- * addresses.
- *
- * @return string[]
- */
- public function getFrom();
-
- /**
- * Set the Reply-To address(es).
- *
- * Any replies from the receiver will be sent to this address.
- *
- * It is permissible for multiple reply-to addresses to be set using an array.
- *
- * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
- *
- * If the second parameter is provided and the first is a string, then $name
- * is associated with the address.
- *
- * @param mixed $addresses
- * @param string $name optional
- */
- public function setReplyTo($addresses, $name = null);
-
- /**
- * Get the Reply-To addresses for this message.
- *
- * This method always returns an associative array where the keys provide the
- * email addresses.
- *
- * @return string[]
- */
- public function getReplyTo();
-
- /**
- * Set the To address(es).
- *
- * Recipients set in this field will receive a copy of this message.
- *
- * This method has the same synopsis as {@link setFrom()} and {@link setCc()}.
- *
- * If the second parameter is provided and the first is a string, then $name
- * is associated with the address.
- *
- * @param mixed $addresses
- * @param string $name optional
- */
- public function setTo($addresses, $name = null);
-
- /**
- * Get the To addresses for this message.
- *
- * This method always returns an associative array, whereby the keys provide
- * the actual email addresses.
- *
- * @return string[]
- */
- public function getTo();
-
- /**
- * Set the Cc address(es).
- *
- * Recipients set in this field will receive a 'carbon-copy' of this message.
- *
- * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
- *
- * @param mixed $addresses
- * @param string $name optional
- */
- public function setCc($addresses, $name = null);
-
- /**
- * Get the Cc addresses for this message.
- *
- * This method always returns an associative array, whereby the keys provide
- * the actual email addresses.
- *
- * @return string[]
- */
- public function getCc();
-
- /**
- * Set the Bcc address(es).
- *
- * Recipients set in this field will receive a 'blind-carbon-copy' of this
- * message.
- *
- * In other words, they will get the message, but any other recipients of the
- * message will have no such knowledge of their receipt of it.
- *
- * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
- *
- * @param mixed $addresses
- * @param string $name optional
- */
- public function setBcc($addresses, $name = null);
-
- /**
- * Get the Bcc addresses for this message.
- *
- * This method always returns an associative array, whereby the keys provide
- * the actual email addresses.
- *
- * @return string[]
- */
- public function getBcc();
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php
deleted file mode 100644
index 30f460cdcd..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimeEntity.php
+++ /dev/null
@@ -1,117 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * A MIME entity, such as an attachment.
- *
- * @author Chris Corbyn
- */
-interface Swift_Mime_MimeEntity extends Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver
-{
- /** Main message document; there can only be one of these */
- const LEVEL_TOP = 16;
-
- /** An entity which nests with the same precedence as an attachment */
- const LEVEL_MIXED = 256;
-
- /** An entity which nests with the same precedence as a mime part */
- const LEVEL_ALTERNATIVE = 4096;
-
- /** An entity which nests with the same precedence as embedded content */
- const LEVEL_RELATED = 65536;
-
- /**
- * Get the level at which this entity shall be nested in final document.
- *
- * The lower the value, the more outermost the entity will be nested.
- *
- * @see LEVEL_TOP, LEVEL_MIXED, LEVEL_RELATED, LEVEL_ALTERNATIVE
- *
- * @return int
- */
- public function getNestingLevel();
-
- /**
- * Get the qualified content-type of this mime entity.
- *
- * @return string
- */
- public function getContentType();
-
- /**
- * Returns a unique ID for this entity.
- *
- * For most entities this will likely be the Content-ID, though it has
- * no explicit semantic meaning and can be considered an identifier for
- * programming logic purposes.
- *
- * If a Content-ID header is present, this value SHOULD match the value of
- * the header.
- *
- * @return string
- */
- public function getId();
-
- /**
- * Get all children nested inside this entity.
- *
- * These are not just the immediate children, but all children.
- *
- * @return Swift_Mime_MimeEntity[]
- */
- public function getChildren();
-
- /**
- * Set all children nested inside this entity.
- *
- * This includes grandchildren.
- *
- * @param Swift_Mime_MimeEntity[] $children
- */
- public function setChildren(array $children);
-
- /**
- * Get the collection of Headers in this Mime entity.
- *
- * @return Swift_Mime_HeaderSet
- */
- public function getHeaders();
-
- /**
- * Get the body content of this entity as a string.
- *
- * Returns NULL if no body has been set.
- *
- * @return string|null
- */
- public function getBody();
-
- /**
- * Set the body content of this entity as a string.
- *
- * @param string $body
- * @param string $contentType optional
- */
- public function setBody($body, $contentType = null);
-
- /**
- * Get this entire entity in its string form.
- *
- * @return string
- */
- public function toString();
-
- /**
- * Get this entire entity as a ByteStream.
- *
- * @param Swift_InputByteStream $is to write to
- */
- public function toByteStream(Swift_InputByteStream $is);
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php
index 4564fef6f1..54c8b3acad 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/MimePart.php
@@ -16,29 +16,25 @@
class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
{
/** The format parameter last specified by the user */
- protected $_userFormat;
+ protected $userFormat;
/** The charset last specified by the user */
- protected $_userCharset;
+ protected $userCharset;
/** The delsp parameter last specified by the user */
- protected $_userDelSp;
+ protected $userDelSp;
/** The nesting level of this MimePart */
- private $_nestingLevel = self::LEVEL_ALTERNATIVE;
+ private $nestingLevel = self::LEVEL_ALTERNATIVE;
/**
* Create a new MimePart with $headers, $encoder and $cache.
*
- * @param Swift_Mime_HeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_Mime_Grammar $grammar
- * @param string $charset
+ * @param string $charset
*/
- public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null)
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
- parent::__construct($headers, $encoder, $cache, $grammar);
+ parent::__construct($headers, $encoder, $cache, $idGenerator);
$this->setContentType('text/plain');
if (null !== $charset) {
$this->setCharset($charset);
@@ -60,7 +56,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
if (isset($charset)) {
$this->setCharset($charset);
}
- $body = $this->_convertString($body);
+ $body = $this->convertString($body);
parent::setBody($body, $contentType);
@@ -74,7 +70,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function getCharset()
{
- return $this->_getHeaderParameter('Content-Type', 'charset');
+ return $this->getHeaderParameter('Content-Type', 'charset');
}
/**
@@ -86,11 +82,11 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function setCharset($charset)
{
- $this->_setHeaderParameter('Content-Type', 'charset', $charset);
- if ($charset !== $this->_userCharset) {
- $this->_clearCache();
+ $this->setHeaderParameter('Content-Type', 'charset', $charset);
+ if ($charset !== $this->userCharset) {
+ $this->clearCache();
}
- $this->_userCharset = $charset;
+ $this->userCharset = $charset;
parent::charsetChanged($charset);
return $this;
@@ -103,7 +99,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function getFormat()
{
- return $this->_getHeaderParameter('Content-Type', 'format');
+ return $this->getHeaderParameter('Content-Type', 'format');
}
/**
@@ -115,8 +111,8 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function setFormat($format)
{
- $this->_setHeaderParameter('Content-Type', 'format', $format);
- $this->_userFormat = $format;
+ $this->setHeaderParameter('Content-Type', 'format', $format);
+ $this->userFormat = $format;
return $this;
}
@@ -128,7 +124,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function getDelSp()
{
- return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false;
+ return 'yes' === $this->getHeaderParameter('Content-Type', 'delsp');
}
/**
@@ -140,8 +136,8 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function setDelSp($delsp = true)
{
- $this->_setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
- $this->_userDelSp = $delsp;
+ $this->setHeaderParameter('Content-Type', 'delsp', $delsp ? 'yes' : null);
+ $this->userDelSp = $delsp;
return $this;
}
@@ -155,7 +151,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
*/
public function getNestingLevel()
{
- return $this->_nestingLevel;
+ return $this->nestingLevel;
}
/**
@@ -170,31 +166,31 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
}
/** Fix the content-type and encoding of this entity */
- protected function _fixHeaders()
+ protected function fixHeaders()
{
- parent::_fixHeaders();
+ parent::fixHeaders();
if (count($this->getChildren())) {
- $this->_setHeaderParameter('Content-Type', 'charset', null);
- $this->_setHeaderParameter('Content-Type', 'format', null);
- $this->_setHeaderParameter('Content-Type', 'delsp', null);
+ $this->setHeaderParameter('Content-Type', 'charset', null);
+ $this->setHeaderParameter('Content-Type', 'format', null);
+ $this->setHeaderParameter('Content-Type', 'delsp', null);
} else {
- $this->setCharset($this->_userCharset);
- $this->setFormat($this->_userFormat);
- $this->setDelSp($this->_userDelSp);
+ $this->setCharset($this->userCharset);
+ $this->setFormat($this->userFormat);
+ $this->setDelSp($this->userDelSp);
}
}
/** Set the nesting level of this entity */
- protected function _setNestingLevel($level)
+ protected function setNestingLevel($level)
{
- $this->_nestingLevel = $level;
+ $this->nestingLevel = $level;
}
/** Encode charset when charset is not utf-8 */
- protected function _convertString($string)
+ protected function convertString($string)
{
$charset = strtolower($this->getCharset());
- if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) {
+ if (!in_array($charset, ['utf-8', 'iso-8859-1', 'iso-8859-15', ''])) {
// mb_convert_encoding must be the first one to check, since iconv cannot convert some words.
if (function_exists('mb_convert_encoding')) {
$string = mb_convert_encoding($string, $charset, 'utf-8');
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php
deleted file mode 100644
index e15c6ef95b..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ParameterizedHeader.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * A MIME Header with parameters.
- *
- * @author Chris Corbyn
- */
-interface Swift_Mime_ParameterizedHeader extends Swift_Mime_Header
-{
- /**
- * Set the value of $parameter.
- *
- * @param string $parameter
- * @param string $value
- */
- public function setParameter($parameter, $value);
-
- /**
- * Get the value of $parameter.
- *
- * @param string $parameter
- *
- * @return string
- */
- public function getParameter($parameter);
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
index 1ca504e756..93af996340 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php
@@ -8,39 +8,42 @@
* file that was distributed with this source code.
*/
+use Egulias\EmailValidator\EmailValidator;
+
/**
* Creates MIME headers.
*
* @author Chris Corbyn
*/
-class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
+class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_CharsetObserver
{
/** The HeaderEncoder used by these headers */
- private $_encoder;
+ private $encoder;
/** The Encoder used by parameters */
- private $_paramEncoder;
+ private $paramEncoder;
- /** The Grammar */
- private $_grammar;
+ /** Strict EmailValidator */
+ private $emailValidator;
/** The charset of created Headers */
- private $_charset;
+ private $charset;
+
+ /** Swift_AddressEncoder */
+ private $addressEncoder;
/**
* Creates a new SimpleHeaderFactory using $encoder and $paramEncoder.
*
- * @param Swift_Mime_HeaderEncoder $encoder
- * @param Swift_Encoder $paramEncoder
- * @param Swift_Mime_Grammar $grammar
- * @param string|null $charset
+ * @param string|null $charset
*/
- public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, Swift_Mime_Grammar $grammar, $charset = null)
+ public function __construct(Swift_Mime_HeaderEncoder $encoder, Swift_Encoder $paramEncoder, EmailValidator $emailValidator, $charset = null, Swift_AddressEncoder $addressEncoder = null)
{
- $this->_encoder = $encoder;
- $this->_paramEncoder = $paramEncoder;
- $this->_grammar = $grammar;
- $this->_charset = $charset;
+ $this->encoder = $encoder;
+ $this->paramEncoder = $paramEncoder;
+ $this->emailValidator = $emailValidator;
+ $this->charset = $charset;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
}
/**
@@ -53,30 +56,30 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function createMailboxHeader($name, $addresses = null)
{
- $header = new Swift_Mime_Headers_MailboxHeader($name, $this->_encoder, $this->_grammar);
+ $header = new Swift_Mime_Headers_MailboxHeader($name, $this->encoder, $this->emailValidator, $this->addressEncoder);
if (isset($addresses)) {
$header->setFieldBodyModel($addresses);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
/**
- * Create a new Date header using $timestamp (UNIX time).
+ * Create a new Date header using $dateTime.
*
- * @param string $name
- * @param int|null $timestamp
+ * @param string $name
+ * @param DateTimeInterface|null $dateTime
*
* @return Swift_Mime_Header
*/
- public function createDateHeader($name, $timestamp = null)
+ public function createDateHeader($name, DateTimeInterface $dateTime = null)
{
- $header = new Swift_Mime_Headers_DateHeader($name, $this->_grammar);
- if (isset($timestamp)) {
- $header->setFieldBodyModel($timestamp);
+ $header = new Swift_Mime_Headers_DateHeader($name);
+ if (isset($dateTime)) {
+ $header->setFieldBodyModel($dateTime);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
@@ -91,11 +94,11 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function createTextHeader($name, $value = null)
{
- $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->_encoder, $this->_grammar);
+ $header = new Swift_Mime_Headers_UnstructuredHeader($name, $this->encoder);
if (isset($value)) {
$header->setFieldBodyModel($value);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
@@ -107,19 +110,18 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
* @param string $value
* @param array $params
*
- * @return Swift_Mime_ParameterizedHeader
+ * @return Swift_Mime_Headers_ParameterizedHeader
*/
- public function createParameterizedHeader($name, $value = null,
- $params = array())
+ public function createParameterizedHeader($name, $value = null, $params = [])
{
- $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar);
+ $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->encoder, ('content-disposition' == strtolower($name)) ? $this->paramEncoder : null);
if (isset($value)) {
$header->setFieldBodyModel($value);
}
foreach ($params as $k => $v) {
$header->setParameter($k, $v);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
@@ -134,11 +136,11 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function createIdHeader($name, $ids = null)
{
- $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->_grammar);
+ $header = new Swift_Mime_Headers_IdentificationHeader($name, $this->emailValidator);
if (isset($ids)) {
$header->setFieldBodyModel($ids);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
@@ -153,11 +155,11 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function createPathHeader($name, $path = null)
{
- $header = new Swift_Mime_Headers_PathHeader($name, $this->_grammar);
+ $header = new Swift_Mime_Headers_PathHeader($name, $this->emailValidator);
if (isset($path)) {
$header->setFieldBodyModel($path);
}
- $this->_setHeaderCharset($header);
+ $this->setHeaderCharset($header);
return $header;
}
@@ -169,9 +171,9 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function charsetChanged($charset)
{
- $this->_charset = $charset;
- $this->_encoder->charsetChanged($charset);
- $this->_paramEncoder->charsetChanged($charset);
+ $this->charset = $charset;
+ $this->encoder->charsetChanged($charset);
+ $this->paramEncoder->charsetChanged($charset);
}
/**
@@ -179,15 +181,15 @@ class Swift_Mime_SimpleHeaderFactory implements Swift_Mime_HeaderFactory
*/
public function __clone()
{
- $this->_encoder = clone $this->_encoder;
- $this->_paramEncoder = clone $this->_paramEncoder;
+ $this->encoder = clone $this->encoder;
+ $this->paramEncoder = clone $this->paramEncoder;
}
/** Apply the charset to the Header */
- private function _setHeaderCharset(Swift_Mime_Header $header)
+ private function setHeaderCharset(Swift_Mime_Header $header)
{
- if (isset($this->_charset)) {
- $header->setCharset($this->_charset);
+ if (isset($this->charset)) {
+ $header->setCharset($this->charset);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
index a06ce7247b..a2c319131a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderSet.php
@@ -13,37 +13,41 @@
*
* @author Chris Corbyn
*/
-class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
+class Swift_Mime_SimpleHeaderSet implements Swift_Mime_CharsetObserver
{
/** HeaderFactory */
- private $_factory;
+ private $factory;
/** Collection of set Headers */
- private $_headers = array();
+ private $headers = [];
/** Field ordering details */
- private $_order = array();
+ private $order = [];
/** List of fields which are required to be displayed */
- private $_required = array();
+ private $required = [];
/** The charset used by Headers */
- private $_charset;
+ private $charset;
/**
* Create a new SimpleHeaderSet with the given $factory.
*
- * @param Swift_Mime_HeaderFactory $factory
- * @param string $charset
+ * @param string $charset
*/
- public function __construct(Swift_Mime_HeaderFactory $factory, $charset = null)
+ public function __construct(Swift_Mime_SimpleHeaderFactory $factory, $charset = null)
{
- $this->_factory = $factory;
+ $this->factory = $factory;
if (isset($charset)) {
$this->setCharset($charset);
}
}
+ public function newInstance()
+ {
+ return new self($this->factory);
+ }
+
/**
* Set the charset used by these headers.
*
@@ -51,9 +55,9 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function setCharset($charset)
{
- $this->_charset = $charset;
- $this->_factory->charsetChanged($charset);
- $this->_notifyHeadersOfCharset($charset);
+ $this->charset = $charset;
+ $this->factory->charsetChanged($charset);
+ $this->notifyHeadersOfCharset($charset);
}
/**
@@ -64,20 +68,17 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function addMailboxHeader($name, $addresses = null)
{
- $this->_storeHeader($name,
- $this->_factory->createMailboxHeader($name, $addresses));
+ $this->storeHeader($name, $this->factory->createMailboxHeader($name, $addresses));
}
/**
- * Add a new Date header using $timestamp (UNIX time).
+ * Add a new Date header using $dateTime.
*
* @param string $name
- * @param int $timestamp
*/
- public function addDateHeader($name, $timestamp = null)
+ public function addDateHeader($name, DateTimeInterface $dateTime = null)
{
- $this->_storeHeader($name,
- $this->_factory->createDateHeader($name, $timestamp));
+ $this->storeHeader($name, $this->factory->createDateHeader($name, $dateTime));
}
/**
@@ -88,8 +89,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function addTextHeader($name, $value = null)
{
- $this->_storeHeader($name,
- $this->_factory->createTextHeader($name, $value));
+ $this->storeHeader($name, $this->factory->createTextHeader($name, $value));
}
/**
@@ -99,9 +99,9 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
* @param string $value
* @param array $params
*/
- public function addParameterizedHeader($name, $value = null, $params = array())
+ public function addParameterizedHeader($name, $value = null, $params = [])
{
- $this->_storeHeader($name, $this->_factory->createParameterizedHeader($name, $value, $params));
+ $this->storeHeader($name, $this->factory->createParameterizedHeader($name, $value, $params));
}
/**
@@ -112,7 +112,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function addIdHeader($name, $ids = null)
{
- $this->_storeHeader($name, $this->_factory->createIdHeader($name, $ids));
+ $this->storeHeader($name, $this->factory->createIdHeader($name, $ids));
}
/**
@@ -123,7 +123,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function addPathHeader($name, $path = null)
{
- $this->_storeHeader($name, $this->_factory->createPathHeader($name, $path));
+ $this->storeHeader($name, $this->factory->createPathHeader($name, $path));
}
/**
@@ -140,16 +140,16 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
{
$lowerName = strtolower($name);
- if (!array_key_exists($lowerName, $this->_headers)) {
+ if (!array_key_exists($lowerName, $this->headers)) {
return false;
}
if (func_num_args() < 2) {
// index was not specified, so we only need to check that there is at least one header value set
- return (bool) count($this->_headers[$lowerName]);
+ return (bool) count($this->headers[$lowerName]);
}
- return array_key_exists($index, $this->_headers[$lowerName]);
+ return array_key_exists($index, $this->headers[$lowerName]);
}
/**
@@ -161,12 +161,11 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
* If $index is specified, the header will be inserted into the set at this
* offset.
*
- * @param Swift_Mime_Header $header
- * @param int $index
+ * @param int $index
*/
public function set(Swift_Mime_Header $header, $index = 0)
{
- $this->_storeHeader($header->getFieldName(), $header, $index);
+ $this->storeHeader($header->getFieldName(), $header, $index);
}
/**
@@ -186,13 +185,13 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
if (func_num_args() < 2) {
if ($this->has($name)) {
- $values = array_values($this->_headers[$name]);
+ $values = array_values($this->headers[$name]);
return array_shift($values);
}
} else {
if ($this->has($name, $index)) {
- return $this->_headers[$name][$index];
+ return $this->headers[$name][$index];
}
}
}
@@ -207,8 +206,8 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
public function getAll($name = null)
{
if (!isset($name)) {
- $headers = array();
- foreach ($this->_headers as $collection) {
+ $headers = [];
+ foreach ($this->headers as $collection) {
$headers = array_merge($headers, $collection);
}
@@ -216,11 +215,11 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
}
$lowerName = strtolower($name);
- if (!array_key_exists($lowerName, $this->_headers)) {
- return array();
+ if (!array_key_exists($lowerName, $this->headers)) {
+ return [];
}
- return $this->_headers[$lowerName];
+ return $this->headers[$lowerName];
}
/**
@@ -230,9 +229,9 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function listAll()
{
- $headers = $this->_headers;
- if ($this->_canSort()) {
- uksort($headers, array($this, '_sortHeaders'));
+ $headers = $this->headers;
+ if ($this->canSort()) {
+ uksort($headers, [$this, 'sortHeaders']);
}
return array_keys($headers);
@@ -249,7 +248,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
public function remove($name, $index = 0)
{
$lowerName = strtolower($name);
- unset($this->_headers[$lowerName][$index]);
+ unset($this->headers[$lowerName][$index]);
}
/**
@@ -260,41 +259,27 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
public function removeAll($name)
{
$lowerName = strtolower($name);
- unset($this->_headers[$lowerName]);
- }
-
- /**
- * Create a new instance of this HeaderSet.
- *
- * @return self
- */
- public function newInstance()
- {
- return new self($this->_factory);
+ unset($this->headers[$lowerName]);
}
/**
* Define a list of Header names as an array in the correct order.
*
* These Headers will be output in the given order where present.
- *
- * @param array $sequence
*/
public function defineOrdering(array $sequence)
{
- $this->_order = array_flip(array_map('strtolower', $sequence));
+ $this->order = array_flip(array_map('strtolower', $sequence));
}
/**
* Set a list of header names which must always be displayed when set.
*
* Usually headers without a field value won't be output unless set here.
- *
- * @param array $names
*/
public function setAlwaysDisplayed(array $names)
{
- $this->_required = array_flip(array_map('strtolower', $names));
+ $this->required = array_flip(array_map('strtolower', $names));
}
/**
@@ -315,13 +300,13 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
public function toString()
{
$string = '';
- $headers = $this->_headers;
- if ($this->_canSort()) {
- uksort($headers, array($this, '_sortHeaders'));
+ $headers = $this->headers;
+ if ($this->canSort()) {
+ uksort($headers, [$this, 'sortHeaders']);
}
foreach ($headers as $collection) {
foreach ($collection as $header) {
- if ($this->_isDisplayed($header) || $header->getFieldBody() != '') {
+ if ($this->isDisplayed($header) || '' != $header->getFieldBody()) {
$string .= $header->toString();
}
}
@@ -343,40 +328,40 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
}
/** Save a Header to the internal collection */
- private function _storeHeader($name, Swift_Mime_Header $header, $offset = null)
+ private function storeHeader($name, Swift_Mime_Header $header, $offset = null)
{
- if (!isset($this->_headers[strtolower($name)])) {
- $this->_headers[strtolower($name)] = array();
+ if (!isset($this->headers[strtolower($name)])) {
+ $this->headers[strtolower($name)] = [];
}
if (!isset($offset)) {
- $this->_headers[strtolower($name)][] = $header;
+ $this->headers[strtolower($name)][] = $header;
} else {
- $this->_headers[strtolower($name)][$offset] = $header;
+ $this->headers[strtolower($name)][$offset] = $header;
}
}
/** Test if the headers can be sorted */
- private function _canSort()
+ private function canSort()
{
- return count($this->_order) > 0;
+ return count($this->order) > 0;
}
/** uksort() algorithm for Header ordering */
- private function _sortHeaders($a, $b)
+ private function sortHeaders($a, $b)
{
$lowerA = strtolower($a);
$lowerB = strtolower($b);
- $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1;
- $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1;
+ $aPos = array_key_exists($lowerA, $this->order) ? $this->order[$lowerA] : -1;
+ $bPos = array_key_exists($lowerB, $this->order) ? $this->order[$lowerB] : -1;
if (-1 === $aPos && -1 === $bPos) {
// just be sure to be determinist here
return $a > $b ? -1 : 1;
}
- if ($aPos == -1) {
+ if (-1 == $aPos) {
return 1;
- } elseif ($bPos == -1) {
+ } elseif (-1 == $bPos) {
return -1;
}
@@ -384,15 +369,15 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
}
/** Test if the given Header is always displayed */
- private function _isDisplayed(Swift_Mime_Header $header)
+ private function isDisplayed(Swift_Mime_Header $header)
{
- return array_key_exists(strtolower($header->getFieldName()), $this->_required);
+ return array_key_exists(strtolower($header->getFieldName()), $this->required);
}
/** Notify all Headers of the new charset */
- private function _notifyHeadersOfCharset($charset)
+ private function notifyHeadersOfCharset($charset)
{
- foreach ($this->_headers as $headerGroup) {
+ foreach ($this->headers as $headerGroup) {
foreach ($headerGroup as $header) {
$header->setCharset($charset);
}
@@ -404,10 +389,10 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
*/
public function __clone()
{
- $this->_factory = clone $this->_factory;
- foreach ($this->_headers as $groupKey => $headerGroup) {
+ $this->factory = clone $this->factory;
+ foreach ($this->headers as $groupKey => $headerGroup) {
foreach ($headerGroup as $key => $header) {
- $this->_headers[$groupKey][$key] = clone $header;
+ $this->headers[$groupKey][$key] = clone $header;
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
index 72d40cee02..ab32f63fe4 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMessage.php
@@ -13,7 +13,7 @@
*
* @author Chris Corbyn
*/
-class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message
+class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
{
const PRIORITY_HIGHEST = 1;
const PRIORITY_HIGH = 2;
@@ -24,16 +24,12 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
/**
* Create a new SimpleMessage with $headers, $encoder and $cache.
*
- * @param Swift_Mime_HeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_Mime_Grammar $grammar
- * @param string $charset
+ * @param string $charset
*/
- public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar, $charset = null)
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
- parent::__construct($headers, $encoder, $cache, $grammar, $charset);
- $this->getHeaders()->defineOrdering(array(
+ parent::__construct($headers, $encoder, $cache, $idGenerator, $charset);
+ $this->getHeaders()->defineOrdering([
'Return-Path',
'Received',
'DKIM-Signature',
@@ -50,10 +46,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
'MIME-Version',
'Content-Type',
'Content-Transfer-Encoding',
- ));
- $this->getHeaders()->setAlwaysDisplayed(array('Date', 'Message-ID', 'From'));
+ ]);
+ $this->getHeaders()->setAlwaysDisplayed(['Date', 'Message-ID', 'From']);
$this->getHeaders()->addTextHeader('MIME-Version', '1.0');
- $this->setDate(time());
+ $this->setDate(new DateTimeImmutable());
$this->setId($this->getId());
$this->getHeaders()->addMailboxHeader('From');
}
@@ -77,7 +73,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function setSubject($subject)
{
- if (!$this->_setHeaderFieldModel('Subject', $subject)) {
+ if (!$this->setHeaderFieldModel('Subject', $subject)) {
$this->getHeaders()->addTextHeader('Subject', $subject);
}
@@ -91,20 +87,18 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getSubject()
{
- return $this->_getHeaderFieldModel('Subject');
+ return $this->getHeaderFieldModel('Subject');
}
/**
* Set the date at which this message was created.
*
- * @param int $date
- *
* @return $this
*/
- public function setDate($date)
+ public function setDate(DateTimeInterface $dateTime)
{
- if (!$this->_setHeaderFieldModel('Date', $date)) {
- $this->getHeaders()->addDateHeader('Date', $date);
+ if (!$this->setHeaderFieldModel('Date', $dateTime)) {
+ $this->getHeaders()->addDateHeader('Date', $dateTime);
}
return $this;
@@ -113,11 +107,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
/**
* Get the date at which this message was created.
*
- * @return int
+ * @return DateTimeInterface
*/
public function getDate()
{
- return $this->_getHeaderFieldModel('Date');
+ return $this->getHeaderFieldModel('Date');
}
/**
@@ -129,7 +123,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function setReturnPath($address)
{
- if (!$this->_setHeaderFieldModel('Return-Path', $address)) {
+ if (!$this->setHeaderFieldModel('Return-Path', $address)) {
$this->getHeaders()->addPathHeader('Return-Path', $address);
}
@@ -143,7 +137,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getReturnPath()
{
- return $this->_getHeaderFieldModel('Return-Path');
+ return $this->getHeaderFieldModel('Return-Path');
}
/**
@@ -159,10 +153,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setSender($address, $name = null)
{
if (!is_array($address) && isset($name)) {
- $address = array($address => $name);
+ $address = [$address => $name];
}
- if (!$this->_setHeaderFieldModel('Sender', (array) $address)) {
+ if (!$this->setHeaderFieldModel('Sender', (array) $address)) {
$this->getHeaders()->addMailboxHeader('Sender', (array) $address);
}
@@ -176,7 +170,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getSender()
{
- return $this->_getHeaderFieldModel('Sender');
+ return $this->getHeaderFieldModel('Sender');
}
/**
@@ -213,10 +207,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setFrom($addresses, $name = null)
{
if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ $addresses = [$addresses => $name];
}
- if (!$this->_setHeaderFieldModel('From', (array) $addresses)) {
+ if (!$this->setHeaderFieldModel('From', (array) $addresses)) {
$this->getHeaders()->addMailboxHeader('From', (array) $addresses);
}
@@ -230,7 +224,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getFrom()
{
- return $this->_getHeaderFieldModel('From');
+ return $this->getHeaderFieldModel('From');
}
/**
@@ -267,10 +261,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setReplyTo($addresses, $name = null)
{
if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ $addresses = [$addresses => $name];
}
- if (!$this->_setHeaderFieldModel('Reply-To', (array) $addresses)) {
+ if (!$this->setHeaderFieldModel('Reply-To', (array) $addresses)) {
$this->getHeaders()->addMailboxHeader('Reply-To', (array) $addresses);
}
@@ -284,7 +278,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getReplyTo()
{
- return $this->_getHeaderFieldModel('Reply-To');
+ return $this->getHeaderFieldModel('Reply-To');
}
/**
@@ -322,10 +316,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setTo($addresses, $name = null)
{
if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ $addresses = [$addresses => $name];
}
- if (!$this->_setHeaderFieldModel('To', (array) $addresses)) {
+ if (!$this->setHeaderFieldModel('To', (array) $addresses)) {
$this->getHeaders()->addMailboxHeader('To', (array) $addresses);
}
@@ -339,7 +333,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getTo()
{
- return $this->_getHeaderFieldModel('To');
+ return $this->getHeaderFieldModel('To');
}
/**
@@ -374,10 +368,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setCc($addresses, $name = null)
{
if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ $addresses = [$addresses => $name];
}
- if (!$this->_setHeaderFieldModel('Cc', (array) $addresses)) {
+ if (!$this->setHeaderFieldModel('Cc', (array) $addresses)) {
$this->getHeaders()->addMailboxHeader('Cc', (array) $addresses);
}
@@ -391,7 +385,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getCc()
{
- return $this->_getHeaderFieldModel('Cc');
+ return $this->getHeaderFieldModel('Cc');
}
/**
@@ -426,10 +420,10 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
public function setBcc($addresses, $name = null)
{
if (!is_array($addresses) && isset($name)) {
- $addresses = array($addresses => $name);
+ $addresses = [$addresses => $name];
}
- if (!$this->_setHeaderFieldModel('Bcc', (array) $addresses)) {
+ if (!$this->setHeaderFieldModel('Bcc', (array) $addresses)) {
$this->getHeaders()->addMailboxHeader('Bcc', (array) $addresses);
}
@@ -443,7 +437,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getBcc()
{
- return $this->_getHeaderFieldModel('Bcc');
+ return $this->getHeaderFieldModel('Bcc');
}
/**
@@ -457,20 +451,20 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function setPriority($priority)
{
- $priorityMap = array(
+ $priorityMap = [
self::PRIORITY_HIGHEST => 'Highest',
self::PRIORITY_HIGH => 'High',
self::PRIORITY_NORMAL => 'Normal',
self::PRIORITY_LOW => 'Low',
self::PRIORITY_LOWEST => 'Lowest',
- );
+ ];
$pMapKeys = array_keys($priorityMap);
if ($priority > max($pMapKeys)) {
$priority = max($pMapKeys);
} elseif ($priority < min($pMapKeys)) {
$priority = min($pMapKeys);
}
- if (!$this->_setHeaderFieldModel('X-Priority',
+ if (!$this->setHeaderFieldModel('X-Priority',
sprintf('%d (%s)', $priority, $priorityMap[$priority]))) {
$this->getHeaders()->addTextHeader('X-Priority',
sprintf('%d (%s)', $priority, $priorityMap[$priority]));
@@ -489,11 +483,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getPriority()
{
- list($priority) = sscanf($this->_getHeaderFieldModel('X-Priority'),
+ list($priority) = sscanf($this->getHeaderFieldModel('X-Priority'),
'%[1-5]'
);
- return isset($priority) ? $priority : 3;
+ return $priority ?? 3;
}
/**
@@ -505,7 +499,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function setReadReceiptTo($addresses)
{
- if (!$this->_setHeaderFieldModel('Disposition-Notification-To', $addresses)) {
+ if (!$this->setHeaderFieldModel('Disposition-Notification-To', $addresses)) {
$this->getHeaders()
->addMailboxHeader('Disposition-Notification-To', $addresses);
}
@@ -520,19 +514,17 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function getReadReceiptTo()
{
- return $this->_getHeaderFieldModel('Disposition-Notification-To');
+ return $this->getHeaderFieldModel('Disposition-Notification-To');
}
/**
- * Attach a {@link Swift_Mime_MimeEntity} such as an Attachment or MimePart.
- *
- * @param Swift_Mime_MimeEntity $entity
+ * Attach a {@link Swift_Mime_SimpleMimeEntity} such as an Attachment or MimePart.
*
* @return $this
*/
- public function attach(Swift_Mime_MimeEntity $entity)
+ public function attach(Swift_Mime_SimpleMimeEntity $entity)
{
- $this->setChildren(array_merge($this->getChildren(), array($entity)));
+ $this->setChildren(array_merge($this->getChildren(), [$entity]));
return $this;
}
@@ -540,13 +532,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
/**
* Remove an already attached entity.
*
- * @param Swift_Mime_MimeEntity $entity
- *
* @return $this
*/
- public function detach(Swift_Mime_MimeEntity $entity)
+ public function detach(Swift_Mime_SimpleMimeEntity $entity)
{
- $newChildren = array();
+ $newChildren = [];
foreach ($this->getChildren() as $child) {
if ($entity !== $child) {
$newChildren[] = $child;
@@ -558,14 +548,13 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
}
/**
- * Attach a {@link Swift_Mime_MimeEntity} and return it's CID source.
- * This method should be used when embedding images or other data in a message.
+ * Attach a {@link Swift_Mime_SimpleMimeEntity} and return it's CID source.
*
- * @param Swift_Mime_MimeEntity $entity
+ * This method should be used when embedding images or other data in a message.
*
* @return string
*/
- public function embed(Swift_Mime_MimeEntity $entity)
+ public function embed(Swift_Mime_SimpleMimeEntity $entity)
{
$this->attach($entity);
@@ -579,8 +568,8 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
*/
public function toString()
{
- if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));
+ if (count($children = $this->getChildren()) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $children));
$string = parent::toString();
$this->setChildren($children);
} else {
@@ -604,13 +593,11 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
/**
* Write this message to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream $is
*/
public function toByteStream(Swift_InputByteStream $is)
{
- if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
- $this->setChildren(array_merge(array($this->_becomeMimePart()), $children));
+ if (count($children = $this->getChildren()) > 0 && '' != $this->getBody()) {
+ $this->setChildren(array_merge([$this->becomeMimePart()], $children));
parent::toByteStream($is);
$this->setChildren($children);
} else {
@@ -618,29 +605,29 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
}
}
- /** @see Swift_Mime_SimpleMimeEntity::_getIdField() */
- protected function _getIdField()
+ /** @see Swift_Mime_SimpleMimeEntity::getIdField() */
+ protected function getIdField()
{
return 'Message-ID';
}
/** Turn the body of this message into a child of itself if needed */
- protected function _becomeMimePart()
+ protected function becomeMimePart()
{
$part = new parent($this->getHeaders()->newInstance(), $this->getEncoder(),
- $this->_getCache(), $this->_getGrammar(), $this->_userCharset
+ $this->getCache(), $this->getIdGenerator(), $this->userCharset
);
- $part->setContentType($this->_userContentType);
+ $part->setContentType($this->userContentType);
$part->setBody($this->getBody());
- $part->setFormat($this->_userFormat);
- $part->setDelSp($this->_userDelSp);
- $part->_setNestingLevel($this->_getTopNestingLevel());
+ $part->setFormat($this->userFormat);
+ $part->setDelSp($this->userDelSp);
+ $part->setNestingLevel($this->getTopNestingLevel());
return $part;
}
/** Get the highest nesting level nested inside this message */
- private function _getTopNestingLevel()
+ private function getTopNestingLevel()
{
$highestLevel = $this->getNestingLevel();
foreach ($this->getChildren() as $child) {
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
index a13f1b23d4..63dda3d6ea 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleMimeEntity.php
@@ -13,79 +13,86 @@
*
* @author Chris Corbyn
*/
-class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
+class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_Mime_EncodingObserver
{
+ /** Main message document; there can only be one of these */
+ const LEVEL_TOP = 16;
+
+ /** An entity which nests with the same precedence as an attachment */
+ const LEVEL_MIXED = 256;
+
+ /** An entity which nests with the same precedence as a mime part */
+ const LEVEL_ALTERNATIVE = 4096;
+
+ /** An entity which nests with the same precedence as embedded content */
+ const LEVEL_RELATED = 65536;
+
/** A collection of Headers for this mime entity */
- private $_headers;
+ private $headers;
/** The body as a string, or a stream */
- private $_body;
+ private $body;
/** The encoder that encodes the body into a streamable format */
- private $_encoder;
+ private $encoder;
- /** The grammar to use for id validation */
- private $_grammar;
+ /** Message ID generator */
+ private $idGenerator;
/** A mime boundary, if any is used */
- private $_boundary;
+ private $boundary;
/** Mime types to be used based on the nesting level */
- private $_compositeRanges = array(
- 'multipart/mixed' => array(self::LEVEL_TOP, self::LEVEL_MIXED),
- 'multipart/alternative' => array(self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE),
- 'multipart/related' => array(self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED),
- );
+ private $compositeRanges = [
+ 'multipart/mixed' => [self::LEVEL_TOP, self::LEVEL_MIXED],
+ 'multipart/alternative' => [self::LEVEL_MIXED, self::LEVEL_ALTERNATIVE],
+ 'multipart/related' => [self::LEVEL_ALTERNATIVE, self::LEVEL_RELATED],
+ ];
/** A set of filter rules to define what level an entity should be nested at */
- private $_compoundLevelFilters = array();
+ private $compoundLevelFilters = [];
/** The nesting level of this entity */
- private $_nestingLevel = self::LEVEL_ALTERNATIVE;
+ private $nestingLevel = self::LEVEL_ALTERNATIVE;
/** A KeyCache instance used during encoding and streaming */
- private $_cache;
+ private $cache;
/** Direct descendants of this entity */
- private $_immediateChildren = array();
+ private $immediateChildren = [];
/** All descendants of this entity */
- private $_children = array();
+ private $children = [];
/** The maximum line length of the body of this entity */
- private $_maxLineLength = 78;
+ private $maxLineLength = 78;
/** The order in which alternative mime types should appear */
- private $_alternativePartOrder = array(
+ private $alternativePartOrder = [
'text/plain' => 1,
'text/html' => 2,
'multipart/related' => 3,
- );
+ ];
/** The CID of this entity */
- private $_id;
+ private $id;
/** The key used for accessing the cache */
- private $_cacheKey;
+ private $cacheKey;
- protected $_userContentType;
+ protected $userContentType;
/**
* Create a new SimpleMimeEntity with $headers, $encoder and $cache.
- *
- * @param Swift_Mime_HeaderSet $headers
- * @param Swift_Mime_ContentEncoder $encoder
- * @param Swift_KeyCache $cache
- * @param Swift_Mime_Grammar $grammar
*/
- public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_Mime_Grammar $grammar)
+ public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
{
- $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true));
- $this->_cache = $cache;
- $this->_headers = $headers;
- $this->_grammar = $grammar;
+ $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
+ $this->cache = $cache;
+ $this->headers = $headers;
+ $this->idGenerator = $idGenerator;
$this->setEncoder($encoder);
- $this->_headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));
+ $this->headers->defineOrdering(['Content-Type', 'Content-Transfer-Encoding']);
// This array specifies that, when the entire MIME document contains
// $compoundLevel, then for each child within $level, if its Content-Type
@@ -100,16 +107,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
// )
// )
- $this->_compoundLevelFilters = array(
- (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => array(
- self::LEVEL_ALTERNATIVE => array(
+ $this->compoundLevelFilters = [
+ (self::LEVEL_ALTERNATIVE + self::LEVEL_RELATED) => [
+ self::LEVEL_ALTERNATIVE => [
'text/plain' => self::LEVEL_ALTERNATIVE,
'text/html' => self::LEVEL_RELATED,
- ),
- ),
- );
+ ],
+ ],
+ ];
- $this->_id = $this->getRandomId();
+ $this->id = $this->idGenerator->generateId();
}
/**
@@ -119,19 +126,19 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function generateId()
{
- $this->setId($this->getRandomId());
+ $this->setId($this->idGenerator->generateId());
- return $this->_id;
+ return $this->id;
}
/**
- * Get the {@link Swift_Mime_HeaderSet} for this entity.
+ * Get the {@link Swift_Mime_SimpleHeaderSet} for this entity.
*
- * @return Swift_Mime_HeaderSet
+ * @return Swift_Mime_SimpleHeaderSet
*/
public function getHeaders()
{
- return $this->_headers;
+ return $this->headers;
}
/**
@@ -143,7 +150,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getNestingLevel()
{
- return $this->_nestingLevel;
+ return $this->nestingLevel;
}
/**
@@ -153,7 +160,17 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getContentType()
{
- return $this->_getHeaderFieldModel('Content-Type');
+ return $this->getHeaderFieldModel('Content-Type');
+ }
+
+ /**
+ * Get the Body Content-type of this entity.
+ *
+ * @return string
+ */
+ public function getBodyContentType()
+ {
+ return $this->userContentType;
}
/**
@@ -165,10 +182,10 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setContentType($type)
{
- $this->_setContentTypeInHeaders($type);
+ $this->setContentTypeInHeaders($type);
// Keep track of the value so that if the content-type changes automatically
// due to added child entities, it can be restored if they are later removed
- $this->_userContentType = $type;
+ $this->userContentType = $type;
return $this;
}
@@ -182,9 +199,9 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getId()
{
- $tmp = (array) $this->_getHeaderFieldModel($this->_getIdField());
+ $tmp = (array) $this->getHeaderFieldModel($this->getIdField());
- return $this->_headers->has($this->_getIdField()) ? current($tmp) : $this->_id;
+ return $this->headers->has($this->getIdField()) ? current($tmp) : $this->id;
}
/**
@@ -196,10 +213,10 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setId($id)
{
- if (!$this->_setHeaderFieldModel($this->_getIdField(), $id)) {
- $this->_headers->addIdHeader($this->_getIdField(), $id);
+ if (!$this->setHeaderFieldModel($this->getIdField(), $id)) {
+ $this->headers->addIdHeader($this->getIdField(), $id);
}
- $this->_id = $id;
+ $this->id = $id;
return $this;
}
@@ -213,7 +230,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getDescription()
{
- return $this->_getHeaderFieldModel('Content-Description');
+ return $this->getHeaderFieldModel('Content-Description');
}
/**
@@ -227,8 +244,8 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setDescription($description)
{
- if (!$this->_setHeaderFieldModel('Content-Description', $description)) {
- $this->_headers->addTextHeader('Content-Description', $description);
+ if (!$this->setHeaderFieldModel('Content-Description', $description)) {
+ $this->headers->addTextHeader('Content-Description', $description);
}
return $this;
@@ -241,7 +258,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getMaxLineLength()
{
- return $this->_maxLineLength;
+ return $this->maxLineLength;
}
/**
@@ -255,7 +272,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setMaxLineLength($length)
{
- $this->_maxLineLength = $length;
+ $this->maxLineLength = $length;
return $this;
}
@@ -263,44 +280,43 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Get all children added to this entity.
*
- * @return Swift_Mime_MimeEntity[]
+ * @return Swift_Mime_SimpleMimeEntity[]
*/
public function getChildren()
{
- return $this->_children;
+ return $this->children;
}
/**
* Set all children of this entity.
*
- * @param Swift_Mime_MimeEntity[] $children
- * @param int $compoundLevel For internal use only
+ * @param Swift_Mime_SimpleMimeEntity[] $children
+ * @param int $compoundLevel For internal use only
*
* @return $this
*/
public function setChildren(array $children, $compoundLevel = null)
{
// TODO: Try to refactor this logic
-
- $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children);
- $immediateChildren = array();
- $grandchildren = array();
- $newContentType = $this->_userContentType;
+ $compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
+ $immediateChildren = [];
+ $grandchildren = [];
+ $newContentType = $this->userContentType;
foreach ($children as $child) {
- $level = $this->_getNeededChildLevel($child, $compoundLevel);
+ $level = $this->getNeededChildLevel($child, $compoundLevel);
if (empty($immediateChildren)) {
//first iteration
- $immediateChildren = array($child);
+ $immediateChildren = [$child];
} else {
- $nextLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel);
+ $nextLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel);
if ($nextLevel == $level) {
$immediateChildren[] = $child;
} elseif ($level < $nextLevel) {
// Re-assign immediateChildren to grandchildren
$grandchildren = array_merge($grandchildren, $immediateChildren);
// Set new children
- $immediateChildren = array($child);
+ $immediateChildren = [$child];
} else {
$grandchildren[] = $child;
}
@@ -308,11 +324,11 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
}
if ($immediateChildren) {
- $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel);
+ $lowestLevel = $this->getNeededChildLevel($immediateChildren[0], $compoundLevel);
// Determine which composite media type is needed to accommodate the
// immediate children
- foreach ($this->_compositeRanges as $mediaType => $range) {
+ foreach ($this->compositeRanges as $mediaType => $range) {
if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) {
$newContentType = $mediaType;
@@ -322,18 +338,18 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
// Put any grandchildren in a subpart
if (!empty($grandchildren)) {
- $subentity = $this->_createChild();
- $subentity->_setNestingLevel($lowestLevel);
+ $subentity = $this->createChild();
+ $subentity->setNestingLevel($lowestLevel);
$subentity->setChildren($grandchildren, $compoundLevel);
array_unshift($immediateChildren, $subentity);
}
}
- $this->_immediateChildren = $immediateChildren;
- $this->_children = $children;
- $this->_setContentTypeInHeaders($newContentType);
- $this->_fixHeaders();
- $this->_sortChildren();
+ $this->immediateChildren = $immediateChildren;
+ $this->children = $children;
+ $this->setContentTypeInHeaders($newContentType);
+ $this->fixHeaders();
+ $this->sortChildren();
return $this;
}
@@ -345,7 +361,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getBody()
{
- return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body;
+ return $this->body instanceof Swift_OutputByteStream ? $this->readStream($this->body) : $this->body;
}
/**
@@ -359,12 +375,12 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setBody($body, $contentType = null)
{
- if ($body !== $this->_body) {
- $this->_clearCache();
+ if ($body !== $this->body) {
+ $this->clearCache();
}
- $this->_body = $body;
- if (isset($contentType)) {
+ $this->body = $body;
+ if (null !== $contentType) {
$this->setContentType($contentType);
}
@@ -378,25 +394,23 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getEncoder()
{
- return $this->_encoder;
+ return $this->encoder;
}
/**
* Set the encoder used for the body of this entity.
*
- * @param Swift_Mime_ContentEncoder $encoder
- *
* @return $this
*/
public function setEncoder(Swift_Mime_ContentEncoder $encoder)
{
- if ($encoder !== $this->_encoder) {
- $this->_clearCache();
+ if ($encoder !== $this->encoder) {
+ $this->clearCache();
}
- $this->_encoder = $encoder;
- $this->_setEncoding($encoder->getName());
- $this->_notifyEncoderChanged($encoder);
+ $this->encoder = $encoder;
+ $this->setEncoding($encoder->getName());
+ $this->notifyEncoderChanged($encoder);
return $this;
}
@@ -408,11 +422,11 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function getBoundary()
{
- if (!isset($this->_boundary)) {
- $this->_boundary = '_=_swift_v4_'.time().'_'.md5(getmypid().mt_rand().uniqid('', true)).'_=_';
+ if (!isset($this->boundary)) {
+ $this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
}
- return $this->_boundary;
+ return $this->boundary;
}
/**
@@ -426,8 +440,8 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function setBoundary($boundary)
{
- $this->_assertValidBoundary($boundary);
- $this->_boundary = $boundary;
+ $this->assertValidBoundary($boundary);
+ $this->boundary = $boundary;
return $this;
}
@@ -440,18 +454,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function charsetChanged($charset)
{
- $this->_notifyCharsetChanged($charset);
+ $this->notifyCharsetChanged($charset);
}
/**
* Receive notification that the encoder of this entity or a parent entity
* has changed.
- *
- * @param Swift_Mime_ContentEncoder $encoder
*/
public function encoderChanged(Swift_Mime_ContentEncoder $encoder)
{
- $this->_notifyEncoderChanged($encoder);
+ $this->notifyEncoderChanged($encoder);
}
/**
@@ -461,8 +473,8 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function toString()
{
- $string = $this->_headers->toString();
- $string .= $this->_bodyToString();
+ $string = $this->headers->toString();
+ $string .= $this->bodyToString();
return $string;
}
@@ -472,22 +484,22 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*
* @return string
*/
- protected function _bodyToString()
+ protected function bodyToString()
{
$string = '';
- if (isset($this->_body) && empty($this->_immediateChildren)) {
- if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
- $body = $this->_cache->getString($this->_cacheKey, 'body');
+ if (isset($this->body) && empty($this->immediateChildren)) {
+ if ($this->cache->hasKey($this->cacheKey, 'body')) {
+ $body = $this->cache->getString($this->cacheKey, 'body');
} else {
- $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength());
- $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE);
+ $body = "\r\n".$this->encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength());
+ $this->cache->setString($this->cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE);
}
$string .= $body;
}
- if (!empty($this->_immediateChildren)) {
- foreach ($this->_immediateChildren as $child) {
+ if (!empty($this->immediateChildren)) {
+ foreach ($this->immediateChildren as $child) {
$string .= "\r\n\r\n--".$this->getBoundary()."\r\n";
$string .= $child->toString();
}
@@ -511,42 +523,38 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Write this entire entity to a {@see Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream
*/
public function toByteStream(Swift_InputByteStream $is)
{
- $is->write($this->_headers->toString());
+ $is->write($this->headers->toString());
$is->commit();
- $this->_bodyToByteStream($is);
+ $this->bodyToByteStream($is);
}
/**
* Write this entire entity to a {@link Swift_InputByteStream}.
- *
- * @param Swift_InputByteStream
*/
- protected function _bodyToByteStream(Swift_InputByteStream $is)
+ protected function bodyToByteStream(Swift_InputByteStream $is)
{
- if (empty($this->_immediateChildren)) {
- if (isset($this->_body)) {
- if ($this->_cache->hasKey($this->_cacheKey, 'body')) {
- $this->_cache->exportToByteStream($this->_cacheKey, 'body', $is);
+ if (empty($this->immediateChildren)) {
+ if (isset($this->body)) {
+ if ($this->cache->hasKey($this->cacheKey, 'body')) {
+ $this->cache->exportToByteStream($this->cacheKey, 'body', $is);
} else {
- $cacheIs = $this->_cache->getInputByteStream($this->_cacheKey, 'body');
+ $cacheIs = $this->cache->getInputByteStream($this->cacheKey, 'body');
if ($cacheIs) {
$is->bind($cacheIs);
}
$is->write("\r\n");
- if ($this->_body instanceof Swift_OutputByteStream) {
- $this->_body->setReadPointer(0);
+ if ($this->body instanceof Swift_OutputByteStream) {
+ $this->body->setReadPointer(0);
- $this->_encoder->encodeByteStream($this->_body, $is, 0, $this->getMaxLineLength());
+ $this->encoder->encodeByteStream($this->body, $is, 0, $this->getMaxLineLength());
} else {
- $is->write($this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()));
+ $is->write($this->encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()));
}
if ($cacheIs) {
@@ -556,8 +564,8 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
}
}
- if (!empty($this->_immediateChildren)) {
- foreach ($this->_immediateChildren as $child) {
+ if (!empty($this->immediateChildren)) {
+ foreach ($this->immediateChildren as $child) {
$is->write("\r\n\r\n--".$this->getBoundary()."\r\n");
$child->toByteStream($is);
}
@@ -568,7 +576,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Get the name of the header that provides the ID of this entity.
*/
- protected function _getIdField()
+ protected function getIdField()
{
return 'Content-ID';
}
@@ -576,20 +584,20 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Get the model data (usually an array or a string) for $field.
*/
- protected function _getHeaderFieldModel($field)
+ protected function getHeaderFieldModel($field)
{
- if ($this->_headers->has($field)) {
- return $this->_headers->get($field)->getFieldBodyModel();
+ if ($this->headers->has($field)) {
+ return $this->headers->get($field)->getFieldBodyModel();
}
}
/**
* Set the model data for $field.
*/
- protected function _setHeaderFieldModel($field, $model)
+ protected function setHeaderFieldModel($field, $model)
{
- if ($this->_headers->has($field)) {
- $this->_headers->get($field)->setFieldBodyModel($model);
+ if ($this->headers->has($field)) {
+ $this->headers->get($field)->setFieldBodyModel($model);
return true;
}
@@ -600,20 +608,20 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Get the parameter value of $parameter on $field header.
*/
- protected function _getHeaderParameter($field, $parameter)
+ protected function getHeaderParameter($field, $parameter)
{
- if ($this->_headers->has($field)) {
- return $this->_headers->get($field)->getParameter($parameter);
+ if ($this->headers->has($field)) {
+ return $this->headers->get($field)->getParameter($parameter);
}
}
/**
* Set the parameter value of $parameter on $field header.
*/
- protected function _setHeaderParameter($field, $parameter, $value)
+ protected function setHeaderParameter($field, $parameter, $value)
{
- if ($this->_headers->has($field)) {
- $this->_headers->get($field)->setParameter($parameter, $value);
+ if ($this->headers->has($field)) {
+ $this->headers->get($field)->setParameter($parameter, $value);
return true;
}
@@ -624,16 +632,16 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
/**
* Re-evaluate what content type and encoding should be used on this entity.
*/
- protected function _fixHeaders()
+ protected function fixHeaders()
{
- if (count($this->_immediateChildren)) {
- $this->_setHeaderParameter('Content-Type', 'boundary',
+ if (count($this->immediateChildren)) {
+ $this->setHeaderParameter('Content-Type', 'boundary',
$this->getBoundary()
);
- $this->_headers->remove('Content-Transfer-Encoding');
+ $this->headers->remove('Content-Transfer-Encoding');
} else {
- $this->_setHeaderParameter('Content-Type', 'boundary', null);
- $this->_setEncoding($this->_encoder->getName());
+ $this->setHeaderParameter('Content-Type', 'boundary', null);
+ $this->setEncoding($this->encoder->getName());
}
}
@@ -642,50 +650,30 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*
* @return Swift_KeyCache
*/
- protected function _getCache()
+ protected function getCache()
{
- return $this->_cache;
+ return $this->cache;
}
/**
- * Get the grammar used for validation.
+ * Get the ID generator.
*
- * @return Swift_Mime_Grammar
+ * @return Swift_IdGenerator
*/
- protected function _getGrammar()
+ protected function getIdGenerator()
{
- return $this->_grammar;
+ return $this->idGenerator;
}
/**
* Empty the KeyCache for this entity.
*/
- protected function _clearCache()
+ protected function clearCache()
{
- $this->_cache->clearKey($this->_cacheKey, 'body');
+ $this->cache->clearKey($this->cacheKey, 'body');
}
- /**
- * Returns a random Content-ID or Message-ID.
- *
- * @return string
- */
- protected function getRandomId()
- {
- $idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
- $idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated';
- $id = $idLeft.'@'.$idRight;
-
- try {
- $this->_assertValidId($id);
- } catch (Swift_RfcComplianceException $e) {
- $id = $idLeft.'@swift.generated';
- }
-
- return $id;
- }
-
- private function _readStream(Swift_OutputByteStream $os)
+ private function readStream(Swift_OutputByteStream $os)
{
$string = '';
while (false !== $bytes = $os->read(8192)) {
@@ -697,33 +685,33 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
return $string;
}
- private function _setEncoding($encoding)
+ private function setEncoding($encoding)
{
- if (!$this->_setHeaderFieldModel('Content-Transfer-Encoding', $encoding)) {
- $this->_headers->addTextHeader('Content-Transfer-Encoding', $encoding);
+ if (!$this->setHeaderFieldModel('Content-Transfer-Encoding', $encoding)) {
+ $this->headers->addTextHeader('Content-Transfer-Encoding', $encoding);
}
}
- private function _assertValidBoundary($boundary)
+ private function assertValidBoundary($boundary)
{
if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) {
throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.');
}
}
- private function _setContentTypeInHeaders($type)
+ private function setContentTypeInHeaders($type)
{
- if (!$this->_setHeaderFieldModel('Content-Type', $type)) {
- $this->_headers->addParameterizedHeader('Content-Type', $type);
+ if (!$this->setHeaderFieldModel('Content-Type', $type)) {
+ $this->headers->addParameterizedHeader('Content-Type', $type);
}
}
- private function _setNestingLevel($level)
+ private function setNestingLevel($level)
{
- $this->_nestingLevel = $level;
+ $this->nestingLevel = $level;
}
- private function _getCompoundLevel($children)
+ private function getCompoundLevel($children)
{
$level = 0;
foreach ($children as $child) {
@@ -733,10 +721,10 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
return $level;
}
- private function _getNeededChildLevel($child, $compoundLevel)
+ private function getNeededChildLevel($child, $compoundLevel)
{
- $filter = array();
- foreach ($this->_compoundLevelFilters as $bitmask => $rules) {
+ $filter = [];
+ foreach ($this->compoundLevelFilters as $bitmask => $rules) {
if (($compoundLevel & $bitmask) === $bitmask) {
$filter = $rules + $filter;
}
@@ -752,33 +740,33 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
return $realLevel;
}
- private function _createChild()
+ private function createChild()
{
- return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar);
+ return new self($this->headers->newInstance(), $this->encoder, $this->cache, $this->idGenerator);
}
- private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder)
+ private function notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder)
{
- foreach ($this->_immediateChildren as $child) {
+ foreach ($this->immediateChildren as $child) {
$child->encoderChanged($encoder);
}
}
- private function _notifyCharsetChanged($charset)
+ private function notifyCharsetChanged($charset)
{
- $this->_encoder->charsetChanged($charset);
- $this->_headers->charsetChanged($charset);
- foreach ($this->_immediateChildren as $child) {
+ $this->encoder->charsetChanged($charset);
+ $this->headers->charsetChanged($charset);
+ foreach ($this->immediateChildren as $child) {
$child->charsetChanged($charset);
}
}
- private function _sortChildren()
+ private function sortChildren()
{
$shouldSort = false;
- foreach ($this->_immediateChildren as $child) {
+ foreach ($this->immediateChildren as $child) {
// NOTE: This include alternative parts moved into a related part
- if ($child->getNestingLevel() == self::LEVEL_ALTERNATIVE) {
+ if (self::LEVEL_ALTERNATIVE == $child->getNestingLevel()) {
$shouldSort = true;
break;
}
@@ -787,13 +775,13 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
// Sort in order of preference, if there is one
if ($shouldSort) {
// Group the messages by order of preference
- $sorted = array();
- foreach ($this->_immediateChildren as $child) {
+ $sorted = [];
+ foreach ($this->immediateChildren as $child) {
$type = $child->getContentType();
- $level = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1;
+ $level = array_key_exists($type, $this->alternativePartOrder) ? $this->alternativePartOrder[$type] : max($this->alternativePartOrder) + 1;
if (empty($sorted[$level])) {
- $sorted[$level] = array();
+ $sorted[$level] = [];
}
$sorted[$level][] = $child;
@@ -801,7 +789,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
ksort($sorted);
- $this->_immediateChildren = array_reduce($sorted, 'array_merge', array());
+ $this->immediateChildren = array_reduce($sorted, 'array_merge', []);
}
}
@@ -810,22 +798,8 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function __destruct()
{
- if ($this->_cache instanceof Swift_KeyCache) {
- $this->_cache->clearAll($this->_cacheKey);
- }
- }
-
- /**
- * Throws an Exception if the id passed does not comply with RFC 2822.
- *
- * @param string $id
- *
- * @throws Swift_RfcComplianceException
- */
- private function _assertValidId($id)
- {
- if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) {
- throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>');
+ if ($this->cache instanceof Swift_KeyCache) {
+ $this->cache->clearAll($this->cacheKey);
}
}
@@ -834,11 +808,11 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
*/
public function __clone()
{
- $this->_headers = clone $this->_headers;
- $this->_encoder = clone $this->_encoder;
- $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true));
- $children = array();
- foreach ($this->_children as $pos => $child) {
+ $this->headers = clone $this->headers;
+ $this->encoder = clone $this->encoder;
+ $this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
+ $children = [];
+ foreach ($this->children as $pos => $child) {
$children[$pos] = clone $child;
}
$this->setChildren($children);
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php
index 525b7ec8eb..14f84324aa 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/MimePart.php
@@ -27,7 +27,7 @@ class Swift_MimePart extends Swift_Mime_MimePart
public function __construct($body = null, $contentType = null, $charset = null)
{
call_user_func_array(
- array($this, 'Swift_Mime_MimePart::__construct'),
+ [$this, 'Swift_Mime_MimePart::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('mime.part')
);
@@ -42,18 +42,4 @@ class Swift_MimePart extends Swift_Mime_MimePart
$this->setContentType($contentType);
}
}
-
- /**
- * Create a new MimePart.
- *
- * @param string $body
- * @param string $contentType
- * @param string $charset
- *
- * @return self
- */
- public static function newInstance($body = null, $contentType = null, $charset = null)
- {
- return new self($body, $contentType, $charset);
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php
index ddde335c53..eefb9a6f7f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/NullTransport.php
@@ -18,19 +18,9 @@ class Swift_NullTransport extends Swift_Transport_NullTransport
public function __construct()
{
call_user_func_array(
- array($this, 'Swift_Transport_NullTransport::__construct'),
+ [$this, 'Swift_Transport_NullTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.null')
);
}
-
- /**
- * Create a new NullTransport instance.
- *
- * @return self
- */
- public static function newInstance()
- {
- return new self();
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
index a2ec2abcd5..5b1d7deeff 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/AntiFloodPlugin.php
@@ -20,28 +20,28 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*
* @var int
*/
- private $_threshold;
+ private $threshold;
/**
* The number of seconds to sleep for during a restart.
*
* @var int
*/
- private $_sleep;
+ private $sleep;
/**
* The internal counter.
*
* @var int
*/
- private $_counter = 0;
+ private $counter = 0;
/**
* The Sleeper instance for sleeping.
*
* @var Swift_Plugins_Sleeper
*/
- private $_sleeper;
+ private $sleeper;
/**
* Create a new AntiFloodPlugin with $threshold and $sleep time.
@@ -54,7 +54,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
{
$this->setThreshold($threshold);
$this->setSleepTime($sleep);
- $this->_sleeper = $sleeper;
+ $this->sleeper = $sleeper;
}
/**
@@ -64,7 +64,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*/
public function setThreshold($threshold)
{
- $this->_threshold = $threshold;
+ $this->threshold = $threshold;
}
/**
@@ -74,7 +74,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*/
public function getThreshold()
{
- return $this->_threshold;
+ return $this->threshold;
}
/**
@@ -84,7 +84,7 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*/
public function setSleepTime($sleep)
{
- $this->_sleep = $sleep;
+ $this->sleep = $sleep;
}
/**
@@ -94,13 +94,11 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*/
public function getSleepTime()
{
- return $this->_sleep;
+ return $this->sleep;
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -108,20 +106,18 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
- ++$this->_counter;
- if ($this->_counter >= $this->_threshold) {
+ ++$this->counter;
+ if ($this->counter >= $this->threshold) {
$transport = $evt->getTransport();
$transport->stop();
- if ($this->_sleep) {
- $this->sleep($this->_sleep);
+ if ($this->sleep) {
+ $this->sleep($this->sleep);
}
$transport->start();
- $this->_counter = 0;
+ $this->counter = 0;
}
}
@@ -132,8 +128,8 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
*/
public function sleep($seconds)
{
- if (isset($this->_sleeper)) {
- $this->_sleeper->sleep($seconds);
+ if (isset($this->sleeper)) {
+ $this->sleeper->sleep($seconds);
} else {
sleep($seconds);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
index f7e18d0ebe..f7a24dd00a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
@@ -20,17 +20,17 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*
* @var int
*/
- private $_out = 0;
+ private $out = 0;
/**
* The incoming traffic counter.
*
* @var int
*/
- private $_in = 0;
+ private $in = 0;
/** Bound byte streams */
- private $_mirrors = array();
+ private $mirrors = [];
/**
* Not used.
@@ -41,8 +41,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
@@ -52,24 +50,20 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
/**
* Invoked immediately following a command being sent.
- *
- * @param Swift_Events_CommandEvent $evt
*/
public function commandSent(Swift_Events_CommandEvent $evt)
{
$command = $evt->getCommand();
- $this->_out += strlen($command);
+ $this->out += strlen($command);
}
/**
* Invoked immediately following a response coming back.
- *
- * @param Swift_Events_ResponseEvent $evt
*/
public function responseReceived(Swift_Events_ResponseEvent $evt)
{
$response = $evt->getResponse();
- $this->_in += strlen($response);
+ $this->in += strlen($response);
}
/**
@@ -79,8 +73,8 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function write($bytes)
{
- $this->_out += strlen($bytes);
- foreach ($this->_mirrors as $stream) {
+ $this->out += strlen($bytes);
+ foreach ($this->mirrors as $stream) {
$stream->write($bytes);
}
}
@@ -97,12 +91,10 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
- $this->_mirrors[] = $is;
+ $this->mirrors[] = $is;
}
/**
@@ -111,14 +103,12 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
- foreach ($this->_mirrors as $k => $stream) {
+ foreach ($this->mirrors as $k => $stream) {
if ($is === $stream) {
- unset($this->_mirrors[$k]);
+ unset($this->mirrors[$k]);
}
}
}
@@ -128,7 +118,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function flushBuffers()
{
- foreach ($this->_mirrors as $stream) {
+ foreach ($this->mirrors as $stream) {
$stream->flushBuffers();
}
}
@@ -140,7 +130,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function getBytesOut()
{
- return $this->_out;
+ return $this->out;
}
/**
@@ -150,7 +140,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function getBytesIn()
{
- return $this->_in;
+ return $this->in;
}
/**
@@ -158,7 +148,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
*/
public function reset()
{
- $this->_out = 0;
- $this->_in = 0;
+ $this->out = 0;
+ $this->in = 0;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
index 0762b36d21..c4b6ee1271 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/DecoratorPlugin.php
@@ -17,19 +17,19 @@
class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_Plugins_Decorator_Replacements
{
/** The replacement map */
- private $_replacements;
+ private $replacements;
/** The body as it was before replacements */
- private $_originalBody;
+ private $originalBody;
/** The original headers of the message, before replacements */
- private $_originalHeaders = array();
+ private $originalHeaders = [];
/** Bodies of children before they are replaced */
- private $_originalChildBodies = array();
+ private $originalChildBodies = [];
/** The Message that was last replaced */
- private $_lastMessage;
+ private $lastMessage;
/**
* Create a new DecoratorPlugin with $replacements.
@@ -66,21 +66,19 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
public function setReplacements($replacements)
{
if (!($replacements instanceof Swift_Plugins_Decorator_Replacements)) {
- $this->_replacements = (array) $replacements;
+ $this->replacements = (array) $replacements;
} else {
- $this->_replacements = $replacements;
+ $this->replacements = $replacements;
}
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
- $this->_restoreMessage($message);
+ $this->restoreMessage($message);
$to = array_keys($message->getTo());
$address = array_shift($to);
if ($replacements = $this->getReplacementsFor($address)) {
@@ -91,7 +89,7 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
$search, $replace, $body
);
if ($body != $bodyReplaced) {
- $this->_originalBody = $body;
+ $this->originalBody = $body;
$message->setBody($bodyReplaced);
}
@@ -99,7 +97,7 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
$body = $header->getFieldBodyModel();
$count = 0;
if (is_array($body)) {
- $bodyReplaced = array();
+ $bodyReplaced = [];
foreach ($body as $key => $value) {
$count1 = 0;
$count2 = 0;
@@ -111,12 +109,12 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
$count = 1;
}
}
- } else {
+ } elseif (is_string($body)) {
$bodyReplaced = str_replace($search, $replace, $body, $count);
}
if ($count) {
- $this->_originalHeaders[$header->getFieldName()] = $body;
+ $this->originalHeaders[$header->getFieldName()] = $body;
$header->setFieldBodyModel($bodyReplaced);
}
}
@@ -131,11 +129,11 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
);
if ($body != $bodyReplaced) {
$child->setBody($bodyReplaced);
- $this->_originalChildBodies[$child->getId()] = $body;
+ $this->originalChildBodies[$child->getId()] = $body;
}
}
}
- $this->_lastMessage = $message;
+ $this->lastMessage = $message;
}
}
@@ -155,50 +153,48 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
*/
public function getReplacementsFor($address)
{
- if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) {
- return $this->_replacements->getReplacementsFor($address);
+ if ($this->replacements instanceof Swift_Plugins_Decorator_Replacements) {
+ return $this->replacements->getReplacementsFor($address);
}
- return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null;
+ return $this->replacements[$address] ?? null;
}
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
- $this->_restoreMessage($evt->getMessage());
+ $this->restoreMessage($evt->getMessage());
}
/** Restore a changed message back to its original state */
- private function _restoreMessage(Swift_Mime_Message $message)
+ private function restoreMessage(Swift_Mime_SimpleMessage $message)
{
- if ($this->_lastMessage === $message) {
- if (isset($this->_originalBody)) {
- $message->setBody($this->_originalBody);
- $this->_originalBody = null;
+ if ($this->lastMessage === $message) {
+ if (isset($this->originalBody)) {
+ $message->setBody($this->originalBody);
+ $this->originalBody = null;
}
- if (!empty($this->_originalHeaders)) {
+ if (!empty($this->originalHeaders)) {
foreach ($message->getHeaders()->getAll() as $header) {
- if (array_key_exists($header->getFieldName(), $this->_originalHeaders)) {
- $header->setFieldBodyModel($this->_originalHeaders[$header->getFieldName()]);
+ if (array_key_exists($header->getFieldName(), $this->originalHeaders)) {
+ $header->setFieldBodyModel($this->originalHeaders[$header->getFieldName()]);
}
}
- $this->_originalHeaders = array();
+ $this->originalHeaders = [];
}
- if (!empty($this->_originalChildBodies)) {
+ if (!empty($this->originalChildBodies)) {
$children = (array) $message->getChildren();
foreach ($children as $child) {
$id = $child->getId();
- if (array_key_exists($id, $this->_originalChildBodies)) {
- $child->setBody($this->_originalChildBodies[$id]);
+ if (array_key_exists($id, $this->originalChildBodies)) {
+ $child->setBody($this->originalChildBodies[$id]);
}
}
- $this->_originalChildBodies = array();
+ $this->originalChildBodies = [];
}
- $this->_lastMessage = null;
+ $this->lastMessage = null;
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
index 5834440534..3f4dbbfa40 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ImpersonatePlugin.php
@@ -20,7 +20,7 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
*
* @var string
*/
- private $_sender;
+ private $sender;
/**
* Create a new ImpersonatePlugin to impersonate $sender.
@@ -29,13 +29,11 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
*/
public function __construct($sender)
{
- $this->_sender = $sender;
+ $this->sender = $sender;
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -46,13 +44,11 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
$headers->addPathHeader('X-Swift-Return-Path', $message->getReturnPath());
// replace them with the one to send to
- $message->setReturnPath($this->_sender);
+ $message->setReturnPath($this->sender);
}
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
index 64db438464..c70a03824f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/LoggerPlugin.php
@@ -11,21 +11,19 @@
/**
* Does real time logging of Transport level information.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_Events_ResponseListener, Swift_Events_TransportChangeListener, Swift_Events_TransportExceptionListener, Swift_Plugins_Logger
{
/** The logger which is delegated to */
- private $_logger;
+ private $logger;
/**
* Create a new LoggerPlugin using $logger.
- *
- * @param Swift_Plugins_Logger $logger
*/
public function __construct(Swift_Plugins_Logger $logger)
{
- $this->_logger = $logger;
+ $this->logger = $logger;
}
/**
@@ -35,7 +33,7 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
*/
public function add($entry)
{
- $this->_logger->add($entry);
+ $this->logger->add($entry);
}
/**
@@ -43,7 +41,7 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
*/
public function clear()
{
- $this->_logger->clear();
+ $this->logger->clear();
}
/**
@@ -53,89 +51,75 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
*/
public function dump()
{
- return $this->_logger->dump();
+ return $this->logger->dump();
}
/**
* Invoked immediately following a command being sent.
- *
- * @param Swift_Events_CommandEvent $evt
*/
public function commandSent(Swift_Events_CommandEvent $evt)
{
$command = $evt->getCommand();
- $this->_logger->add(sprintf('>> %s', $command));
+ $this->logger->add(sprintf('>> %s', $command));
}
/**
* Invoked immediately following a response coming back.
- *
- * @param Swift_Events_ResponseEvent $evt
*/
public function responseReceived(Swift_Events_ResponseEvent $evt)
{
$response = $evt->getResponse();
- $this->_logger->add(sprintf('<< %s', $response));
+ $this->logger->add(sprintf('<< %s', $response));
}
/**
* Invoked just before a Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
{
$transportName = get_class($evt->getSource());
- $this->_logger->add(sprintf('++ Starting %s', $transportName));
+ $this->logger->add(sprintf('++ Starting %s', $transportName));
}
/**
* Invoked immediately after the Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStarted(Swift_Events_TransportChangeEvent $evt)
{
$transportName = get_class($evt->getSource());
- $this->_logger->add(sprintf('++ %s started', $transportName));
+ $this->logger->add(sprintf('++ %s started', $transportName));
}
/**
* Invoked just before a Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
{
$transportName = get_class($evt->getSource());
- $this->_logger->add(sprintf('++ Stopping %s', $transportName));
+ $this->logger->add(sprintf('++ Stopping %s', $transportName));
}
/**
* Invoked immediately after the Transport is stopped.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function transportStopped(Swift_Events_TransportChangeEvent $evt)
{
$transportName = get_class($evt->getSource());
- $this->_logger->add(sprintf('++ %s stopped', $transportName));
+ $this->logger->add(sprintf('++ %s stopped', $transportName));
}
/**
* Invoked as a TransportException is thrown in the Transport system.
- *
- * @param Swift_Events_TransportExceptionEvent $evt
*/
public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
{
$e = $evt->getException();
$message = $e->getMessage();
$code = $e->getCode();
- $this->_logger->add(sprintf('!! %s (code: %s)', $message, $code));
+ $this->logger->add(sprintf('!! %s (code: %s)', $message, $code));
$message .= PHP_EOL;
$message .= 'Log data:'.PHP_EOL;
- $message .= $this->_logger->dump();
+ $message .= $this->logger->dump();
$evt->cancelBubble();
throw new Swift_TransportException($message, $code, $e->getPrevious());
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
index 865bb0aa3b..b00bcaa11d 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/ArrayLogger.php
@@ -20,14 +20,14 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*
* @var array
*/
- private $_log = array();
+ private $log = [];
/**
* Max size of the log.
*
* @var int
*/
- private $_size = 0;
+ private $size = 0;
/**
* Create a new ArrayLogger with a maximum of $size entries.
@@ -36,7 +36,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*/
public function __construct($size = 50)
{
- $this->_size = $size;
+ $this->size = $size;
}
/**
@@ -46,9 +46,9 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*/
public function add($entry)
{
- $this->_log[] = $entry;
- while (count($this->_log) > $this->_size) {
- array_shift($this->_log);
+ $this->log[] = $entry;
+ while (count($this->log) > $this->size) {
+ array_shift($this->log);
}
}
@@ -57,7 +57,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*/
public function clear()
{
- $this->_log = array();
+ $this->log = [];
}
/**
@@ -67,6 +67,6 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
*/
public function dump()
{
- return implode(PHP_EOL, $this->_log);
+ return implode(PHP_EOL, $this->log);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php
index 3583297ab1..40a53d2bba 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Loggers/EchoLogger.php
@@ -16,7 +16,7 @@
class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger
{
/** Whether or not HTML should be output */
- private $_isHtml;
+ private $isHtml;
/**
* Create a new EchoLogger.
@@ -25,7 +25,7 @@ class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger
*/
public function __construct($isHtml = true)
{
- $this->_isHtml = $isHtml;
+ $this->isHtml = $isHtml;
}
/**
@@ -35,7 +35,7 @@ class Swift_Plugins_Loggers_EchoLogger implements Swift_Plugins_Logger
*/
public function add($entry)
{
- if ($this->_isHtml) {
+ if ($this->isHtml) {
printf('%s%s%s', htmlspecialchars($entry, ENT_QUOTES), '<br />', PHP_EOL);
} else {
printf('%s%s', $entry, PHP_EOL);
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
index 5ff1d9321c..3b4de80ecf 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/MessageLogger.php
@@ -16,19 +16,19 @@
class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
{
/**
- * @var Swift_Mime_Message[]
+ * @var Swift_Mime_SimpleMessage[]
*/
private $messages;
public function __construct()
{
- $this->messages = array();
+ $this->messages = [];
}
/**
* Get the message list.
*
- * @return Swift_Mime_Message[]
+ * @return Swift_Mime_SimpleMessage[]
*/
public function getMessages()
{
@@ -50,13 +50,11 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
*/
public function clear()
{
- $this->messages = array();
+ $this->messages = [];
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -65,8 +63,6 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
index 31461526cb..1d5da1c644 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
@@ -11,87 +11,70 @@
/**
* Makes sure a connection to a POP3 host has been established prior to connecting to SMTP.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeListener, Swift_Plugins_Pop_Pop3Connection
{
/** A delegate connection to use (mostly a test hook) */
- private $_connection;
+ private $connection;
/** Hostname of the POP3 server */
- private $_host;
+ private $host;
/** Port number to connect on */
- private $_port;
+ private $port;
/** Encryption type to use (if any) */
- private $_crypto;
+ private $crypto;
/** Username to use (if any) */
- private $_username;
+ private $username;
/** Password to use (if any) */
- private $_password;
+ private $password;
/** Established connection via TCP socket */
- private $_socket;
+ private $socket;
/** Connect timeout in seconds */
- private $_timeout = 10;
+ private $timeout = 10;
/** SMTP Transport to bind to */
- private $_transport;
+ private $transport;
/**
* Create a new PopBeforeSmtpPlugin for $host and $port.
*
- * @param string $host
+ * @param string $host Hostname or IP. Literal IPv6 addresses should be
+ * wrapped in square brackets.
* @param int $port
* @param string $crypto as "tls" or "ssl"
*/
public function __construct($host, $port = 110, $crypto = null)
{
- $this->_host = $host;
- $this->_port = $port;
- $this->_crypto = $crypto;
- }
-
- /**
- * Create a new PopBeforeSmtpPlugin for $host and $port.
- *
- * @param string $host
- * @param int $port
- * @param string $crypto as "tls" or "ssl"
- *
- * @return self
- */
- public static function newInstance($host, $port = 110, $crypto = null)
- {
- return new self($host, $port, $crypto);
+ $this->host = $host;
+ $this->port = $port;
+ $this->crypto = $crypto;
}
/**
* Set a Pop3Connection to delegate to instead of connecting directly.
*
- * @param Swift_Plugins_Pop_Pop3Connection $connection
- *
* @return $this
*/
public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection)
{
- $this->_connection = $connection;
+ $this->connection = $connection;
return $this;
}
/**
* Bind this plugin to a specific SMTP transport instance.
- *
- * @param Swift_Transport
*/
public function bindSmtp(Swift_Transport $smtp)
{
- $this->_transport = $smtp;
+ $this->transport = $smtp;
}
/**
@@ -103,7 +86,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
*/
public function setTimeout($timeout)
{
- $this->_timeout = (int) $timeout;
+ $this->timeout = (int) $timeout;
return $this;
}
@@ -117,7 +100,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
*/
public function setUsername($username)
{
- $this->_username = $username;
+ $this->username = $username;
return $this;
}
@@ -131,7 +114,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
*/
public function setPassword($password)
{
- $this->_password = $password;
+ $this->password = $password;
return $this;
}
@@ -143,29 +126,29 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
*/
public function connect()
{
- if (isset($this->_connection)) {
- $this->_connection->connect();
+ if (isset($this->connection)) {
+ $this->connection->connect();
} else {
- if (!isset($this->_socket)) {
+ if (!isset($this->socket)) {
if (!$socket = fsockopen(
- $this->_getHostString(), $this->_port, $errno, $errstr, $this->_timeout)) {
+ $this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) {
throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('Failed to connect to POP3 host [%s]: %s', $this->_host, $errstr)
+ sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr)
);
}
- $this->_socket = $socket;
+ $this->socket = $socket;
- if (false === $greeting = fgets($this->_socket)) {
+ if (false === $greeting = fgets($this->socket)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('Failed to connect to POP3 host [%s]', trim($greeting))
);
}
- $this->_assertOk($greeting);
+ $this->assertOk($greeting);
- if ($this->_username) {
- $this->_command(sprintf("USER %s\r\n", $this->_username));
- $this->_command(sprintf("PASS %s\r\n", $this->_password));
+ if ($this->username) {
+ $this->command(sprintf("USER %s\r\n", $this->username));
+ $this->command(sprintf("PASS %s\r\n", $this->password));
}
}
}
@@ -176,28 +159,26 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
*/
public function disconnect()
{
- if (isset($this->_connection)) {
- $this->_connection->disconnect();
+ if (isset($this->connection)) {
+ $this->connection->disconnect();
} else {
- $this->_command("QUIT\r\n");
- if (!fclose($this->_socket)) {
+ $this->command("QUIT\r\n");
+ if (!fclose($this->socket)) {
throw new Swift_Plugins_Pop_Pop3Exception(
- sprintf('POP3 host [%s] connection could not be stopped', $this->_host)
+ sprintf('POP3 host [%s] connection could not be stopped', $this->host)
);
}
- $this->_socket = null;
+ $this->socket = null;
}
}
/**
* Invoked just before a Transport is started.
- *
- * @param Swift_Events_TransportChangeEvent $evt
*/
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
{
- if (isset($this->_transport)) {
- if ($this->_transport !== $evt->getTransport()) {
+ if (isset($this->transport)) {
+ if ($this->transport !== $evt->getTransport()) {
return;
}
}
@@ -227,38 +208,38 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
{
}
- private function _command($command)
+ private function command($command)
{
- if (!fwrite($this->_socket, $command)) {
+ if (!fwrite($this->socket, $command)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('Failed to write command [%s] to POP3 host', trim($command))
);
}
- if (false === $response = fgets($this->_socket)) {
+ if (false === $response = fgets($this->socket)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('Failed to read from POP3 host after command [%s]', trim($command))
);
}
- $this->_assertOk($response);
+ $this->assertOk($response);
return $response;
}
- private function _assertOk($response)
+ private function assertOk($response)
{
- if (substr($response, 0, 3) != '+OK') {
+ if ('+OK' != substr($response, 0, 3)) {
throw new Swift_Plugins_Pop_Pop3Exception(
sprintf('POP3 command failed [%s]', trim($response))
);
}
}
- private function _getHostString()
+ private function getHostString()
{
- $host = $this->_host;
- switch (strtolower($this->_crypto)) {
+ $host = $this->host;
+ switch (strtolower($this->crypto)) {
case 'ssl':
$host = 'ssl://'.$host;
break;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
index c3a1f86854..b0cb519e02 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/RedirectingPlugin.php
@@ -11,7 +11,7 @@
/**
* Redirects all email to a single recipient.
*
- * @author Fabien Potencier
+ * @author Fabien Potencier
*/
class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
{
@@ -20,25 +20,24 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
*
* @var mixed
*/
- private $_recipient;
+ private $recipient;
/**
* List of regular expression for recipient whitelisting.
*
* @var array
*/
- private $_whitelist = array();
+ private $whitelist = [];
/**
* Create a new RedirectingPlugin.
*
* @param mixed $recipient
- * @param array $whitelist
*/
- public function __construct($recipient, array $whitelist = array())
+ public function __construct($recipient, array $whitelist = [])
{
- $this->_recipient = $recipient;
- $this->_whitelist = $whitelist;
+ $this->recipient = $recipient;
+ $this->whitelist = $whitelist;
}
/**
@@ -48,7 +47,7 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
*/
public function setRecipient($recipient)
{
- $this->_recipient = $recipient;
+ $this->recipient = $recipient;
}
/**
@@ -58,17 +57,15 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
*/
public function getRecipient()
{
- return $this->_recipient;
+ return $this->recipient;
}
/**
* Set a list of regular expressions to whitelist certain recipients.
- *
- * @param array $whitelist
*/
public function setWhitelist(array $whitelist)
{
- $this->_whitelist = $whitelist;
+ $this->whitelist = $whitelist;
}
/**
@@ -78,13 +75,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
*/
public function getWhitelist()
{
- return $this->_whitelist;
+ return $this->whitelist;
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
@@ -106,17 +101,17 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
}
// Filter remaining headers against whitelist
- $this->_filterHeaderSet($headers, 'To');
- $this->_filterHeaderSet($headers, 'Cc');
- $this->_filterHeaderSet($headers, 'Bcc');
+ $this->filterHeaderSet($headers, 'To');
+ $this->filterHeaderSet($headers, 'Cc');
+ $this->filterHeaderSet($headers, 'Bcc');
// Add each hard coded recipient
$to = $message->getTo();
if (null === $to) {
- $to = array();
+ $to = [];
}
- foreach ((array) $this->_recipient as $recipient) {
+ foreach ((array) $this->recipient as $recipient) {
if (!array_key_exists($recipient, $to)) {
$message->addTo($recipient);
}
@@ -126,29 +121,26 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Filter header set against a whitelist of regular expressions.
*
- * @param Swift_Mime_HeaderSet $headerSet
- * @param string $type
+ * @param string $type
*/
- private function _filterHeaderSet(Swift_Mime_HeaderSet $headerSet, $type)
+ private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
{
foreach ($headerSet->getAll($type) as $headers) {
- $headers->setNameAddresses($this->_filterNameAddresses($headers->getNameAddresses()));
+ $headers->setNameAddresses($this->filterNameAddresses($headers->getNameAddresses()));
}
}
/**
* Filtered list of addresses => name pairs.
*
- * @param array $recipients
- *
* @return array
*/
- private function _filterNameAddresses(array $recipients)
+ private function filterNameAddresses(array $recipients)
{
- $filtered = array();
+ $filtered = [];
foreach ($recipients as $address => $name) {
- if ($this->_isWhitelisted($address)) {
+ if ($this->isWhitelisted($address)) {
$filtered[$address] = $name;
}
}
@@ -159,17 +151,15 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Matches address against whitelist of regular expressions.
*
- * @param $recipient
- *
* @return bool
*/
- protected function _isWhitelisted($recipient)
+ protected function isWhitelisted($recipient)
{
- if (in_array($recipient, (array) $this->_recipient)) {
+ if (in_array($recipient, (array) $this->recipient)) {
return true;
}
- foreach ($this->_whitelist as $pattern) {
+ foreach ($this->whitelist as $pattern) {
if (preg_match($pattern, $recipient)) {
return true;
}
@@ -180,15 +170,13 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
- $this->_restoreMessage($evt->getMessage());
+ $this->restoreMessage($evt->getMessage());
}
- private function _restoreMessage(Swift_Mime_Message $message)
+ private function restoreMessage(Swift_Mime_SimpleMessage $message)
{
// restore original headers
$headers = $message->getHeaders();
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
index 0f21b7d605..3a2b6657c0 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporter.php
@@ -24,9 +24,9 @@ interface Swift_Plugins_Reporter
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_Message $message
- * @param string $address
- * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
+ * @param Swift_Mime_SimpleMessage $message
+ * @param string $address
+ * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
*/
- public function notify(Swift_Mime_Message $message, $address, $result);
+ public function notify(Swift_Mime_SimpleMessage $message, $address, $result);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
index a37901ff0d..ae070eb64e 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ReporterPlugin.php
@@ -20,16 +20,14 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
*
* @var Swift_Plugins_Reporter
*/
- private $_reporter;
+ private $reporter;
/**
* Create a new ReporterPlugin using $reporter.
- *
- * @param Swift_Plugins_Reporter $reporter
*/
public function __construct(Swift_Plugins_Reporter $reporter)
{
- $this->_reporter = $reporter;
+ $this->reporter = $reporter;
}
/**
@@ -41,21 +39,19 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
/**
* Invoked immediately after the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
$message = $evt->getMessage();
$failures = array_flip($evt->getFailedRecipients());
foreach ((array) $message->getTo() as $address => $null) {
- $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
+ $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
foreach ((array) $message->getCc() as $address => $null) {
- $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
+ $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
foreach ((array) $message->getBcc() as $address => $null) {
- $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS);
+ $this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
index cad9d168ef..249cffbde7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HitReporter.php
@@ -20,22 +20,21 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
*
* @var array
*/
- private $_failures = array();
+ private $failures = [];
- private $_failures_cache = array();
+ private $failures_cache = [];
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_Message $message
- * @param string $address
- * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
+ * @param string $address
+ * @param int $result from {@link RESULT_PASS, RESULT_FAIL}
*/
- public function notify(Swift_Mime_Message $message, $address, $result)
+ public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
{
- if (self::RESULT_FAIL == $result && !isset($this->_failures_cache[$address])) {
- $this->_failures[] = $address;
- $this->_failures_cache[$address] = true;
+ if (self::RESULT_FAIL == $result && !isset($this->failures_cache[$address])) {
+ $this->failures[] = $address;
+ $this->failures_cache[$address] = true;
}
}
@@ -46,7 +45,7 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
*/
public function getFailedRecipients()
{
- return $this->_failures;
+ return $this->failures;
}
/**
@@ -54,6 +53,6 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
*/
public function clear()
{
- $this->_failures = $this->_failures_cache = array();
+ $this->failures = $this->failures_cache = [];
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
index c62593557e..1cfc3f974f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/Reporters/HtmlReporter.php
@@ -18,11 +18,10 @@ class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
/**
* Notifies this ReportNotifier that $address failed or succeeded.
*
- * @param Swift_Mime_Message $message
- * @param string $address
- * @param int $result from {@see RESULT_PASS, RESULT_FAIL}
+ * @param string $address
+ * @param int $result from {@see RESULT_PASS, RESULT_FAIL}
*/
- public function notify(Swift_Mime_Message $message, $address, $result)
+ public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
{
if (self::RESULT_PASS == $result) {
echo '<div style="color: #fff; background: #006600; padding: 2px; margin: 2px;">'.PHP_EOL;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
index 2f4b9a75eb..83d3044927 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Plugins/ThrottlerPlugin.php
@@ -29,28 +29,28 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*
* @var Swift_Plugins_Sleeper
*/
- private $_sleeper;
+ private $sleeper;
/**
* The Timer instance which provides the timestamp.
*
* @var Swift_Plugins_Timer
*/
- private $_timer;
+ private $timer;
/**
* The time at which the first email was sent.
*
* @var int
*/
- private $_start;
+ private $start;
/**
* The rate at which messages should be sent.
*
* @var int
*/
- private $_rate;
+ private $rate;
/**
* The mode for throttling.
@@ -59,53 +59,51 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*
* @var int
*/
- private $_mode;
+ private $mode;
/**
* An internal counter of the number of messages sent.
*
* @var int
*/
- private $_messages = 0;
+ private $messages = 0;
/**
* Create a new ThrottlerPlugin.
*
* @param int $rate
- * @param int $mode, defaults to {@link BYTES_PER_MINUTE}
+ * @param int $mode defaults to {@link BYTES_PER_MINUTE}
* @param Swift_Plugins_Sleeper $sleeper (only needed in testing)
* @param Swift_Plugins_Timer $timer (only needed in testing)
*/
public function __construct($rate, $mode = self::BYTES_PER_MINUTE, Swift_Plugins_Sleeper $sleeper = null, Swift_Plugins_Timer $timer = null)
{
- $this->_rate = $rate;
- $this->_mode = $mode;
- $this->_sleeper = $sleeper;
- $this->_timer = $timer;
+ $this->rate = $rate;
+ $this->mode = $mode;
+ $this->sleeper = $sleeper;
+ $this->timer = $timer;
}
/**
* Invoked immediately before the Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
{
$time = $this->getTimestamp();
- if (!isset($this->_start)) {
- $this->_start = $time;
+ if (!isset($this->start)) {
+ $this->start = $time;
}
- $duration = $time - $this->_start;
+ $duration = $time - $this->start;
- switch ($this->_mode) {
+ switch ($this->mode) {
case self::BYTES_PER_MINUTE:
- $sleep = $this->_throttleBytesPerMinute($duration);
+ $sleep = $this->throttleBytesPerMinute($duration);
break;
case self::MESSAGES_PER_SECOND:
- $sleep = $this->_throttleMessagesPerSecond($duration);
+ $sleep = $this->throttleMessagesPerSecond($duration);
break;
case self::MESSAGES_PER_MINUTE:
- $sleep = $this->_throttleMessagesPerMinute($duration);
+ $sleep = $this->throttleMessagesPerMinute($duration);
break;
default:
$sleep = 0;
@@ -119,13 +117,11 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
/**
* Invoked when a Message is sent.
- *
- * @param Swift_Events_SendEvent $evt
*/
public function sendPerformed(Swift_Events_SendEvent $evt)
{
parent::sendPerformed($evt);
- ++$this->_messages;
+ ++$this->messages;
}
/**
@@ -135,8 +131,8 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*/
public function sleep($seconds)
{
- if (isset($this->_sleeper)) {
- $this->_sleeper->sleep($seconds);
+ if (isset($this->sleeper)) {
+ $this->sleeper->sleep($seconds);
} else {
sleep($seconds);
}
@@ -149,8 +145,8 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*/
public function getTimestamp()
{
- if (isset($this->_timer)) {
- return $this->_timer->getTimestamp();
+ if (isset($this->timer)) {
+ return $this->timer->getTimestamp();
}
return time();
@@ -163,9 +159,9 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*
* @return int
*/
- private function _throttleBytesPerMinute($timePassed)
+ private function throttleBytesPerMinute($timePassed)
{
- $expectedDuration = $this->getBytesOut() / ($this->_rate / 60);
+ $expectedDuration = $this->getBytesOut() / ($this->rate / 60);
return (int) ceil($expectedDuration - $timePassed);
}
@@ -177,9 +173,9 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*
* @return int
*/
- private function _throttleMessagesPerSecond($timePassed)
+ private function throttleMessagesPerSecond($timePassed)
{
- $expectedDuration = $this->_messages / ($this->_rate);
+ $expectedDuration = $this->messages / $this->rate;
return (int) ceil($expectedDuration - $timePassed);
}
@@ -191,9 +187,9 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
*
* @return int
*/
- private function _throttleMessagesPerMinute($timePassed)
+ private function throttleMessagesPerMinute($timePassed)
{
- $expectedDuration = $this->_messages / ($this->_rate / 60);
+ $expectedDuration = $this->messages / ($this->rate / 60);
return (int) ceil($expectedDuration - $timePassed);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php
index 83cbddcd22..16103e1103 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Preferences.php
@@ -16,7 +16,7 @@
class Swift_Preferences
{
/** Singleton instance */
- private static $_instance = null;
+ private static $instance = null;
/** Constructor not to be used */
private function __construct()
@@ -30,11 +30,11 @@ class Swift_Preferences
*/
public static function getInstance()
{
- if (!isset(self::$_instance)) {
- self::$_instance = new self();
+ if (!isset(self::$instance)) {
+ self::$instance = new self();
}
- return self::$_instance;
+ return self::$instance;
}
/**
@@ -92,7 +92,7 @@ class Swift_Preferences
Swift_DependencyContainer::getInstance()
->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
- ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
+ ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])
->addConstructorValue($dotEscape);
return $this;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php
index 47ae7a5917..2aa7e32614 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SendmailTransport.php
@@ -23,23 +23,11 @@ class Swift_SendmailTransport extends Swift_Transport_SendmailTransport
public function __construct($command = '/usr/sbin/sendmail -bs')
{
call_user_func_array(
- array($this, 'Swift_Transport_SendmailTransport::__construct'),
+ [$this, 'Swift_Transport_SendmailTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.sendmail')
);
$this->setCommand($command);
}
-
- /**
- * Create a new SendmailTransport instance.
- *
- * @param string $command
- *
- * @return self
- */
- public static function newInstance($command = '/usr/sbin/sendmail -bs')
- {
- return new self($command);
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SignedMessage.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SignedMessage.php
deleted file mode 100644
index 2e7a8726d2..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SignedMessage.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Signed Message, message that can be signed using a signer.
- *
- * This class is only kept for compatibility
- *
- *
- * @author Xavier De Cock <xdecock@gmail.com>
- *
- * @deprecated
- */
-class Swift_SignedMessage extends Swift_Message
-{
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php
index 2d8176d905..26c5e285c0 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signer.php
@@ -11,7 +11,6 @@
/**
* Base Class of Signer Infrastructure.
*
- *
* @author Xavier De Cock <xdecock@gmail.com>
*/
interface Swift_Signer
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
index 454e84b476..279f44c855 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DKIMSigner.php
@@ -11,7 +11,7 @@
/**
* DKIM Signer used to apply DKIM Signature to a message.
*
- * @author Xavier De Cock <xdecock@gmail.com>
+ * @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
{
@@ -20,21 +20,23 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var string
*/
- protected $_privateKey;
+ protected $privateKey;
/**
* DomainName.
*
* @var string
*/
- protected $_domainName;
+ protected $domainName;
/**
* Selector.
*
* @var string
*/
- protected $_selector;
+ protected $selector;
+
+ private $passphrase = '';
/**
* Hash algorithm used.
@@ -43,63 +45,63 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var string
*/
- protected $_hashAlgorithm = 'rsa-sha256';
+ protected $hashAlgorithm = 'rsa-sha256';
/**
* Body canon method.
*
* @var string
*/
- protected $_bodyCanon = 'simple';
+ protected $bodyCanon = 'simple';
/**
* Header canon method.
*
* @var string
*/
- protected $_headerCanon = 'simple';
+ protected $headerCanon = 'simple';
/**
* Headers not being signed.
*
* @var array
*/
- protected $_ignoredHeaders = array('return-path' => true);
+ protected $ignoredHeaders = ['return-path' => true];
/**
* Signer identity.
*
* @var string
*/
- protected $_signerIdentity;
+ protected $signerIdentity;
/**
* BodyLength.
*
* @var int
*/
- protected $_bodyLen = 0;
+ protected $bodyLen = 0;
/**
* Maximum signedLen.
*
* @var int
*/
- protected $_maxLen = PHP_INT_MAX;
+ protected $maxLen = PHP_INT_MAX;
/**
* Embbed bodyLen in signature.
*
* @var bool
*/
- protected $_showLen = false;
+ protected $showLen = false;
/**
* When the signature has been applied (true means time()), false means not embedded.
*
* @var mixed
*/
- protected $_signatureTimestamp = true;
+ protected $signatureTimestamp = true;
/**
* When will the signature expires false means not embedded, if sigTimestamp is auto
@@ -107,14 +109,14 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var int
*/
- protected $_signatureExpiration = false;
+ protected $signatureExpiration = false;
/**
* Must we embed signed headers?
*
* @var bool
*/
- protected $_debugHeaders = false;
+ protected $debugHeaders = false;
// work variables
/**
@@ -122,46 +124,46 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- protected $_signedHeaders = array();
+ protected $signedHeaders = [];
/**
* If debugHeaders is set store debugData here.
*
* @var string
*/
- private $_debugHeadersData = '';
+ private $debugHeadersData = '';
/**
* Stores the bodyHash.
*
* @var string
*/
- private $_bodyHash = '';
+ private $bodyHash = '';
/**
* Stores the signature header.
*
* @var Swift_Mime_Headers_ParameterizedHeader
*/
- protected $_dkimHeader;
+ protected $dkimHeader;
- private $_bodyHashHandler;
+ private $bodyHashHandler;
- private $_headerHash;
+ private $headerHash;
- private $_headerCanonData = '';
+ private $headerCanonData = '';
- private $_bodyCanonEmptyCounter = 0;
+ private $bodyCanonEmptyCounter = 0;
- private $_bodyCanonIgnoreStart = 2;
+ private $bodyCanonIgnoreStart = 2;
- private $_bodyCanonSpace = false;
+ private $bodyCanonSpace = false;
- private $_bodyCanonLastChar = null;
+ private $bodyCanonLastChar = null;
- private $_bodyCanonLine = '';
+ private $bodyCanonLine = '';
- private $_bound = array();
+ private $bound = [];
/**
* Constructor.
@@ -169,32 +171,15 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
* @param string $privateKey
* @param string $domainName
* @param string $selector
+ * @param string $passphrase
*/
- public function __construct($privateKey, $domainName, $selector)
+ public function __construct($privateKey, $domainName, $selector, $passphrase = '')
{
- $this->_privateKey = $privateKey;
- $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';
- }
- }
-
- /**
- * Instanciate DKIMSigner.
- *
- * @param string $privateKey
- * @param string $domainName
- * @param string $selector
- *
- * @return self
- */
- public static function newInstance($privateKey, $domainName, $selector)
- {
- return new static($privateKey, $domainName, $selector);
+ $this->privateKey = $privateKey;
+ $this->domainName = $domainName;
+ $this->signerIdentity = '@'.$domainName;
+ $this->selector = $selector;
+ $this->passphrase = $passphrase;
}
/**
@@ -204,14 +189,14 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function reset()
{
- $this->_headerHash = null;
- $this->_signedHeaders = array();
- $this->_bodyHash = null;
- $this->_bodyHashHandler = null;
- $this->_bodyCanonIgnoreStart = 2;
- $this->_bodyCanonEmptyCounter = 0;
- $this->_bodyCanonLastChar = null;
- $this->_bodyCanonSpace = false;
+ $this->headerHash = null;
+ $this->signedHeaders = [];
+ $this->bodyHash = null;
+ $this->bodyHashHandler = null;
+ $this->bodyCanonIgnoreStart = 2;
+ $this->bodyCanonEmptyCounter = 0;
+ $this->bodyCanonLastChar = null;
+ $this->bodyCanonSpace = false;
}
/**
@@ -226,15 +211,15 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @param string $bytes
*
- * @throws Swift_IoException
- *
* @return int
+ *
+ * @throws Swift_IoException
*/
// TODO fix return
public function write($bytes)
{
- $this->_canonicalizeBody($bytes);
- foreach ($this->_bound as $is) {
+ $this->canonicalizeBody($bytes);
+ foreach ($this->bound as $is) {
$is->write($bytes);
}
}
@@ -251,33 +236,31 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Attach $is to this stream.
+ *
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
- *
- * @param Swift_InputByteStream $is
*/
public function bind(Swift_InputByteStream $is)
{
// Don't have to mirror anything
- $this->_bound[] = $is;
+ $this->bound[] = $is;
return;
}
/**
* Remove an already bound stream.
+ *
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
- *
- * @param Swift_InputByteStream $is
*/
public function unbind(Swift_InputByteStream $is)
{
// Don't have to mirror anything
- foreach ($this->_bound as $k => $stream) {
+ foreach ($this->bound as $k => $stream) {
if ($stream === $is) {
- unset($this->_bound[$k]);
+ unset($this->bound[$k]);
return;
}
@@ -308,10 +291,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
{
switch ($hash) {
case 'rsa-sha1':
- $this->_hashAlgorithm = 'rsa-sha1';
+ $this->hashAlgorithm = 'rsa-sha1';
break;
case 'rsa-sha256':
- $this->_hashAlgorithm = '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.');
}
@@ -332,10 +315,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setBodyCanon($canon)
{
- if ($canon == 'relaxed') {
- $this->_bodyCanon = 'relaxed';
+ if ('relaxed' == $canon) {
+ $this->bodyCanon = 'relaxed';
} else {
- $this->_bodyCanon = 'simple';
+ $this->bodyCanon = 'simple';
}
return $this;
@@ -350,10 +333,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setHeaderCanon($canon)
{
- if ($canon == 'relaxed') {
- $this->_headerCanon = 'relaxed';
+ if ('relaxed' == $canon) {
+ $this->headerCanon = 'relaxed';
} else {
- $this->_headerCanon = 'simple';
+ $this->headerCanon = 'simple';
}
return $this;
@@ -368,7 +351,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setSignerIdentity($identity)
{
- $this->_signerIdentity = $identity;
+ $this->signerIdentity = $identity;
return $this;
}
@@ -382,15 +365,15 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setBodySignedLen($len)
{
- if ($len === true) {
- $this->_showLen = true;
- $this->_maxLen = PHP_INT_MAX;
- } elseif ($len === false) {
- $this->_showLen = false;
- $this->_maxLen = PHP_INT_MAX;
+ if (true === $len) {
+ $this->showLen = true;
+ $this->maxLen = PHP_INT_MAX;
+ } elseif (false === $len) {
+ $this->showLen = false;
+ $this->maxLen = PHP_INT_MAX;
} else {
- $this->_showLen = true;
- $this->_maxLen = (int) $len;
+ $this->showLen = true;
+ $this->maxLen = (int) $len;
}
return $this;
@@ -405,7 +388,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setSignatureTimestamp($time)
{
- $this->_signatureTimestamp = $time;
+ $this->signatureTimestamp = $time;
return $this;
}
@@ -419,7 +402,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setSignatureExpiration($time)
{
- $this->_signatureExpiration = $time;
+ $this->signatureExpiration = $time;
return $this;
}
@@ -433,7 +416,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function setDebugHeaders($debug)
{
- $this->_debugHeaders = (bool) $debug;
+ $this->debugHeaders = (bool) $debug;
return $this;
}
@@ -444,15 +427,15 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
public function startBody()
{
// Init
- switch ($this->_hashAlgorithm) {
+ switch ($this->hashAlgorithm) {
case 'rsa-sha256':
- $this->_bodyHashHandler = hash_init('sha256');
+ $this->bodyHashHandler = hash_init('sha256');
break;
case 'rsa-sha1':
- $this->_bodyHashHandler = hash_init('sha1');
+ $this->bodyHashHandler = hash_init('sha1');
break;
}
- $this->_bodyCanonLine = '';
+ $this->bodyCanonLine = '';
}
/**
@@ -460,7 +443,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function endBody()
{
- $this->_endOfBody();
+ $this->endOfBody();
}
/**
@@ -470,10 +453,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function getAlteredHeaders()
{
- if ($this->_debugHeaders) {
- return array('DKIM-Signature', 'X-DebugHash');
+ if ($this->debugHeaders) {
+ return ['DKIM-Signature', 'X-DebugHash'];
} else {
- return array('DKIM-Signature');
+ return ['DKIM-Signature'];
}
}
@@ -486,7 +469,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*/
public function ignoreHeader($header_name)
{
- $this->_ignoredHeaders[strtolower($header_name)] = true;
+ $this->ignoredHeaders[strtolower($header_name)] = true;
return $this;
}
@@ -494,24 +477,22 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Set the headers to sign.
*
- * @param Swift_Mime_HeaderSet $headers
- *
* @return Swift_Signers_DKIMSigner
*/
- public function setHeaders(Swift_Mime_HeaderSet $headers)
+ public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
- $this->_headerCanonData = '';
+ $this->headerCanonData = '';
// Loop through Headers
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->_ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName)])) {
if ($headers->has($hName)) {
$tmp = $headers->getAll($hName);
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
- $this->_addHeader($header->toString());
- $this->_signedHeaders[] = $header->getFieldName();
+ if ('' != $header->getFieldBody()) {
+ $this->addHeader($header->toString());
+ $this->signedHeaders[] = $header->getFieldName();
}
}
}
@@ -524,37 +505,35 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
/**
* Add the signature to the given Headers.
*
- * @param Swift_Mime_HeaderSet $headers
- *
* @return Swift_Signers_DKIMSigner
*/
- public function addSignature(Swift_Mime_HeaderSet $headers)
+ public function addSignature(Swift_Mime_SimpleHeaderSet $headers)
{
// Prepare the DKIM-Signature
- $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector);
- if ($this->_bodyCanon != 'simple') {
- $params['c'] = $this->_headerCanon.'/'.$this->_bodyCanon;
- } elseif ($this->_headerCanon != 'simple') {
- $params['c'] = $this->_headerCanon;
+ $params = ['v' => '1', 'a' => $this->hashAlgorithm, 'bh' => base64_encode($this->bodyHash), 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'i' => $this->signerIdentity, 's' => $this->selector];
+ if ('simple' != $this->bodyCanon) {
+ $params['c'] = $this->headerCanon.'/'.$this->bodyCanon;
+ } elseif ('simple' != $this->headerCanon) {
+ $params['c'] = $this->headerCanon;
}
- if ($this->_showLen) {
- $params['l'] = $this->_bodyLen;
+ if ($this->showLen) {
+ $params['l'] = $this->bodyLen;
}
- if ($this->_signatureTimestamp === true) {
+ if (true === $this->signatureTimestamp) {
$params['t'] = time();
- if ($this->_signatureExpiration !== false) {
- $params['x'] = $params['t'] + $this->_signatureExpiration;
+ if (false !== $this->signatureExpiration) {
+ $params['x'] = $params['t'] + $this->signatureExpiration;
}
} else {
- if ($this->_signatureTimestamp !== false) {
- $params['t'] = $this->_signatureTimestamp;
+ if (false !== $this->signatureTimestamp) {
+ $params['t'] = $this->signatureTimestamp;
}
- if ($this->_signatureExpiration !== false) {
- $params['x'] = $this->_signatureExpiration;
+ if (false !== $this->signatureExpiration) {
+ $params['x'] = $this->signatureExpiration;
}
}
- if ($this->_debugHeaders) {
- $params['z'] = implode('|', $this->_debugHeadersData);
+ if ($this->debugHeaders) {
+ $params['z'] = implode('|', $this->debugHeadersData);
}
$string = '';
foreach ($params as $k => $v) {
@@ -564,22 +543,21 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$headers->addTextHeader('DKIM-Signature', $string);
// Add the last DKIM-Signature
$tmp = $headers->getAll('DKIM-Signature');
- $this->_dkimHeader = end($tmp);
- $this->_addHeader(trim($this->_dkimHeader->toString())."\r\n b=", true);
- $this->_endOfHeaders();
- if ($this->_debugHeaders) {
- $headers->addTextHeader('X-DebugHash', base64_encode($this->_headerHash));
+ $this->dkimHeader = end($tmp);
+ $this->addHeader(trim($this->dkimHeader->toString())."\r\n b=", true);
+ if ($this->debugHeaders) {
+ $headers->addTextHeader('X-DebugHash', base64_encode($this->headerHash));
}
- $this->_dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' ')));
+ $this->dkimHeader->setValue($string.' b='.trim(chunk_split(base64_encode($this->getEncryptedHash()), 73, ' ')));
return $this;
}
/* Private helpers */
- protected function _addHeader($header, $is_sig = false)
+ protected function addHeader($header, $is_sig = false)
{
- switch ($this->_headerCanon) {
+ switch ($this->headerCanon) {
case 'relaxed':
// Prepare Header and cascade
$exploded = explode(':', $header, 2);
@@ -587,44 +565,36 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$value = str_replace("\r\n", '', $exploded[1]);
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
$header = $name.':'.trim($value).($is_sig ? '' : "\r\n");
+ // no break
case 'simple':
// Nothing to do
}
- $this->_addToHeaderHash($header);
+ $this->addToHeaderHash($header);
}
- /**
- * @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 overridden by custom client code.
- */
- protected function _endOfHeaders()
- {
- }
-
- protected function _canonicalizeBody($string)
+ protected function canonicalizeBody($string)
{
$len = strlen($string);
$canon = '';
- $method = ($this->_bodyCanon == 'relaxed');
+ $method = ('relaxed' == $this->bodyCanon);
for ($i = 0; $i < $len; ++$i) {
- if ($this->_bodyCanonIgnoreStart > 0) {
- --$this->_bodyCanonIgnoreStart;
+ if ($this->bodyCanonIgnoreStart > 0) {
+ --$this->bodyCanonIgnoreStart;
continue;
}
switch ($string[$i]) {
case "\r":
- $this->_bodyCanonLastChar = "\r";
+ $this->bodyCanonLastChar = "\r";
break;
case "\n":
- if ($this->_bodyCanonLastChar == "\r") {
+ if ("\r" == $this->bodyCanonLastChar) {
if ($method) {
- $this->_bodyCanonSpace = false;
+ $this->bodyCanonSpace = false;
}
- if ($this->_bodyCanonLine == '') {
- ++$this->_bodyCanonEmptyCounter;
+ if ('' == $this->bodyCanonLine) {
+ ++$this->bodyCanonEmptyCounter;
} else {
- $this->_bodyCanonLine = '';
+ $this->bodyCanonLine = '';
$canon .= "\r\n";
}
} else {
@@ -635,52 +605,53 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
case ' ':
case "\t":
if ($method) {
- $this->_bodyCanonSpace = true;
+ $this->bodyCanonSpace = true;
break;
}
+ // no break
default:
- if ($this->_bodyCanonEmptyCounter > 0) {
- $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
- $this->_bodyCanonEmptyCounter = 0;
+ if ($this->bodyCanonEmptyCounter > 0) {
+ $canon .= str_repeat("\r\n", $this->bodyCanonEmptyCounter);
+ $this->bodyCanonEmptyCounter = 0;
}
- if ($this->_bodyCanonSpace) {
- $this->_bodyCanonLine .= ' ';
+ if ($this->bodyCanonSpace) {
+ $this->bodyCanonLine .= ' ';
$canon .= ' ';
- $this->_bodyCanonSpace = false;
+ $this->bodyCanonSpace = false;
}
- $this->_bodyCanonLine .= $string[$i];
+ $this->bodyCanonLine .= $string[$i];
$canon .= $string[$i];
}
}
- $this->_addToBodyHash($canon);
+ $this->addToBodyHash($canon);
}
- protected function _endOfBody()
+ protected function endOfBody()
{
// Add trailing Line return if last line is non empty
- if (strlen($this->_bodyCanonLine) > 0) {
- $this->_addToBodyHash("\r\n");
+ if (strlen($this->bodyCanonLine) > 0) {
+ $this->addToBodyHash("\r\n");
}
- $this->_bodyHash = hash_final($this->_bodyHashHandler, true);
+ $this->bodyHash = hash_final($this->bodyHashHandler, true);
}
- private function _addToBodyHash($string)
+ private function addToBodyHash($string)
{
$len = strlen($string);
- if ($len > ($new_len = ($this->_maxLen - $this->_bodyLen))) {
+ if ($len > ($new_len = ($this->maxLen - $this->bodyLen))) {
$string = substr($string, 0, $new_len);
$len = $new_len;
}
- hash_update($this->_bodyHashHandler, $string);
- $this->_bodyLen += $len;
+ hash_update($this->bodyHashHandler, $string);
+ $this->bodyLen += $len;
}
- private function _addToHeaderHash($header)
+ private function addToHeaderHash($header)
{
- if ($this->_debugHeaders) {
- $this->_debugHeadersData[] = trim($header);
+ if ($this->debugHeaders) {
+ $this->debugHeadersData[] = trim($header);
}
- $this->_headerCanonData .= $header;
+ $this->headerCanonData .= $header;
}
/**
@@ -688,11 +659,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
*
* @return string
*/
- private function _getEncryptedHash()
+ private function getEncryptedHash()
{
$signature = '';
-
- switch ($this->_hashAlgorithm) {
+ switch ($this->hashAlgorithm) {
case 'rsa-sha1':
$algorithm = OPENSSL_ALGO_SHA1;
break;
@@ -700,11 +670,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
$algorithm = OPENSSL_ALGO_SHA256;
break;
}
- $pkeyId = openssl_get_privatekey($this->_privateKey);
+ $pkeyId = openssl_get_privatekey($this->privateKey, $this->passphrase);
if (!$pkeyId) {
throw new Swift_SwiftException('Unable to load DKIM Private Key ['.openssl_error_string().']');
}
- if (openssl_sign($this->_headerCanonData, $signature, $pkeyId, $algorithm)) {
+ if (openssl_sign($this->headerCanonData, $signature, $pkeyId, $algorithm)) {
return $signature;
}
throw new Swift_SwiftException('Unable to sign DKIM Hash ['.openssl_error_string().']');
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
index 0365363c8b..a24d2032d5 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/DomainKeySigner.php
@@ -11,7 +11,7 @@
/**
* DomainKey Signer used to apply DomainKeys Signature to a message.
*
- * @author Xavier De Cock <xdecock@gmail.com>
+ * @author Xavier De Cock <xdecock@gmail.com>
*/
class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
{
@@ -20,56 +20,56 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @var string
*/
- protected $_privateKey;
+ protected $privateKey;
/**
* DomainName.
*
* @var string
*/
- protected $_domainName;
+ protected $domainName;
/**
* Selector.
*
* @var string
*/
- protected $_selector;
+ protected $selector;
/**
* Hash algorithm used.
*
* @var string
*/
- protected $_hashAlgorithm = 'rsa-sha1';
+ protected $hashAlgorithm = 'rsa-sha1';
/**
* Canonisation method.
*
* @var string
*/
- protected $_canon = 'simple';
+ protected $canon = 'simple';
/**
* Headers not being signed.
*
* @var array
*/
- protected $_ignoredHeaders = array();
+ protected $ignoredHeaders = [];
/**
* Signer identity.
*
* @var string
*/
- protected $_signerIdentity;
+ protected $signerIdentity;
/**
* Must we embed signed headers?
*
* @var bool
*/
- protected $_debugHeaders = false;
+ protected $debugHeaders = false;
// work variables
/**
@@ -77,37 +77,35 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @var array
*/
- private $_signedHeaders = array();
+ private $signedHeaders = [];
/**
* Stores the signature header.
*
* @var Swift_Mime_Headers_ParameterizedHeader
*/
- protected $_domainKeyHeader;
+ protected $domainKeyHeader;
/**
* Hash Handler.
*
* @var resource|null
*/
- private $_hashHandler;
+ private $hashHandler;
- private $_hash;
+ private $canonData = '';
- private $_canonData = '';
+ private $bodyCanonEmptyCounter = 0;
- private $_bodyCanonEmptyCounter = 0;
+ private $bodyCanonIgnoreStart = 2;
- private $_bodyCanonIgnoreStart = 2;
+ private $bodyCanonSpace = false;
- private $_bodyCanonSpace = false;
+ private $bodyCanonLastChar = null;
- private $_bodyCanonLastChar = null;
+ private $bodyCanonLine = '';
- private $_bodyCanonLine = '';
-
- private $_bound = array();
+ private $bound = [];
/**
* Constructor.
@@ -118,24 +116,10 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function __construct($privateKey, $domainName, $selector)
{
- $this->_privateKey = $privateKey;
- $this->_domainName = $domainName;
- $this->_signerIdentity = '@'.$domainName;
- $this->_selector = $selector;
- }
-
- /**
- * Instanciate DomainKeySigner.
- *
- * @param string $privateKey
- * @param string $domainName
- * @param string $selector
- *
- * @return self
- */
- public static function newInstance($privateKey, $domainName, $selector)
- {
- return new static($privateKey, $domainName, $selector);
+ $this->privateKey = $privateKey;
+ $this->domainName = $domainName;
+ $this->signerIdentity = '@'.$domainName;
+ $this->selector = $selector;
}
/**
@@ -145,12 +129,11 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function reset()
{
- $this->_hash = null;
- $this->_hashHandler = null;
- $this->_bodyCanonIgnoreStart = 2;
- $this->_bodyCanonEmptyCounter = 0;
- $this->_bodyCanonLastChar = null;
- $this->_bodyCanonSpace = false;
+ $this->hashHandler = null;
+ $this->bodyCanonIgnoreStart = 2;
+ $this->bodyCanonEmptyCounter = 0;
+ $this->bodyCanonLastChar = null;
+ $this->bodyCanonSpace = false;
return $this;
}
@@ -167,14 +150,16 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @param string $bytes
*
+ * @return int
+ *
* @throws Swift_IoException
*
* @return $this
*/
public function write($bytes)
{
- $this->_canonicalizeBody($bytes);
- foreach ($this->_bound as $is) {
+ $this->canonicalizeBody($bytes);
+ foreach ($this->bound as $is) {
$is->write($bytes);
}
@@ -197,37 +182,35 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Attach $is to this stream.
+ *
* The stream acts as an observer, receiving all data that is written.
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
*
- * @param Swift_InputByteStream $is
- *
* @return $this
*/
public function bind(Swift_InputByteStream $is)
{
// Don't have to mirror anything
- $this->_bound[] = $is;
+ $this->bound[] = $is;
return $this;
}
/**
* Remove an already bound stream.
+ *
* If $is is not bound, no errors will be raised.
* If the stream currently has any buffered data it will be written to $is
* before unbinding occurs.
*
- * @param Swift_InputByteStream $is
- *
* @return $this
*/
public function unbind(Swift_InputByteStream $is)
{
// Don't have to mirror anything
- foreach ($this->_bound as $k => $stream) {
+ foreach ($this->bound as $k => $stream) {
if ($stream === $is) {
- unset($this->_bound[$k]);
+ unset($this->bound[$k]);
break;
}
@@ -260,7 +243,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function setHashAlgorithm($hash)
{
- $this->_hashAlgorithm = 'rsa-sha1';
+ $this->hashAlgorithm = 'rsa-sha1';
return $this;
}
@@ -274,10 +257,10 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function setCanon($canon)
{
- if ($canon == 'nofws') {
- $this->_canon = 'nofws';
+ if ('nofws' == $canon) {
+ $this->canon = 'nofws';
} else {
- $this->_canon = 'simple';
+ $this->canon = 'simple';
}
return $this;
@@ -292,7 +275,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function setSignerIdentity($identity)
{
- $this->_signerIdentity = $identity;
+ $this->signerIdentity = $identity;
return $this;
}
@@ -306,7 +289,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function setDebugHeaders($debug)
{
- $this->_debugHeaders = (bool) $debug;
+ $this->debugHeaders = (bool) $debug;
return $this;
}
@@ -323,7 +306,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function endBody()
{
- $this->_endOfBody();
+ $this->endOfBody();
}
/**
@@ -333,11 +316,11 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function getAlteredHeaders()
{
- if ($this->_debugHeaders) {
- return array('DomainKey-Signature', 'X-DebugHash');
+ if ($this->debugHeaders) {
+ return ['DomainKey-Signature', 'X-DebugHash'];
}
- return array('DomainKey-Signature');
+ return ['DomainKey-Signature'];
}
/**
@@ -349,7 +332,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*/
public function ignoreHeader($header_name)
{
- $this->_ignoredHeaders[strtolower($header_name)] = true;
+ $this->ignoredHeaders[strtolower($header_name)] = true;
return $this;
}
@@ -357,31 +340,29 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Set the headers to sign.
*
- * @param Swift_Mime_HeaderSet $headers
- *
* @return $this
*/
- public function setHeaders(Swift_Mime_HeaderSet $headers)
+ public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
- $this->_startHash();
- $this->_canonData = '';
+ $this->startHash();
+ $this->canonData = '';
// Loop through Headers
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->_ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName)])) {
if ($headers->has($hName)) {
$tmp = $headers->getAll($hName);
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
- $this->_addHeader($header->toString());
- $this->_signedHeaders[] = $header->getFieldName();
+ if ('' != $header->getFieldBody()) {
+ $this->addHeader($header->toString());
+ $this->signedHeaders[] = $header->getFieldName();
}
}
}
}
}
- $this->_endOfHeaders();
+ $this->endOfHeaders();
return $this;
}
@@ -389,14 +370,12 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/**
* Add the signature to the given Headers.
*
- * @param Swift_Mime_HeaderSet $headers
- *
* @return $this
*/
- public function addSignature(Swift_Mime_HeaderSet $headers)
+ public function addSignature(Swift_Mime_SimpleHeaderSet $headers)
{
// Prepare the DomainKey-Signature Header
- $params = array('a' => $this->_hashAlgorithm, 'b' => chunk_split(base64_encode($this->_getEncryptedHash()), 73, ' '), 'c' => $this->_canon, 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'q' => 'dns', 's' => $this->_selector);
+ $params = ['a' => $this->hashAlgorithm, 'b' => chunk_split(base64_encode($this->getEncryptedHash()), 73, ' '), 'c' => $this->canon, 'd' => $this->domainName, 'h' => implode(': ', $this->signedHeaders), 'q' => 'dns', 's' => $this->selector];
$string = '';
foreach ($params as $k => $v) {
$string .= $k.'='.$v.'; ';
@@ -409,9 +388,9 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
/* Private helpers */
- protected function _addHeader($header)
+ protected function addHeader($header)
{
- switch ($this->_canon) {
+ switch ($this->canon) {
case 'nofws':
// Prepare Header and cascade
$exploded = explode(':', $header, 2);
@@ -419,40 +398,41 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
$value = str_replace("\r\n", '', $exploded[1]);
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
$header = $name.':'.trim($value)."\r\n";
+ // no break
case 'simple':
// Nothing to do
}
- $this->_addToHash($header);
+ $this->addToHash($header);
}
- protected function _endOfHeaders()
+ protected function endOfHeaders()
{
- $this->_bodyCanonEmptyCounter = 1;
+ $this->bodyCanonEmptyCounter = 1;
}
- protected function _canonicalizeBody($string)
+ protected function canonicalizeBody($string)
{
$len = strlen($string);
$canon = '';
- $nofws = ($this->_canon == 'nofws');
+ $nofws = ('nofws' == $this->canon);
for ($i = 0; $i < $len; ++$i) {
- if ($this->_bodyCanonIgnoreStart > 0) {
- --$this->_bodyCanonIgnoreStart;
+ if ($this->bodyCanonIgnoreStart > 0) {
+ --$this->bodyCanonIgnoreStart;
continue;
}
switch ($string[$i]) {
case "\r":
- $this->_bodyCanonLastChar = "\r";
+ $this->bodyCanonLastChar = "\r";
break;
case "\n":
- if ($this->_bodyCanonLastChar == "\r") {
+ if ("\r" == $this->bodyCanonLastChar) {
if ($nofws) {
- $this->_bodyCanonSpace = false;
+ $this->bodyCanonSpace = false;
}
- if ($this->_bodyCanonLine == '') {
- ++$this->_bodyCanonEmptyCounter;
+ if ('' == $this->bodyCanonLine) {
+ ++$this->bodyCanonEmptyCounter;
} else {
- $this->_bodyCanonLine = '';
+ $this->bodyCanonLine = '';
$canon .= "\r\n";
}
} else {
@@ -464,44 +444,44 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
case "\t":
case "\x09": //HTAB
if ($nofws) {
- $this->_bodyCanonSpace = true;
+ $this->bodyCanonSpace = true;
break;
}
+ // no break
default:
- if ($this->_bodyCanonEmptyCounter > 0) {
- $canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
- $this->_bodyCanonEmptyCounter = 0;
+ if ($this->bodyCanonEmptyCounter > 0) {
+ $canon .= str_repeat("\r\n", $this->bodyCanonEmptyCounter);
+ $this->bodyCanonEmptyCounter = 0;
}
- $this->_bodyCanonLine .= $string[$i];
+ $this->bodyCanonLine .= $string[$i];
$canon .= $string[$i];
}
}
- $this->_addToHash($canon);
+ $this->addToHash($canon);
}
- protected function _endOfBody()
+ protected function endOfBody()
{
- if (strlen($this->_bodyCanonLine) > 0) {
- $this->_addToHash("\r\n");
+ if (strlen($this->bodyCanonLine) > 0) {
+ $this->addToHash("\r\n");
}
- $this->_hash = hash_final($this->_hashHandler, true);
}
- private function _addToHash($string)
+ private function addToHash($string)
{
- $this->_canonData .= $string;
- hash_update($this->_hashHandler, $string);
+ $this->canonData .= $string;
+ hash_update($this->hashHandler, $string);
}
- private function _startHash()
+ private function startHash()
{
// Init
- switch ($this->_hashAlgorithm) {
+ switch ($this->hashAlgorithm) {
case 'rsa-sha1':
- $this->_hashHandler = hash_init('sha1');
+ $this->hashHandler = hash_init('sha1');
break;
}
- $this->_bodyCanonLine = '';
+ $this->bodyCanonLine = '';
}
/**
@@ -509,14 +489,14 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
*
* @return string
*/
- private function _getEncryptedHash()
+ private function getEncryptedHash()
{
$signature = '';
- $pkeyId = openssl_get_privatekey($this->_privateKey);
+ $pkeyId = openssl_get_privatekey($this->privateKey);
if (!$pkeyId) {
throw new Swift_SwiftException('Unable to load DomainKey Private Key ['.openssl_error_string().']');
}
- if (openssl_sign($this->_canonData, $signature, $pkeyId, OPENSSL_ALGO_SHA1)) {
+ if (openssl_sign($this->canonData, $signature, $pkeyId, OPENSSL_ALGO_SHA1)) {
return $signature;
}
throw new Swift_SwiftException('Unable to sign DomainKey Hash ['.openssl_error_string().']');
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
index ef8832fdfc..6104e34f3f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/HeaderSigner.php
@@ -45,16 +45,16 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
*
* @return self
*/
- public function setHeaders(Swift_Mime_HeaderSet $headers);
+ public function setHeaders(Swift_Mime_SimpleHeaderSet $headers);
/**
* Add the header(s) to the headerSet.
*
- * @param Swift_Mime_HeaderSet $headers
+ * @param Swift_Mime_SimpleHeaderSet $headers
*
* @return self
*/
- public function addSignature(Swift_Mime_HeaderSet $headers);
+ public function addSignature(Swift_Mime_SimpleHeaderSet $headers);
/**
* Return the list of header a signer might tamper.
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
index 8fdbaa43b1..7b50c51d45 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/OpenDKIMSigner.php
@@ -12,13 +12,15 @@
* DKIM Signer used to apply DKIM Signature to a message
* Takes advantage of pecl extension.
*
- * @author Xavier De Cock <xdecock@gmail.com>
+ * @author Xavier De Cock <xdecock@gmail.com>
+ *
+ * @deprecated since SwiftMailer 6.1.0; use Swift_Signers_DKIMSigner instead.
*/
class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
{
- private $_peclLoaded = false;
+ private $peclLoaded = false;
- private $_dkimHandler = null;
+ private $dkimHandler = null;
private $dropFirstLF = true;
@@ -33,22 +35,17 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
throw new Swift_SwiftException('php-opendkim extension not found');
}
- $this->_peclLoaded = true;
+ $this->peclLoaded = true;
parent::__construct($privateKey, $domainName, $selector);
}
- public static function newInstance($privateKey, $domainName, $selector)
- {
- return new static($privateKey, $domainName, $selector);
- }
-
- public function addSignature(Swift_Mime_HeaderSet $headers)
+ public function addSignature(Swift_Mime_SimpleHeaderSet $headers)
{
$header = new Swift_Mime_Headers_OpenDKIMHeader('DKIM-Signature');
- $headerVal = $this->_dkimHandler->getSignatureHeader();
- if (!$headerVal) {
- throw new Swift_SwiftException('OpenDKIM Error: '.$this->_dkimHandler->getError());
+ $headerVal = $this->dkimHandler->getSignatureHeader();
+ if (false === $headerVal || is_int($headerVal)) {
+ throw new Swift_SwiftException('OpenDKIM Error: '.$this->dkimHandler->getError());
}
$header->setValue($headerVal);
$headers->set($header);
@@ -56,40 +53,36 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
return $this;
}
- public function setHeaders(Swift_Mime_HeaderSet $headers)
+ public function setHeaders(Swift_Mime_SimpleHeaderSet $headers)
{
- $bodyLen = $this->_bodyLen;
- if (is_bool($bodyLen)) {
- $bodyLen = -1;
- }
- $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
- $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
- $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
- $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen);
+ $hash = 'rsa-sha1' == $this->hashAlgorithm ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256;
+ $bodyCanon = 'simple' == $this->bodyCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
+ $headerCanon = 'simple' == $this->headerCanon ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED;
+ $this->dkimHandler = new OpenDKIMSign($this->privateKey, $this->selector, $this->domainName, $headerCanon, $bodyCanon, $hash, -1);
// Hardcode signature Margin for now
- $this->_dkimHandler->setMargin(78);
+ $this->dkimHandler->setMargin(78);
- if (!is_numeric($this->_signatureTimestamp)) {
+ if (!is_numeric($this->signatureTimestamp)) {
OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, time());
} else {
- if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->_signatureTimestamp)) {
+ if (!OpenDKIM::setOption(OpenDKIM::OPTS_FIXEDTIME, $this->signatureTimestamp)) {
throw new Swift_SwiftException('Unable to force signature timestamp ['.openssl_error_string().']');
}
}
- if (isset($this->_signerIdentity)) {
- $this->_dkimHandler->setSigner($this->_signerIdentity);
+ if (isset($this->signerIdentity)) {
+ $this->dkimHandler->setSigner($this->signerIdentity);
}
$listHeaders = $headers->listAll();
foreach ($listHeaders as $hName) {
// Check if we need to ignore Header
- if (!isset($this->_ignoredHeaders[strtolower($hName)])) {
+ if (!isset($this->ignoredHeaders[strtolower($hName)])) {
$tmp = $headers->getAll($hName);
if ($headers->has($hName)) {
foreach ($tmp as $header) {
- if ($header->getFieldBody() != '') {
+ if ('' != $header->getFieldBody()) {
$htosign = $header->toString();
- $this->_dkimHandler->header($htosign);
- $this->_signedHeaders[] = $header->getFieldName();
+ $this->dkimHandler->header($htosign);
+ $this->signedHeaders[] = $header->getFieldName();
}
}
}
@@ -101,28 +94,28 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
public function startBody()
{
- if (!$this->_peclLoaded) {
+ if (!$this->peclLoaded) {
return parent::startBody();
}
$this->dropFirstLF = true;
- $this->_dkimHandler->eoh();
+ $this->dkimHandler->eoh();
return $this;
}
public function endBody()
{
- if (!$this->_peclLoaded) {
+ if (!$this->peclLoaded) {
return parent::endBody();
}
- $this->_dkimHandler->eom();
+ $this->dkimHandler->eom();
return $this;
}
public function reset()
{
- $this->_dkimHandler = null;
+ $this->dkimHandler = null;
parent::reset();
return $this;
@@ -137,7 +130,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
*/
public function setSignatureTimestamp($time)
{
- $this->_signatureTimestamp = $time;
+ $this->signatureTimestamp = $time;
return $this;
}
@@ -151,7 +144,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
*/
public function setSignatureExpiration($time)
{
- $this->_signatureExpiration = $time;
+ $this->signatureExpiration = $time;
return $this;
}
@@ -165,26 +158,26 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
*/
public function setDebugHeaders($debug)
{
- $this->_debugHeaders = (bool) $debug;
+ $this->debugHeaders = (bool) $debug;
return $this;
}
// Protected
- protected function _canonicalizeBody($string)
+ protected function canonicalizeBody($string)
{
- if (!$this->_peclLoaded) {
- return parent::_canonicalizeBody($string);
+ if (!$this->peclLoaded) {
+ return parent::canonicalizeBody($string);
}
- if (false && $this->dropFirstLF === true) {
- if ($string[0] == "\r" && $string[1] == "\n") {
+ if (true === $this->dropFirstLF) {
+ if ("\r" == $string[0] && "\n" == $string[1]) {
$string = substr($string, 2);
}
}
$this->dropFirstLF = false;
if (strlen($string)) {
- $this->_dkimHandler->body($string);
+ $this->dkimHandler->body($string);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
index d13c02e4c3..84c53edb5e 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Signers/SMimeSigner.php
@@ -11,9 +11,9 @@
/**
* MIME Message Signer used to apply S/MIME Signature/Encryption to a message.
*
- *
* @author Romain-Geissler
* @author Sebastiaan Stok <s.stok@rollerscapes.net>
+ * @author Jan Flora <jf@penneo.com>
*/
class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
{
@@ -27,6 +27,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
protected $encryptOptions;
protected $encryptCipher;
protected $extraCerts = null;
+ protected $wrapFullMessage = false;
/**
* @var Swift_StreamFilters_StringReplacementFilterFactory
@@ -34,7 +35,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
protected $replacementFactory;
/**
- * @var Swift_Mime_HeaderFactory
+ * @var Swift_Mime_SimpleHeaderFactory
*/
protected $headerFactory;
@@ -59,32 +60,13 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
->lookup('transport.replacementfactory');
$this->signOptions = PKCS7_DETACHED;
-
- // Supported since php5.4
- if (defined('OPENSSL_CIPHER_AES_128_CBC')) {
- $this->encryptCipher = OPENSSL_CIPHER_AES_128_CBC;
- } else {
- $this->encryptCipher = OPENSSL_CIPHER_RC2_128;
- }
- }
-
- /**
- * Returns an new Swift_Signers_SMimeSigner instance.
- *
- * @param string $certificate
- * @param string $privateKey
- *
- * @return self
- */
- public static function newInstance($certificate = null, $privateKey = null)
- {
- return new self($certificate, $privateKey);
+ $this->encryptCipher = OPENSSL_CIPHER_AES_128_CBC;
}
/**
* Set the certificate location to use for signing.
*
- * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
+ * @see https://secure.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
@@ -107,9 +89,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
}
$this->signOptions = $signOptions;
- if (null !== $extraCerts) {
- $this->extraCerts = str_replace('\\', '/', realpath($extraCerts));
- }
+ $this->extraCerts = $extraCerts ? realpath($extraCerts) : null;
return $this;
}
@@ -117,8 +97,8 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
/**
* Set the certificate location to use for encryption.
*
- * @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
- * @see http://nl3.php.net/manual/en/openssl.ciphers.php
+ * @see https://secure.php.net/manual/en/openssl.pkcs7.flags.php
+ * @see https://secure.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
@@ -128,7 +108,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
public function setEncryptCertificate($recipientCerts, $cipher = null)
{
if (is_array($recipientCerts)) {
- $this->encryptCert = array();
+ $this->encryptCert = [];
foreach ($recipientCerts as $cert) {
$this->encryptCert[] = 'file://'.str_replace('\\', '/', realpath($cert));
@@ -197,9 +177,27 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
}
/**
- * Change the Swift_Message to apply the signing.
+ * Specify whether to wrap the entire MIME message in the S/MIME message.
+ *
+ * According to RFC5751 section 3.1:
+ * In order to protect outer, non-content-related message header fields
+ * (for instance, the "Subject", "To", "From", and "Cc" fields), the
+ * sending client MAY wrap a full MIME message in a message/rfc822
+ * wrapper in order to apply S/MIME security services to these header
+ * fields. It is up to the receiving client to decide how to present
+ * this "inner" header along with the unprotected "outer" header.
*
- * @param Swift_Message $message
+ * @param bool $wrap
+ *
+ * @return $this
+ */
+ public function setWrapFullMessage($wrap)
+ {
+ $this->wrapFullMessage = $wrap;
+ }
+
+ /**
+ * Change the Swift_Message to apply the signing.
*
* @return $this
*/
@@ -209,17 +207,13 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
return $this;
}
- // Store the message using ByteStream to a file{1}
- // Remove all Children
- // Sign file{1}, parse the new MIME headers and set them on the primary MimeEntity
- // Set the singed-body as the new body (without boundary)
-
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
- $this->toSMimeByteStream($messageStream, $message);
- $message->setEncoder(Swift_DependencyContainer::getInstance()->lookup('mime.rawcontentencoder'));
-
- $message->setChildren(array());
- $this->streamToMime($messageStream, $message);
+ if ($this->signThenEncrypt) {
+ $this->smimeSignMessage($message);
+ $this->smimeEncryptMessage($message);
+ } else {
+ $this->smimeEncryptMessage($message);
+ $this->smimeSignMessage($message);
+ }
}
/**
@@ -229,155 +223,279 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
*/
public function getAlteredHeaders()
{
- return array('Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition');
+ return ['Content-Type', 'Content-Transfer-Encoding', 'Content-Disposition'];
}
/**
- * @param Swift_InputByteStream $inputStream
- * @param Swift_Message $mimeEntity
+ * Sign a Swift message.
*/
- protected function toSMimeByteStream(Swift_InputByteStream $inputStream, Swift_Message $message)
+ protected function smimeSignMessage(Swift_Message $message)
{
- $mimeEntity = $this->createMessage($message);
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
-
- $mimeEntity->toByteStream($messageStream);
- $messageStream->commit();
+ // If we don't have a certificate we can't sign the message
+ if (null === $this->signCertificate) {
+ return;
+ }
- if (null !== $this->signCertificate && null !== $this->encryptCert) {
- $temporaryStream = new Swift_ByteStream_TemporaryFileByteStream();
+ // Work on a clone of the original message
+ $signMessage = clone $message;
+ $signMessage->clearSigners();
- if ($this->signThenEncrypt) {
- $this->messageStreamToSignedByteStream($messageStream, $temporaryStream);
- $this->messageStreamToEncryptedByteStream($temporaryStream, $inputStream);
- } else {
- $this->messageStreamToEncryptedByteStream($messageStream, $temporaryStream);
- $this->messageStreamToSignedByteStream($temporaryStream, $inputStream);
- }
- } elseif ($this->signCertificate !== null) {
- $this->messageStreamToSignedByteStream($messageStream, $inputStream);
+ if ($this->wrapFullMessage) {
+ // The original message essentially becomes the body of the new
+ // wrapped message
+ $signMessage = $this->wrapMimeMessage($signMessage);
} else {
- $this->messageStreamToEncryptedByteStream($messageStream, $inputStream);
+ // Only keep header needed to parse the body correctly
+ $this->clearAllHeaders($signMessage);
+ $this->copyHeaders(
+ $message,
+ $signMessage,
+ [
+ 'Content-Type',
+ 'Content-Transfer-Encoding',
+ 'Content-Disposition',
+ ]
+ );
+ }
+
+ // Copy the cloned message into a temporary file stream
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $signMessage->toByteStream($messageStream);
+ $messageStream->commit();
+ $signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
+
+ // Sign the message using openssl
+ if (!openssl_pkcs7_sign(
+ $messageStream->getPath(),
+ $signedMessageStream->getPath(),
+ $this->signCertificate,
+ $this->signPrivateKey,
+ [],
+ $this->signOptions,
+ $this->extraCerts
+ )
+ ) {
+ throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
}
+
+ // Parse the resulting signed message content back into the Swift message
+ // preserving the original headers
+ $this->parseSSLOutput($signedMessageStream, $message);
}
/**
- * @param Swift_Message $message
- *
- * @return Swift_Message
+ * Encrypt a Swift message.
*/
- protected function createMessage(Swift_Message $message)
+ protected function smimeEncryptMessage(Swift_Message $message)
{
- $mimeEntity = new Swift_Message('', $message->getBody(), $message->getContentType(), $message->getCharset());
- $mimeEntity->setChildren($message->getChildren());
+ // If we don't have a certificate we can't encrypt the message
+ if (null === $this->encryptCert) {
+ return;
+ }
- $messageHeaders = $mimeEntity->getHeaders();
- $messageHeaders->remove('Message-ID');
- $messageHeaders->remove('Date');
- $messageHeaders->remove('Subject');
- $messageHeaders->remove('MIME-Version');
- $messageHeaders->remove('To');
- $messageHeaders->remove('From');
+ // Work on a clone of the original message
+ $encryptMessage = clone $message;
+ $encryptMessage->clearSigners();
- return $mimeEntity;
+ if ($this->wrapFullMessage) {
+ // The original message essentially becomes the body of the new
+ // wrapped message
+ $encryptMessage = $this->wrapMimeMessage($encryptMessage);
+ } else {
+ // Only keep header needed to parse the body correctly
+ $this->clearAllHeaders($encryptMessage);
+ $this->copyHeaders(
+ $message,
+ $encryptMessage,
+ [
+ 'Content-Type',
+ 'Content-Transfer-Encoding',
+ 'Content-Disposition',
+ ]
+ );
+ }
+
+ // Convert the message content (including headers) to a string
+ // and place it in a temporary file
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $encryptMessage->toByteStream($messageStream);
+ $messageStream->commit();
+ $encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
+
+ // Encrypt the message
+ if (!openssl_pkcs7_encrypt(
+ $messageStream->getPath(),
+ $encryptedMessageStream->getPath(),
+ $this->encryptCert,
+ [],
+ 0,
+ $this->encryptCipher
+ )
+ ) {
+ throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
+ }
+
+ // Parse the resulting signed message content back into the Swift message
+ // preserving the original headers
+ $this->parseSSLOutput($encryptedMessageStream, $message);
}
/**
- * @param Swift_FileStream $outputStream
- * @param Swift_InputByteStream $inputStream
+ * Copy named headers from one Swift message to another.
+ */
+ protected function copyHeaders(
+ Swift_Message $fromMessage,
+ Swift_Message $toMessage,
+ array $headers = []
+ ) {
+ foreach ($headers as $header) {
+ $this->copyHeader($fromMessage, $toMessage, $header);
+ }
+ }
+
+ /**
+ * Copy a single header from one Swift message to another.
*
- * @throws Swift_IoException
+ * @param string $headerName
*/
- protected function messageStreamToSignedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $inputStream)
+ protected function copyHeader(Swift_Message $fromMessage, Swift_Message $toMessage, $headerName)
{
- $signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
-
- $args = array($outputStream->getPath(), $signedMessageStream->getPath(), $this->signCertificate, $this->signPrivateKey, array(), $this->signOptions);
- if (null !== $this->extraCerts) {
- $args[] = $this->extraCerts;
+ $header = $fromMessage->getHeaders()->get($headerName);
+ if (!$header) {
+ return;
}
-
- if (!call_user_func_array('openssl_pkcs7_sign', $args)) {
- throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
+ $headers = $toMessage->getHeaders();
+ switch ($header->getFieldType()) {
+ case Swift_Mime_Header::TYPE_TEXT:
+ $headers->addTextHeader($header->getFieldName(), $header->getValue());
+ break;
+ case Swift_Mime_Header::TYPE_PARAMETERIZED:
+ $headers->addParameterizedHeader(
+ $header->getFieldName(),
+ $header->getValue(),
+ $header->getParameters()
+ );
+ break;
}
+ }
- $this->copyFromOpenSSLOutput($signedMessageStream, $inputStream);
+ /**
+ * Remove all headers from a Swift message.
+ */
+ protected function clearAllHeaders(Swift_Message $message)
+ {
+ $headers = $message->getHeaders();
+ foreach ($headers->listAll() as $header) {
+ $headers->removeAll($header);
+ }
}
/**
- * @param Swift_FileStream $outputStream
- * @param Swift_InputByteStream $is
+ * Wraps a Swift_Message in a message/rfc822 MIME part.
*
- * @throws Swift_IoException
+ * @return Swift_MimePart
*/
- protected function messageStreamToEncryptedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $is)
+ protected function wrapMimeMessage(Swift_Message $message)
{
- $encryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ // Start by copying the original message into a message stream
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $message->toByteStream($messageStream);
+ $messageStream->commit();
- if (!openssl_pkcs7_encrypt($outputStream->getPath(), $encryptedMessageStream->getPath(), $this->encryptCert, array(), 0, $this->encryptCipher)) {
- throw new Swift_IoException(sprintf('Failed to encrypt S/Mime message. Error: "%s".', openssl_error_string()));
- }
+ // Create a new MIME part that wraps the original stream
+ $wrappedMessage = new Swift_MimePart($messageStream, 'message/rfc822');
+ $wrappedMessage->setEncoder(new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit'));
- $this->copyFromOpenSSLOutput($encryptedMessageStream, $is);
+ return $wrappedMessage;
+ }
+
+ protected function parseSSLOutput(Swift_InputByteStream $inputStream, Swift_Message $message)
+ {
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $this->copyFromOpenSSLOutput($inputStream, $messageStream);
+
+ $this->streamToMime($messageStream, $message);
}
/**
- * @param Swift_OutputByteStream $fromStream
- * @param Swift_InputByteStream $toStream
+ * Merges an OutputByteStream from OpenSSL to a Swift_Message.
*/
- protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream)
+ protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
{
- $bufferLength = 4096;
- $filteredStream = new Swift_ByteStream_TemporaryFileByteStream();
- $filteredStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF');
- $filteredStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF');
+ // Parse the stream into headers and body
+ list($headers, $messageStream) = $this->parseStream($fromStream);
- while (false !== ($buffer = $fromStream->read($bufferLength))) {
- $filteredStream->write($buffer);
+ // Get the original message headers
+ $messageHeaders = $message->getHeaders();
+
+ // Let the stream determine the headers describing the body content,
+ // since the body of the original message is overwritten by the body
+ // coming from the stream.
+ // These are all content-* headers.
+
+ // Default transfer encoding is 7bit if not set
+ $encoding = '';
+ // Remove all existing transfer encoding headers
+ $messageHeaders->removeAll('Content-Transfer-Encoding');
+ // See whether the stream sets the transfer encoding
+ if (isset($headers['content-transfer-encoding'])) {
+ $encoding = $headers['content-transfer-encoding'];
}
- $filteredStream->flushBuffers();
+ // We use the null content encoder, since the body is already encoded
+ // according to the transfer encoding specified in the stream
+ $message->setEncoder(new Swift_Mime_ContentEncoder_NullContentEncoder($encoding));
- while (false !== ($buffer = $filteredStream->read($bufferLength))) {
- $toStream->write($buffer);
+ // Set the disposition, if present
+ if (isset($headers['content-disposition'])) {
+ $messageHeaders->addTextHeader('Content-Disposition', $headers['content-disposition']);
}
- $toStream->commit();
+ // Copy over the body from the stream using the content type dictated
+ // by the stream content
+ $message->setChildren([]);
+ $message->setBody($messageStream, $headers['content-type']);
}
/**
- * Merges an OutputByteStream to Swift_Message.
+ * This message will parse the headers of a MIME email byte stream
+ * and return an array that contains the headers as an associative
+ * array and the email body as a string.
*
- * @param Swift_OutputByteStream $fromStream
- * @param Swift_Message $message
+ * @return array
*/
- protected function streamToMime(Swift_OutputByteStream $fromStream, Swift_Message $message)
+ protected function parseStream(Swift_OutputByteStream $emailStream)
{
$bufferLength = 78;
$headerData = '';
+ $headerBodySeparator = "\r\n\r\n";
- $fromStream->setReadPointer(0);
+ $emailStream->setReadPointer(0);
- while (($buffer = $fromStream->read($bufferLength)) !== false) {
+ // Read out the headers section from the stream to a string
+ while (false !== ($buffer = $emailStream->read($bufferLength))) {
$headerData .= $buffer;
- if (false !== strpos($buffer, "\r\n\r\n")) {
+ $headersPosEnd = strpos($headerData, $headerBodySeparator);
+
+ // Stop reading if we found the end of the headers
+ if (false !== $headersPosEnd) {
break;
}
}
- $headersPosEnd = strpos($headerData, "\r\n\r\n");
- $headerData = trim($headerData);
- $headerData = substr($headerData, 0, $headersPosEnd);
+ // Split the header data into lines
+ $headerData = trim(substr($headerData, 0, $headersPosEnd));
$headerLines = explode("\r\n", $headerData);
unset($headerData);
- $headers = array();
+ $headers = [];
$currentHeaderName = '';
+ // Transform header lines into an associative array
foreach ($headerLines as $headerLine) {
- // Line separated
- if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) {
+ // Handle headers that span multiple lines
+ if (false === strpos($headerLine, ':')) {
$headers[$currentHeaderName] .= ' '.trim($headerLine);
continue;
}
@@ -387,50 +505,38 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
$headers[$currentHeaderName] = trim($header[1]);
}
- $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
- $messageStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF');
- $messageStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF');
-
- $messageHeaders = $message->getHeaders();
-
- // No need to check for 'application/pkcs7-mime', as this is always base64
- if ('multipart/signed;' === substr($headers['content-type'], 0, 17)) {
- if (!preg_match('/boundary=("[^"]+"|(?:[^\s]+|$))/is', $headers['content-type'], $contentTypeData)) {
- throw new Swift_SwiftException('Failed to find Boundary parameter');
- }
-
- $boundary = trim($contentTypeData['1'], '"');
+ // Read the entire email body into a byte stream
+ $bodyStream = new Swift_ByteStream_TemporaryFileByteStream();
- // Skip the header and CRLF CRLF
- $fromStream->setReadPointer($headersPosEnd + 4);
+ // Skip the header and separator and point to the body
+ $emailStream->setReadPointer($headersPosEnd + strlen($headerBodySeparator));
- while (false !== ($buffer = $fromStream->read($bufferLength))) {
- $messageStream->write($buffer);
- }
+ while (false !== ($buffer = $emailStream->read($bufferLength))) {
+ $bodyStream->write($buffer);
+ }
- $messageStream->commit();
+ $bodyStream->commit();
- $messageHeaders->remove('Content-Transfer-Encoding');
- $message->setContentType($headers['content-type']);
- $message->setBoundary($boundary);
- $message->setBody($messageStream);
- } else {
- $fromStream->setReadPointer($headersPosEnd + 4);
+ return [$headers, $bodyStream];
+ }
- if (null === $this->headerFactory) {
- $this->headerFactory = Swift_DependencyContainer::getInstance()->lookup('mime.headerfactory');
- }
+ protected function copyFromOpenSSLOutput(Swift_OutputByteStream $fromStream, Swift_InputByteStream $toStream)
+ {
+ $bufferLength = 4096;
+ $filteredStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $filteredStream->addFilter($this->replacementFactory->createFilter("\r\n", "\n"), 'CRLF to LF');
+ $filteredStream->addFilter($this->replacementFactory->createFilter("\n", "\r\n"), 'LF to CRLF');
- $message->setContentType($headers['content-type']);
- $messageHeaders->set($this->headerFactory->createTextHeader('Content-Transfer-Encoding', $headers['content-transfer-encoding']));
- $messageHeaders->set($this->headerFactory->createTextHeader('Content-Disposition', $headers['content-disposition']));
+ while (false !== ($buffer = $fromStream->read($bufferLength))) {
+ $filteredStream->write($buffer);
+ }
- while (false !== ($buffer = $fromStream->read($bufferLength))) {
- $messageStream->write($buffer);
- }
+ $filteredStream->flushBuffers();
- $messageStream->commit();
- $message->setBody($messageStream);
+ while (false !== ($buffer = $filteredStream->read($bufferLength))) {
+ $toStream->write($buffer);
}
+
+ $toStream->commit();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php
index b97f01e7c9..e241e67869 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php
@@ -11,7 +11,7 @@
/**
* Sends Messages over SMTP with ESMTP support.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*
* @method Swift_SmtpTransport setUsername(string $username) Set the username to authenticate with.
* @method string getUsername() Get the username to authenticate with.
@@ -23,36 +23,20 @@
class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
{
/**
- * Create a new SmtpTransport, optionally with $host, $port and $security.
- *
* @param string $host
* @param int $port
- * @param string $security
+ * @param string $encryption
*/
- public function __construct($host = 'localhost', $port = 25, $security = null)
+ public function __construct($host = 'localhost', $port = 25, $encryption = null)
{
call_user_func_array(
- array($this, 'Swift_Transport_EsmtpTransport::__construct'),
+ [$this, 'Swift_Transport_EsmtpTransport::__construct'],
Swift_DependencyContainer::getInstance()
->createDependenciesFor('transport.smtp')
);
$this->setHost($host);
$this->setPort($port);
- $this->setEncryption($security);
- }
-
- /**
- * Create a new SmtpTransport instance.
- *
- * @param string $host
- * @param int $port
- * @param string $security
- *
- * @return self
- */
- public static function newInstance($host = 'localhost', $port = 25, $security = null)
- {
- return new self($host, $port, $security);
+ $this->setEncryption($encryption);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php
index c16ab4b38e..9d0e8fee2b 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Spool.php
@@ -35,11 +35,11 @@ interface Swift_Spool
/**
* Queues a message.
*
- * @param Swift_Mime_Message $message The message to store
+ * @param Swift_Mime_SimpleMessage $message The message to store
*
* @return bool Whether the operation has succeeded
*/
- public function queueMessage(Swift_Mime_Message $message);
+ public function queueMessage(Swift_Mime_SimpleMessage $message);
/**
* Sends messages using the given transport instance.
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php
index 79c9b1f037..4b30f04ed9 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SpoolTransport.php
@@ -17,8 +17,6 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport
{
/**
* Create a new SpoolTransport.
- *
- * @param Swift_Spool $spool
*/
public function __construct(Swift_Spool $spool)
{
@@ -28,20 +26,8 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport
$arguments[] = $spool;
call_user_func_array(
- array($this, 'Swift_Transport_SpoolTransport::__construct'),
+ [$this, 'Swift_Transport_SpoolTransport::__construct'],
$arguments
);
}
-
- /**
- * Create a new SpoolTransport instance.
- *
- * @param Swift_Spool $spool
- *
- * @return self
- */
- public static function newInstance(Swift_Spool $spool)
- {
- return new self($spool);
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
index 9412b1dc78..c3b7675ddb 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
@@ -13,26 +13,23 @@
*
* This stream filter deals with Byte arrays rather than simple strings.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilter
{
- /** The needle(s) to search for */
- private $_search;
-
/** The replacement(s) to make */
- private $_replace;
+ private $replace;
/** The Index for searching */
- private $_index;
+ private $index;
/** The Search Tree */
- private $_tree = array();
+ private $tree = [];
/** Gives the size of the largest search */
- private $_treeMaxLen = 0;
+ private $treeMaxLen = 0;
- private $_repSize;
+ private $repSize;
/**
* Create a new ByteArrayReplacementFilter with $search and $replace.
@@ -42,26 +39,25 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
*/
public function __construct($search, $replace)
{
- $this->_search = $search;
- $this->_index = array();
- $this->_tree = array();
- $this->_replace = array();
- $this->_repSize = array();
+ $this->index = [];
+ $this->tree = [];
+ $this->replace = [];
+ $this->repSize = [];
$tree = null;
$i = null;
$last_size = $size = 0;
foreach ($search as $i => $search_element) {
- if ($tree !== null) {
+ if (null !== $tree) {
$tree[-1] = min(count($replace) - 1, $i - 1);
$tree[-2] = $last_size;
}
- $tree = &$this->_tree;
+ $tree = &$this->tree;
if (is_array($search_element)) {
foreach ($search_element as $k => $char) {
- $this->_index[$char] = true;
+ $this->index[$char] = true;
if (!isset($tree[$char])) {
- $tree[$char] = array();
+ $tree[$char] = [];
}
$tree = &$tree[$char];
}
@@ -70,27 +66,27 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
} else {
$last_size = 1;
if (!isset($tree[$search_element])) {
- $tree[$search_element] = array();
+ $tree[$search_element] = [];
}
$tree = &$tree[$search_element];
$size = max($last_size, $size);
- $this->_index[$search_element] = true;
+ $this->index[$search_element] = true;
}
}
- if ($i !== null) {
+ if (null !== $i) {
$tree[-1] = min(count($replace) - 1, $i);
$tree[-2] = $last_size;
- $this->_treeMaxLen = $size;
+ $this->treeMaxLen = $size;
}
foreach ($replace as $rep) {
if (!is_array($rep)) {
- $rep = array($rep);
+ $rep = [$rep];
}
- $this->_replace[] = $rep;
+ $this->replace[] = $rep;
}
- for ($i = count($this->_replace) - 1; $i >= 0; --$i) {
- $this->_replace[$i] = $rep = $this->filter($this->_replace[$i], $i);
- $this->_repSize[$i] = count($rep);
+ for ($i = count($this->replace) - 1; $i >= 0; --$i) {
+ $this->replace[$i] = $rep = $this->filter($this->replace[$i], $i);
+ $this->repSize[$i] = count($rep);
}
}
@@ -105,47 +101,47 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
{
$endOfBuffer = end($buffer);
- return isset($this->_index[$endOfBuffer]);
+ return isset($this->index[$endOfBuffer]);
}
/**
* Perform the actual replacements on $buffer and return the result.
*
* @param array $buffer
- * @param int $_minReplaces
+ * @param int $minReplaces
*
* @return array
*/
- public function filter($buffer, $_minReplaces = -1)
+ public function filter($buffer, $minReplaces = -1)
{
- if ($this->_treeMaxLen == 0) {
+ if (0 == $this->treeMaxLen) {
return $buffer;
}
- $newBuffer = array();
+ $newBuffer = [];
$buf_size = count($buffer);
$last_size = 0;
for ($i = 0; $i < $buf_size; ++$i) {
- $search_pos = $this->_tree;
+ $search_pos = $this->tree;
$last_found = PHP_INT_MAX;
// We try to find if the next byte is part of a search pattern
- for ($j = 0; $j <= $this->_treeMaxLen; ++$j) {
+ 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]])) {
$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
- && $search_pos[-1] > $_minReplaces) {
+ && $search_pos[-1] > $minReplaces) {
$last_found = $search_pos[-1];
$last_size = $search_pos[-2];
}
}
// We got a complete pattern
- elseif ($last_found !== PHP_INT_MAX) {
+ elseif (PHP_INT_MAX !== $last_found) {
// Adding replacement datas to output buffer
- $rep_size = $this->_repSize[$last_found];
+ $rep_size = $this->repSize[$last_found];
for ($j = 0; $j < $rep_size; ++$j) {
- $newBuffer[] = $this->_replace[$last_found][$j];
+ $newBuffer[] = $this->replace[$last_found][$j];
}
// We Move cursor forward
$i += $last_size - 1;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php
index f64144af2d..50a63f1aaa 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilter.php
@@ -16,10 +16,10 @@
class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter
{
/** The needle(s) to search for */
- private $_search;
+ private $search;
/** The replacement(s) to make */
- private $_replace;
+ private $replace;
/**
* Create a new StringReplacementFilter with $search and $replace.
@@ -29,8 +29,8 @@ class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter
*/
public function __construct($search, $replace)
{
- $this->_search = $search;
- $this->_replace = $replace;
+ $this->search = $search;
+ $this->replace = $replace;
}
/**
@@ -47,7 +47,7 @@ class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter
}
$endOfBuffer = substr($buffer, -1);
- foreach ((array) $this->_search as $needle) {
+ foreach ((array) $this->search as $needle) {
if (false !== strpos($needle, $endOfBuffer)) {
return true;
}
@@ -65,6 +65,6 @@ class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter
*/
public function filter($buffer)
{
- return str_replace($this->_search, $this->_replace, $buffer);
+ return str_replace($this->search, $this->replace, $buffer);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
index e98240b5bc..783b8896dd 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/StreamFilters/StringReplacementFilterFactory.php
@@ -16,7 +16,7 @@
class Swift_StreamFilters_StringReplacementFilterFactory implements Swift_ReplacementFilterFactory
{
/** Lazy-loaded filters */
- private $_filters = array();
+ private $filters = [];
/**
* Create a new StreamFilter to replace $search with $replace in a string.
@@ -28,18 +28,18 @@ class Swift_StreamFilters_StringReplacementFilterFactory implements Swift_Replac
*/
public function createFilter($search, $replace)
{
- if (!isset($this->_filters[$search][$replace])) {
- if (!isset($this->_filters[$search])) {
- $this->_filters[$search] = array();
+ if (!isset($this->filters[$search][$replace])) {
+ if (!isset($this->filters[$search])) {
+ $this->filters[$search] = [];
}
- if (!isset($this->_filters[$search][$replace])) {
- $this->_filters[$search][$replace] = array();
+ if (!isset($this->filters[$search][$replace])) {
+ $this->filters[$search][$replace] = [];
}
- $this->_filters[$search][$replace] = new Swift_StreamFilters_StringReplacementFilter($search, $replace);
+ $this->filters[$search][$replace] = new Swift_StreamFilters_StringReplacementFilter($search, $replace);
}
- return $this->_filters[$search][$replace];
+ return $this->filters[$search][$replace];
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php
index db3d31093e..15e68b18e7 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SwiftException.php
@@ -18,9 +18,8 @@ class Swift_SwiftException extends Exception
/**
* Create a new SwiftException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php
index 6535eadf25..0951f35e76 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport.php
@@ -33,17 +33,42 @@ interface Swift_Transport
public function stop();
/**
+ * Check if this Transport mechanism is alive.
+ *
+ * If a Transport mechanism session is no longer functional, the method
+ * returns FALSE. It is the responsibility of the developer to handle this
+ * case and restart the Transport mechanism manually.
+ *
+ * @example
+ *
+ * if (!$transport->ping()) {
+ * $transport->stop();
+ * $transport->start();
+ * }
+ *
+ * The Transport mechanism will be started, if it is not already.
+ *
+ * It is undefined if the Transport mechanism attempts to restart as long as
+ * the return value reflects whether the mechanism is now functional.
+ *
+ * @return bool TRUE if the transport is alive
+ */
+ public function ping();
+
+ /**
* Send the given Message.
*
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * This is the responsibility of the send method to start the transport if needed.
+ *
+ * @param Swift_Mime_SimpleMessage $message
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null);
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null);
/**
* Register a plugin in the Transport.
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
index 60233f9687..18c8d9b90c 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php
@@ -16,34 +16,42 @@
abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
{
/** Input-Output buffer for sending/receiving SMTP commands and responses */
- protected $_buffer;
+ protected $buffer;
/** Connection status */
- protected $_started = false;
+ protected $started = false;
/** The domain name to use in HELO command */
- protected $_domain = '[127.0.0.1]';
+ protected $domain = '[127.0.0.1]';
/** The event dispatching layer */
- protected $_eventDispatcher;
+ protected $eventDispatcher;
+
+ protected $addressEncoder;
+
+ /** Whether the PIPELINING SMTP extension is enabled (RFC 2920) */
+ protected $pipelining = null;
+
+ /** The pipelined commands waiting for response */
+ protected $pipeline = [];
/** Source Ip */
- protected $_sourceIp;
+ protected $sourceIp;
/** Return an array of params for the Buffer */
- abstract protected function _getBufferParams();
+ abstract protected function getBufferParams();
/**
* Creates a new EsmtpTransport using the given I/O buffer.
*
- * @param Swift_Transport_IoBuffer $buf
- * @param Swift_Events_EventDispatcher $dispatcher
+ * @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher)
+ public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- $this->_eventDispatcher = $dispatcher;
- $this->_buffer = $buf;
- $this->_lookupHostname();
+ $this->buffer = $buf;
+ $this->eventDispatcher = $dispatcher;
+ $this->addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
+ $this->setLocalDomain($localDomain);
}
/**
@@ -52,8 +60,9 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
* This should be a fully-qualified domain name and should be truly the domain
* you're using.
*
- * If your server doesn't have a domain name, use the IP in square
- * brackets (i.e. [127.0.0.1]).
+ * If your server does not have a domain name, use the IP address. This will
+ * automatically be wrapped in square brackets as described in RFC 5321,
+ * section 4.1.3.
*
* @param string $domain
*
@@ -61,7 +70,15 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function setLocalDomain($domain)
{
- $this->_domain = $domain;
+ if ('[' !== substr($domain, 0, 1)) {
+ if (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
+ $domain = '['.$domain.']';
+ } elseif (filter_var($domain, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
+ $domain = '[IPv6:'.$domain.']';
+ }
+ }
+
+ $this->domain = $domain;
return $this;
}
@@ -69,11 +86,14 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
/**
* Get the name of the domain Swift will identify as.
*
+ * If an IP address was specified, this will be returned wrapped in square
+ * brackets as described in RFC 5321, section 4.1.3.
+ *
* @return string
*/
public function getLocalDomain()
{
- return $this->_domain;
+ return $this->domain;
}
/**
@@ -83,7 +103,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function setSourceIp($source)
{
- $this->_sourceIp = $source;
+ $this->sourceIp = $source;
}
/**
@@ -93,7 +113,17 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function getSourceIp()
{
- return $this->_sourceIp;
+ return $this->sourceIp;
+ }
+
+ public function setAddressEncoder(Swift_AddressEncoder $addressEncoder)
+ {
+ $this->addressEncoder = $addressEncoder;
+ }
+
+ public function getAddressEncoder()
+ {
+ return $this->addressEncoder;
}
/**
@@ -101,27 +131,27 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function start()
{
- if (!$this->_started) {
- if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
+ if (!$this->started) {
+ if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
if ($evt->bubbleCancelled()) {
return;
}
}
try {
- $this->_buffer->initialize($this->_getBufferParams());
+ $this->buffer->initialize($this->getBufferParams());
} catch (Swift_TransportException $e) {
- $this->_throwException($e);
+ $this->throwException($e);
}
- $this->_readGreeting();
- $this->_doHeloCommand();
+ $this->readGreeting();
+ $this->doHeloCommand();
if ($evt) {
- $this->_eventDispatcher->dispatchEvent($evt, 'transportStarted');
+ $this->eventDispatcher->dispatchEvent($evt, 'transportStarted');
}
- $this->_started = true;
+ $this->started = true;
}
}
@@ -132,7 +162,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function isStarted()
{
- return $this->_started;
+ return $this->started;
}
/**
@@ -141,28 +171,28 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
+ if (!$this->isStarted()) {
+ $this->start();
+ }
+
$sent = 0;
$failedRecipients = (array) $failedRecipients;
- if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
+ if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
if ($evt->bubbleCancelled()) {
return 0;
}
}
- if (!$reversePath = $this->_getReversePath($message)) {
- $this->_throwException(new Swift_TransportException(
- 'Cannot send message without a sender address'
- )
- );
+ if (!$reversePath = $this->getReversePath($message)) {
+ $this->throwException(new Swift_TransportException('Cannot send message without a sender address'));
}
$to = (array) $message->getTo();
@@ -170,18 +200,15 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
$tos = array_merge($to, $cc);
$bcc = (array) $message->getBcc();
- $message->setBcc(array());
+ $message->setBcc([]);
try {
- $sent += $this->_sendTo($message, $reversePath, $tos, $failedRecipients);
- $sent += $this->_sendBcc($message, $reversePath, $bcc, $failedRecipients);
- } catch (Exception $e) {
+ $sent += $this->sendTo($message, $reversePath, $tos, $failedRecipients);
+ $sent += $this->sendBcc($message, $reversePath, $bcc, $failedRecipients);
+ } finally {
$message->setBcc($bcc);
- throw $e;
}
- $message->setBcc($bcc);
-
if ($evt) {
if ($sent == count($to) + count($cc) + count($bcc)) {
$evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
@@ -191,7 +218,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
$evt->setResult(Swift_Events_SendEvent::RESULT_FAILED);
}
$evt->setFailedRecipients($failedRecipients);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed');
}
$message->generateId(); //Make sure a new Message ID is used
@@ -204,40 +231,61 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function stop()
{
- if ($this->_started) {
- if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
+ if ($this->started) {
+ if ($evt = $this->eventDispatcher->createTransportChangeEvent($this)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeTransportStopped');
if ($evt->bubbleCancelled()) {
return;
}
}
try {
- $this->executeCommand("QUIT\r\n", array(221));
+ $this->executeCommand("QUIT\r\n", [221]);
} catch (Swift_TransportException $e) {
}
try {
- $this->_buffer->terminate();
+ $this->buffer->terminate();
if ($evt) {
- $this->_eventDispatcher->dispatchEvent($evt, 'transportStopped');
+ $this->eventDispatcher->dispatchEvent($evt, 'transportStopped');
}
} catch (Swift_TransportException $e) {
- $this->_throwException($e);
+ $this->throwException($e);
}
}
- $this->_started = false;
+ $this->started = false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function ping()
+ {
+ try {
+ if (!$this->isStarted()) {
+ $this->start();
+ }
+
+ $this->executeCommand("NOOP\r\n", [250]);
+ } catch (Swift_TransportException $e) {
+ try {
+ $this->stop();
+ } catch (Swift_TransportException $e) {
+ }
+
+ return false;
+ }
+
+ return true;
}
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
- $this->_eventDispatcher->bindEventListener($plugin);
+ $this->eventDispatcher->bindEventListener($plugin);
}
/**
@@ -245,7 +293,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function reset()
{
- $this->executeCommand("RSET\r\n", array(250));
+ $this->executeCommand("RSET\r\n", [250], $failures, true);
}
/**
@@ -255,7 +303,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*/
public function getBuffer()
{
- return $this->_buffer;
+ return $this->buffer;
}
/**
@@ -263,78 +311,101 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
*
* If no response codes are given, the response will not be validated.
* If codes are given, an exception will be thrown on an invalid response.
+ * If the command is RCPT TO, and the pipeline is non-empty, no exception
+ * will be thrown; instead the failing address is added to $failures.
*
* @param string $command
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
+ * @param bool $pipeline Do not wait for response
+ * @param string $address The address, if command is RCPT TO.
*
- * @return string
+ * @return string|null The server response, or null if pipelining is enabled
*/
- public function executeCommand($command, $codes = array(), &$failures = null)
+ public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
{
$failures = (array) $failures;
- $seq = $this->_buffer->write($command);
- $response = $this->_getFullResponse($seq);
- if ($evt = $this->_eventDispatcher->createCommandEvent($this, $command, $codes)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'commandSent');
+ $seq = $this->buffer->write($command);
+ if ($evt = $this->eventDispatcher->createCommandEvent($this, $command, $codes)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'commandSent');
+ }
+
+ $this->pipeline[] = [$command, $seq, $codes, $address];
+ if ($pipeline && $this->pipelining) {
+ $response = null;
+ } else {
+ while ($this->pipeline) {
+ list($command, $seq, $codes, $address) = array_shift($this->pipeline);
+ $response = $this->getFullResponse($seq);
+ try {
+ $this->assertResponseCode($response, $codes);
+ } catch (Swift_TransportException $e) {
+ if ($this->pipeline && $address) {
+ $failures[] = $address;
+ } else {
+ $this->throwException($e);
+ }
+ }
+ }
}
- $this->_assertResponseCode($response, $codes);
return $response;
}
/** Read the opening SMTP greeting */
- protected function _readGreeting()
+ protected function readGreeting()
{
- $this->_assertResponseCode($this->_getFullResponse(0), array(220));
+ $this->assertResponseCode($this->getFullResponse(0), [220]);
}
/** Send the HELO welcome */
- protected function _doHeloCommand()
+ protected function doHeloCommand()
{
$this->executeCommand(
- sprintf("HELO %s\r\n", $this->_domain), array(250)
+ sprintf("HELO %s\r\n", $this->domain), [250]
);
}
/** Send the MAIL FROM command */
- protected function _doMailFromCommand($address)
+ protected function doMailFromCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
- sprintf("MAIL FROM:<%s>\r\n", $address), array(250)
+ sprintf("MAIL FROM:<%s>\r\n", $address), [250], $failures, true
);
}
/** Send the RCPT TO command */
- protected function _doRcptToCommand($address)
+ protected function doRcptToCommand($address)
{
+ $address = $this->addressEncoder->encodeString($address);
$this->executeCommand(
- sprintf("RCPT TO:<%s>\r\n", $address), array(250, 251, 252)
+ sprintf("RCPT TO:<%s>\r\n", $address), [250, 251, 252], $failures, true, $address
);
}
/** Send the DATA command */
- protected function _doDataCommand()
+ protected function doDataCommand(&$failedRecipients)
{
- $this->executeCommand("DATA\r\n", array(354));
+ $this->executeCommand("DATA\r\n", [354], $failedRecipients);
}
/** Stream the contents of the message over the buffer */
- protected function _streamMessage(Swift_Mime_Message $message)
+ protected function streamMessage(Swift_Mime_SimpleMessage $message)
{
- $this->_buffer->setWriteTranslations(array("\r\n." => "\r\n.."));
+ $this->buffer->setWriteTranslations(["\r\n." => "\r\n.."]);
try {
- $message->toByteStream($this->_buffer);
- $this->_buffer->flushBuffers();
+ $message->toByteStream($this->buffer);
+ $this->buffer->flushBuffers();
} catch (Swift_TransportException $e) {
- $this->_throwException($e);
+ $this->throwException($e);
}
- $this->_buffer->setWriteTranslations(array());
- $this->executeCommand("\r\n.\r\n", array(250));
+ $this->buffer->setWriteTranslations([]);
+ $this->executeCommand("\r\n.\r\n", [250]);
}
/** Determine the best-use reverse path for this message */
- protected function _getReversePath(Swift_Mime_Message $message)
+ protected function getReversePath(Swift_Mime_SimpleMessage $message)
{
$return = $message->getReturnPath();
$sender = $message->getSender();
@@ -355,10 +426,10 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
/** Throw a TransportException, first sending it to any listeners */
- protected function _throwException(Swift_TransportException $e)
+ protected function throwException(Swift_TransportException $e)
{
- if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
+ if ($evt = $this->eventDispatcher->createTransportExceptionEvent($this, $e)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
if (!$evt->bubbleCancelled()) {
throw $e;
}
@@ -368,64 +439,65 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
/** Throws an Exception if a response code is incorrect */
- protected function _assertResponseCode($response, $wanted)
+ protected function assertResponseCode($response, $wanted)
{
+ if (!$response) {
+ $this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got an empty response'));
+ }
+
list($code) = sscanf($response, '%3d');
$valid = (empty($wanted) || in_array($code, $wanted));
- if ($evt = $this->_eventDispatcher->createResponseEvent($this, $response,
+ if ($evt = $this->eventDispatcher->createResponseEvent($this, $response,
$valid)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'responseReceived');
+ $this->eventDispatcher->dispatchEvent($evt, 'responseReceived');
}
if (!$valid) {
- $this->_throwException(
- new Swift_TransportException(
- 'Expected response code '.implode('/', $wanted).' but got code '.
- '"'.$code.'", with message "'.$response.'"',
- $code)
- );
+ $this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got code "'.$code.'", with message "'.$response.'"', $code));
}
}
/** Get an entire multi-line response using its sequence number */
- protected function _getFullResponse($seq)
+ protected function getFullResponse($seq)
{
$response = '';
try {
do {
- $line = $this->_buffer->readLine($seq);
+ $line = $this->buffer->readLine($seq);
$response .= $line;
} while (null !== $line && false !== $line && ' ' != $line[3]);
} catch (Swift_TransportException $e) {
- $this->_throwException($e);
+ $this->throwException($e);
} catch (Swift_IoException $e) {
- $this->_throwException(
- new Swift_TransportException(
- $e->getMessage())
- );
+ $this->throwException(new Swift_TransportException($e->getMessage(), 0, $e));
}
return $response;
}
/** Send an email to the given recipients from the given reverse path */
- private function _doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients)
+ private function doMailTransaction($message, $reversePath, array $recipients, array &$failedRecipients)
{
$sent = 0;
- $this->_doMailFromCommand($reversePath);
+ $this->doMailFromCommand($reversePath);
foreach ($recipients as $forwardPath) {
try {
- $this->_doRcptToCommand($forwardPath);
+ $this->doRcptToCommand($forwardPath);
++$sent;
} catch (Swift_TransportException $e) {
$failedRecipients[] = $forwardPath;
+ } catch (Swift_AddressEncoderException $e) {
+ $failedRecipients[] = $forwardPath;
}
}
- if ($sent != 0) {
- $this->_doDataCommand();
- $this->_streamMessage($message);
+ if (0 != $sent) {
+ $sent += count($failedRecipients);
+ $this->doDataCommand($failedRecipients);
+ $sent -= count($failedRecipients);
+
+ $this->streamMessage($message);
} else {
$this->reset();
}
@@ -434,58 +506,30 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
}
/** Send a message to the given To: recipients */
- private function _sendTo(Swift_Mime_Message $message, $reversePath, array $to, array &$failedRecipients)
+ private function sendTo(Swift_Mime_SimpleMessage $message, $reversePath, array $to, array &$failedRecipients)
{
if (empty($to)) {
return 0;
}
- return $this->_doMailTransaction($message, $reversePath, array_keys($to),
+ return $this->doMailTransaction($message, $reversePath, array_keys($to),
$failedRecipients);
}
/** Send a message to all Bcc: recipients */
- private function _sendBcc(Swift_Mime_Message $message, $reversePath, array $bcc, array &$failedRecipients)
+ private function sendBcc(Swift_Mime_SimpleMessage $message, $reversePath, array $bcc, array &$failedRecipients)
{
$sent = 0;
foreach ($bcc as $forwardPath => $name) {
- $message->setBcc(array($forwardPath => $name));
- $sent += $this->_doMailTransaction(
- $message, $reversePath, array($forwardPath), $failedRecipients
+ $message->setBcc([$forwardPath => $name]);
+ $sent += $this->doMailTransaction(
+ $message, $reversePath, [$forwardPath], $failedRecipients
);
}
return $sent;
}
- /** Try to determine the hostname of the server this is run on */
- private function _lookupHostname()
- {
- if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) {
- $this->_domain = $_SERVER['SERVER_NAME'];
- } elseif (!empty($_SERVER['SERVER_ADDR'])) {
- // Set the address literal tag (See RFC 5321, section: 4.1.3)
- if (false === strpos($_SERVER['SERVER_ADDR'], ':')) {
- $prefix = ''; // IPv4 addresses are not tagged.
- } else {
- $prefix = 'IPv6:'; // Adding prefix in case of IPv6.
- }
-
- $this->_domain = sprintf('[%s%s]', $prefix, $_SERVER['SERVER_ADDR']);
- }
- }
-
- /** Determine is the $hostname is a fully-qualified name */
- private function _isFqdn($hostname)
- {
- // We could do a really thorough check, but there's really no point
- if (false !== $dotPos = strpos($hostname, '.')) {
- return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1);
- }
-
- return false;
- }
-
/**
* Destructor.
*/
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
index 53f721d03c..51dc7f563a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
@@ -26,29 +26,23 @@ class Swift_Transport_Esmtp_Auth_CramMd5Authenticator implements Swift_Transport
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
- $challenge = $agent->executeCommand("AUTH CRAM-MD5\r\n", array(334));
+ $challenge = $agent->executeCommand("AUTH CRAM-MD5\r\n", [334]);
$challenge = base64_decode(substr($challenge, 4));
$message = base64_encode(
- $username.' '.$this->_getResponse($password, $challenge)
+ $username.' '.$this->getResponse($password, $challenge)
);
- $agent->executeCommand(sprintf("%s\r\n", $message), array(235));
+ $agent->executeCommand(sprintf("%s\r\n", $message), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
@@ -60,7 +54,7 @@ class Swift_Transport_Esmtp_Auth_CramMd5Authenticator implements Swift_Transport
*
* @return string
*/
- private function _getResponse($secret, $challenge)
+ private function getResponse($secret, $challenge)
{
if (strlen($secret) > 64) {
$secret = pack('H32', md5($secret));
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
index 6ab6e3337e..458c038307 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/LoginAuthenticator.php
@@ -26,26 +26,20 @@ class Swift_Transport_Esmtp_Auth_LoginAuthenticator implements Swift_Transport_E
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
- $agent->executeCommand("AUTH LOGIN\r\n", array(334));
- $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), array(334));
- $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), array(235));
+ $agent->executeCommand("AUTH LOGIN\r\n", [334]);
+ $agent->executeCommand(sprintf("%s\r\n", base64_encode($username)), [334]);
+ $agent->executeCommand(sprintf("%s\r\n", base64_encode($password)), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $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 8392658573..90081f8e6f 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
@@ -13,7 +13,7 @@
/**
* Handles NTLM authentication.
*
- * @author Ward Peeters <ward@coding-tech.com>
+ * @author Ward Peeters <ward@coding-tech.com>
*/
class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Esmtp_Authenticator
{
@@ -31,17 +31,13 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
}
/**
- * Try to authenticate the user with $username and $password.
+ * {@inheritdoc}
*
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * @throws \LogicException
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
- if (!function_exists('openssl_random_pseudo_bytes') || !function_exists('openssl_encrypt')) {
+ if (!function_exists('openssl_encrypt')) {
throw new LogicException('The OpenSSL extension must be enabled to use the NTLM authenticator.');
}
@@ -56,16 +52,16 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
// extra parameters for our unit cases
$timestamp = func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000'));
- $client = func_num_args() > 4 ? func_get_arg(4) : $this->getRandomBytes(8);
+ $client = func_num_args() > 4 ? func_get_arg(4) : random_bytes(8);
// Message 3 response
$this->sendMessage3($response, $username, $password, $timestamp, $client, $agent);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
@@ -98,15 +94,13 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
/**
* Send our auth message and returns the response.
*
- * @param Swift_Transport_SmtpAgent $agent
- *
* @return string SMTP Response
*/
protected function sendMessage1(Swift_Transport_SmtpAgent $agent)
{
$message = $this->createMessage1();
- return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), array(334));
+ return $agent->executeCommand(sprintf("AUTH %s %s\r\n", $this->getAuthKeyword(), base64_encode($message)), [334]);
}
/**
@@ -121,15 +115,15 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$responseHex = bin2hex($response);
$length = floor(hexdec(substr($responseHex, 28, 4)) / 256) * 2;
$offset = floor(hexdec(substr($responseHex, 32, 4)) / 256) * 2;
- $challenge = $this->hex2bin(substr($responseHex, 48, 16));
- $context = $this->hex2bin(substr($responseHex, 64, 16));
- $targetInfoH = $this->hex2bin(substr($responseHex, 80, 16));
- $targetName = $this->hex2bin(substr($responseHex, $offset, $length));
+ $challenge = hex2bin(substr($responseHex, 48, 16));
+ $context = hex2bin(substr($responseHex, 64, 16));
+ $targetInfoH = hex2bin(substr($responseHex, 80, 16));
+ $targetName = hex2bin(substr($responseHex, $offset, $length));
$offset = floor(hexdec(substr($responseHex, 88, 4)) / 256) * 2;
$targetInfoBlock = substr($responseHex, $offset);
list($domainName, $serverName, $DNSDomainName, $DNSServerName, $terminatorByte) = $this->readSubBlock($targetInfoBlock);
- return array(
+ return [
$challenge,
$context,
$targetInfoH,
@@ -138,16 +132,14 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$serverName,
$DNSDomainName,
$DNSServerName,
- $this->hex2bin($targetInfoBlock),
+ hex2bin($targetInfoBlock),
$terminatorByte,
- );
+ ];
}
/**
* Read the blob information in from message2.
*
- * @param $block
- *
* @return array
*/
protected function readSubBlock($block)
@@ -157,15 +149,15 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$length = strlen($block);
$offset = 0;
- $data = array();
+ $data = [];
while ($offset < $length) {
$blockLength = hexdec(substr(substr($block, $offset, 8), -4)) / 256;
$offset += 8;
- $data[] = $this->hex2bin(substr($block, $offset, $blockLength * 2));
+ $data[] = hex2bin(substr($block, $offset, $blockLength * 2));
$offset += $blockLength * 2;
}
- if (count($data) == 3) {
+ if (3 == count($data)) {
$data[] = $data[2];
$data[2] = '';
}
@@ -178,13 +170,12 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
/**
* Send our final message with all our data.
*
- * @param string $response Message 1 response (message 2)
- * @param string $username
- * @param string $password
- * @param string $timestamp
- * @param string $client
- * @param Swift_Transport_SmtpAgent $agent
- * @param bool $v2 Use version2 of the protocol
+ * @param string $response Message 1 response (message 2)
+ * @param string $username
+ * @param string $password
+ * @param string $timestamp
+ * @param string $client
+ * @param bool $v2 Use version2 of the protocol
*
* @return string
*/
@@ -208,7 +199,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$message = $this->createMessage3($domain, $username, $workstation, $lmResponse, $ntlmResponse);
- return $agent->executeCommand(sprintf("%s\r\n", base64_encode($message)), array(235));
+ return $agent->executeCommand(sprintf("%s\r\n", base64_encode($message)), [235]);
}
/**
@@ -292,18 +283,18 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function getDomainAndUsername($name)
{
- if (strpos($name, '\\') !== false) {
+ if (false !== strpos($name, '\\')) {
return explode('\\', $name);
}
if (false !== strpos($name, '@')) {
list($user, $domain) = explode('@', $name);
- return array($domain, $user);
+ return [$domain, $user];
}
// no domain passed
- return array('', $name);
+ return ['', $name];
}
/**
@@ -434,7 +425,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
protected function createDesKey($key)
{
- $material = array(bin2hex($key[0]));
+ $material = [bin2hex($key[0])];
$len = strlen($key);
for ($i = 1; $i < $len; ++$i) {
list($high, $low) = str_split(bin2hex($key[$i]));
@@ -446,9 +437,9 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
// odd parity
foreach ($material as $k => $v) {
$b = $this->castToByte(hexdec($v));
- $needsParity = (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5)
+ $needsParity = 0 == (($this->uRShift($b, 7) ^ $this->uRShift($b, 6) ^ $this->uRShift($b, 5)
^ $this->uRShift($b, 4) ^ $this->uRShift($b, 3) ^ $this->uRShift($b, 2)
- ^ $this->uRShift($b, 1)) & 0x01) == 0;
+ ^ $this->uRShift($b, 1)) & 0x01);
list($high, $low) = str_split($v);
if ($needsParity) {
@@ -458,7 +449,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
}
}
- return $this->hex2bin(implode('', $material));
+ return hex2bin(implode('', $material));
}
/** HELPER FUNCTIONS */
@@ -493,7 +484,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$length = floor(hexdec(substr($value, 0, 4)) / 256) * 2;
$offset = floor(hexdec(substr($value, 8, 4)) / 256) * 2;
- return array($length, $offset);
+ return [$length, $offset];
}
/**
@@ -519,7 +510,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function uRShift($a, $b)
{
- if ($b == 0) {
+ if (0 == $b) {
return $a;
}
@@ -538,7 +529,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
protected function createByte($input, $bytes = 4, $isHex = true)
{
if ($isHex) {
- $byte = $this->hex2bin(str_pad($input, $bytes * 2, '00'));
+ $byte = hex2bin(str_pad($input, $bytes * 2, '00'));
} else {
$byte = str_pad($input, $bytes, "\x00");
}
@@ -546,24 +537,6 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
return $byte;
}
- /**
- * Create random bytes.
- *
- * @param $length
- *
- * @return string
- */
- protected function getRandomBytes($length)
- {
- $bytes = openssl_random_pseudo_bytes($length, $strong);
-
- if (false !== $bytes && true === $strong) {
- return $bytes;
- }
-
- throw new RuntimeException('OpenSSL did not produce a secure random number.');
- }
-
/** ENCRYPTION ALGORITHMS */
/**
@@ -576,8 +549,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*/
protected function desEncrypt($value, $key)
{
- // 1 == OPENSSL_RAW_DATA - but constant is only available as of PHP 5.4.
- return substr(openssl_encrypt($value, 'DES-ECB', $key, 1), 0, 8);
+ return substr(openssl_encrypt($value, 'DES-ECB', $key, \OPENSSL_RAW_DATA), 0, 8);
}
/**
@@ -609,13 +581,13 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
*
* @return string
*
- * @see http://php.net/manual/en/ref.hash.php
+ * @see https://secure.php.net/manual/en/ref.hash.php
*/
protected function md4Encrypt($input)
{
$input = $this->convertTo16bit($input);
- return function_exists('hash') ? $this->hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
+ return function_exists('hash') ? hex2bin(hash('md4', $input)) : mhash(MHASH_MD4, $input);
}
/**
@@ -631,22 +603,6 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
}
/**
- * Hex2bin replacement for < PHP 5.4.
- *
- * @param string $hex
- *
- * @return string Binary
- */
- protected function hex2bin($hex)
- {
- if (function_exists('hex2bin')) {
- return hex2bin($hex);
- } else {
- return pack('H*', $hex);
- }
- }
-
- /**
* @param string $message
*/
protected function debug($message)
@@ -656,8 +612,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
echo substr($message, 0, 16)." NTLMSSP Signature<br />\n";
echo $messageId." Type Indicator<br />\n";
- if ($messageId == '02000000') {
- $map = array(
+ if ('02000000' == $messageId) {
+ $map = [
'Challenge',
'Context',
'Target Information Security Buffer',
@@ -668,14 +624,14 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
'DNS Server Name',
'BLOB',
'Target Information Terminator',
- );
+ ];
- $data = $this->parseMessage2($this->hex2bin($message));
+ $data = $this->parseMessage2(hex2bin($message));
foreach ($map as $key => $value) {
echo bin2hex($data[$key]).' - '.$data[$key].' ||| '.$value."<br />\n";
}
- } elseif ($messageId == '03000000') {
+ } elseif ('03000000' == $messageId) {
$i = 0;
$data[$i++] = substr($message, 24, 16);
list($lmLength, $lmOffset) = $this->readSecurityBuffer($data[$i - 1]);
@@ -700,7 +656,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
$data[$i++] = substr($message, $lmOffset, $lmLength);
$data[$i] = substr($message, $ntmlOffset, $ntmlLength);
- $map = array(
+ $map = [
'LM Response Security Buffer',
'NTLM Response Security Buffer',
'Target Name Security Buffer',
@@ -713,10 +669,10 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
'Workstation Name Data',
'LM Response Data',
'NTLM Response Data',
- );
+ ];
foreach ($map as $key => $value) {
- echo $data[$key].' - '.$this->hex2bin($data[$key]).' ||| '.$value."<br />\n";
+ echo $data[$key].' - '.hex2bin($data[$key]).' ||| '.$value."<br />\n";
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
index 43219f9344..1ff961cc37 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/PlainAuthenticator.php
@@ -26,25 +26,19 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticator implements Swift_Transport_E
}
/**
- * Try to authenticate the user with $username and $password.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $username
- * @param string $password
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password)
{
try {
$message = base64_encode($username.chr(0).$username.chr(0).$password);
- $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), array(235));
+ $agent->executeCommand(sprintf("AUTH PLAIN %s\r\n", $message), [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
index ca35e7b83a..859f22f3d5 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/XOAuth2Authenticator.php
@@ -13,7 +13,7 @@
*
* Example:
* <code>
- * $transport = Swift_SmtpTransport::newInstance('smtp.gmail.com', 587, 'tls')
+ * $transport = (new Swift_SmtpTransport('smtp.gmail.com', 587, 'tls'))
* ->setAuthMode('XOAUTH2')
* ->setUsername('YOUR_EMAIL_ADDRESS')
* ->setPassword('YOUR_ACCESS_TOKEN');
@@ -36,25 +36,19 @@ class Swift_Transport_Esmtp_Auth_XOAuth2Authenticator implements Swift_Transport
}
/**
- * Try to authenticate the user with $email and $token.
- *
- * @param Swift_Transport_SmtpAgent $agent
- * @param string $email
- * @param string $token
- *
- * @return bool
+ * {@inheritdoc}
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $email, $token)
{
try {
$param = $this->constructXOAuth2Params($email, $token);
- $agent->executeCommand('AUTH XOAUTH2 '.$param."\r\n", array(235));
+ $agent->executeCommand('AUTH XOAUTH2 '.$param."\r\n", [235]);
return true;
} catch (Swift_TransportException $e) {
- $agent->executeCommand("RSET\r\n", array(250));
+ $agent->executeCommand("RSET\r\n", [250]);
- return false;
+ throw $e;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
index cb36133c94..4798dbd14e 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php
@@ -9,7 +9,7 @@
*/
/**
- * An ESMTP handler for AUTH support.
+ * An ESMTP handler for AUTH support (RFC 5248).
*
* @author Chris Corbyn
*/
@@ -20,35 +20,35 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*
* @var Swift_Transport_Esmtp_Authenticator[]
*/
- private $_authenticators = array();
+ private $authenticators = [];
/**
* The username for authentication.
*
* @var string
*/
- private $_username;
+ private $username;
/**
* The password for authentication.
*
* @var string
*/
- private $_password;
+ private $password;
/**
* The auth mode for authentication.
*
* @var string
*/
- private $_auth_mode;
+ private $auth_mode;
/**
* The ESMTP AUTH parameters available.
*
* @var string[]
*/
- private $_esmtpParams = array();
+ private $esmtpParams = [];
/**
* Create a new AuthHandler with $authenticators for support.
@@ -67,7 +67,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function setAuthenticators(array $authenticators)
{
- $this->_authenticators = $authenticators;
+ $this->authenticators = $authenticators;
}
/**
@@ -77,7 +77,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getAuthenticators()
{
- return $this->_authenticators;
+ return $this->authenticators;
}
/**
@@ -87,7 +87,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function setUsername($username)
{
- $this->_username = $username;
+ $this->username = $username;
}
/**
@@ -97,7 +97,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getUsername()
{
- return $this->_username;
+ return $this->username;
}
/**
@@ -107,7 +107,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function setPassword($password)
{
- $this->_password = $password;
+ $this->password = $password;
}
/**
@@ -117,7 +117,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getPassword()
{
- return $this->_password;
+ return $this->password;
}
/**
@@ -127,7 +127,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function setAuthMode($mode)
{
- $this->_auth_mode = $mode;
+ $this->auth_mode = $mode;
}
/**
@@ -137,13 +137,13 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getAuthMode()
{
- return $this->_auth_mode;
+ return $this->auth_mode;
}
/**
* Get the name of the ESMTP extension this handles.
*
- * @return bool
+ * @return string
*/
public function getHandledKeyword()
{
@@ -157,7 +157,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function setKeywordParams(array $parameters)
{
- $this->_esmtpParams = $parameters;
+ $this->esmtpParams = $parameters;
}
/**
@@ -167,21 +167,28 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function afterEhlo(Swift_Transport_SmtpAgent $agent)
{
- if ($this->_username) {
+ if ($this->username) {
$count = 0;
- foreach ($this->_getAuthenticatorsForAgent() as $authenticator) {
- if (in_array(strtolower($authenticator->getAuthKeyword()),
- array_map('strtolower', $this->_esmtpParams))) {
+ $errors = [];
+ foreach ($this->getAuthenticatorsForAgent() as $authenticator) {
+ if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->esmtpParams))) {
++$count;
- if ($authenticator->authenticate($agent, $this->_username, $this->_password)) {
- return;
+ try {
+ if ($authenticator->authenticate($agent, $this->username, $this->password)) {
+ return;
+ }
+ } catch (Swift_TransportException $e) {
+ // keep the error message, but tries the other authenticators
+ $errors[] = [$authenticator->getAuthKeyword(), $e];
}
}
}
- throw new Swift_TransportException(
- 'Failed to authenticate on SMTP server with username "'.
- $this->_username.'" using '.$count.' possible authenticators'
- );
+
+ $message = 'Failed to authenticate on SMTP server with username "'.$this->username.'" using '.$count.' possible authenticators.';
+ foreach ($errors as $error) {
+ $message .= ' Authenticator '.$error[0].' returned '.$error[1].'.';
+ }
+ throw new Swift_TransportException($message);
}
}
@@ -190,7 +197,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getMailParams()
{
- return array();
+ return [];
}
/**
@@ -198,13 +205,13 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function getRcptParams()
{
- return array();
+ return [];
}
/**
* Not used.
*/
- public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false)
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
{
}
@@ -229,7 +236,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
*/
public function exposeMixinMethods()
{
- return array('setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode');
+ return ['setUsername', 'getUsername', 'setPassword', 'getPassword', 'setAuthMode', 'getAuthMode'];
}
/**
@@ -242,19 +249,17 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
/**
* Returns the authenticator list for the given agent.
*
- * @param Swift_Transport_SmtpAgent $agent
- *
* @return array
*/
- protected function _getAuthenticatorsForAgent()
+ protected function getAuthenticatorsForAgent()
{
- if (!$mode = strtolower($this->_auth_mode)) {
- return $this->_authenticators;
+ if (!$mode = strtolower($this->auth_mode)) {
+ return $this->authenticators;
}
- foreach ($this->_authenticators as $authenticator) {
+ foreach ($this->authenticators as $authenticator) {
if (strtolower($authenticator->getAuthKeyword()) == $mode) {
- return array($authenticator);
+ return [$authenticator];
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
index 12a9abf819..cadfdc6515 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Authenticator.php
@@ -29,7 +29,9 @@ interface Swift_Transport_Esmtp_Authenticator
* @param string $username
* @param string $password
*
- * @return bool
+ * @return bool true if authentication worked (returning false is deprecated, throw a Swift_TransportException instead)
+ *
+ * @throws Swift_TransportException Allows the message to bubble up when authentication was not successful
*/
public function authenticate(Swift_Transport_SmtpAgent $agent, $username, $password);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php
new file mode 100644
index 0000000000..63f7086693
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/EightBitMimeHandler.php
@@ -0,0 +1,113 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * An ESMTP handler for 8BITMIME support (RFC 6152).
+ *
+ * 8BITMIME is required when sending 8-bit content to over SMTP, e.g. when using
+ * Swift_Mime_ContentEncoder_PlainContentEncoder in "8bit" mode.
+ *
+ * 8BITMIME mode is enabled unconditionally, even when sending ASCII-only
+ * messages, so it should only be used with an outbound SMTP server that will
+ * convert the message to 7-bit MIME if the next hop does not support 8BITMIME.
+ *
+ * @author Christian Schmidt
+ */
+class Swift_Transport_Esmtp_EightBitMimeHandler implements Swift_Transport_EsmtpHandler
+{
+ protected $encoding;
+
+ /**
+ * @param string $encoding The parameter so send with the MAIL FROM command;
+ * either "8BITMIME" or "7BIT"
+ */
+ public function __construct(string $encoding = '8BITMIME')
+ {
+ $this->encoding = $encoding;
+ }
+
+ /**
+ * Get the name of the ESMTP extension this handles.
+ *
+ * @return string
+ */
+ public function getHandledKeyword()
+ {
+ return '8BITMIME';
+ }
+
+ /**
+ * Not used.
+ */
+ public function setKeywordParams(array $parameters)
+ {
+ }
+
+ /**
+ * Not used.
+ */
+ public function afterEhlo(Swift_Transport_SmtpAgent $agent)
+ {
+ }
+
+ /**
+ * Get params which are appended to MAIL FROM:<>.
+ *
+ * @return string[]
+ */
+ public function getMailParams()
+ {
+ return ['BODY='.$this->encoding];
+ }
+
+ /**
+ * Not used.
+ */
+ public function getRcptParams()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
+ {
+ }
+
+ /**
+ * Returns +1, -1 or 0 according to the rules for usort().
+ *
+ * This method is called to ensure extensions can be execute in an appropriate order.
+ *
+ * @param string $esmtpKeyword to compare with
+ *
+ * @return int
+ */
+ public function getPriorityOver($esmtpKeyword)
+ {
+ return 0;
+ }
+
+ /**
+ * Not used.
+ */
+ public function exposeMixinMethods()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function resetState()
+ {
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php
new file mode 100644
index 0000000000..7d0252a01b
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/SmtpUtf8Handler.php
@@ -0,0 +1,107 @@
+<?php
+
+/*
+ * This file is part of SwiftMailer.
+ * (c) 2018 Christian Schmidt
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * An ESMTP handler for SMTPUTF8 support (RFC 6531).
+ *
+ * SMTPUTF8 is required when sending to email addresses containing non-ASCII
+ * characters in local-part (the substring before @). This handler should be
+ * used together with Swift_AddressEncoder_Utf8AddressEncoder.
+ *
+ * SMTPUTF8 mode is enabled unconditionally, even when sending to ASCII-only
+ * addresses, so it should only be used with an outbound SMTP server that will
+ * deliver ASCII-only messages even if the next hop does not support SMTPUTF8.
+ *
+ * @author Christian Schmidt
+ */
+class Swift_Transport_Esmtp_SmtpUtf8Handler implements Swift_Transport_EsmtpHandler
+{
+ public function __construct()
+ {
+ }
+
+ /**
+ * Get the name of the ESMTP extension this handles.
+ *
+ * @return string
+ */
+ public function getHandledKeyword()
+ {
+ return 'SMTPUTF8';
+ }
+
+ /**
+ * Not used.
+ */
+ public function setKeywordParams(array $parameters)
+ {
+ }
+
+ /**
+ * Not used.
+ */
+ public function afterEhlo(Swift_Transport_SmtpAgent $agent)
+ {
+ }
+
+ /**
+ * Get params which are appended to MAIL FROM:<>.
+ *
+ * @return string[]
+ */
+ public function getMailParams()
+ {
+ return ['SMTPUTF8'];
+ }
+
+ /**
+ * Not used.
+ */
+ public function getRcptParams()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false)
+ {
+ }
+
+ /**
+ * Returns +1, -1 or 0 according to the rules for usort().
+ *
+ * This method is called to ensure extensions can be execute in an appropriate order.
+ *
+ * @param string $esmtpKeyword to compare with
+ *
+ * @return int
+ */
+ public function getPriorityOver($esmtpKeyword)
+ {
+ return 0;
+ }
+
+ /**
+ * Not used.
+ */
+ public function exposeMixinMethods()
+ {
+ return [];
+ }
+
+ /**
+ * Not used.
+ */
+ public function resetState()
+ {
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
index c17ef8feb3..b8ea36e2fa 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpHandler.php
@@ -18,7 +18,7 @@ interface Swift_Transport_EsmtpHandler
/**
* Get the name of the ESMTP extension this handles.
*
- * @return bool
+ * @return string
*/
public function getHandledKeyword();
@@ -59,7 +59,7 @@ interface Swift_Transport_EsmtpHandler
* @param string[] $failedRecipients to collect failures
* @param bool $stop to be set true by-reference if the command is now sent
*/
- public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = array(), &$failedRecipients = null, &$stop = false);
+ public function onCommand(Swift_Transport_SmtpAgent $agent, $command, $codes = [], &$failedRecipients = null, &$stop = false);
/**
* Returns +1, -1 or 0 according to the rules for usort().
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
index 156e2cf5b0..d1f1c2cf7a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php
@@ -20,21 +20,21 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*
* @var Swift_Transport_EsmtpHandler[]
*/
- private $_handlers = array();
+ private $handlers = [];
/**
* ESMTP capabilities.
*
* @var string[]
*/
- private $_capabilities = array();
+ private $capabilities = [];
/**
* Connection buffer parameters.
*
* @var array
*/
- private $_params = array(
+ private $params = [
'protocol' => 'tcp',
'host' => 'localhost',
'port' => 25,
@@ -42,32 +42,33 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
'blocking' => 1,
'tls' => false,
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
- 'stream_context_options' => array(),
- );
+ 'stream_context_options' => [],
+ ];
/**
* Creates a new EsmtpTransport using the given I/O buffer.
*
- * @param Swift_Transport_IoBuffer $buf
* @param Swift_Transport_EsmtpHandler[] $extensionHandlers
- * @param Swift_Events_EventDispatcher $dispatcher
+ * @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher)
+ public function __construct(Swift_Transport_IoBuffer $buf, array $extensionHandlers, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- parent::__construct($buf, $dispatcher);
+ parent::__construct($buf, $dispatcher, $localDomain, $addressEncoder);
$this->setExtensionHandlers($extensionHandlers);
}
/**
* Set the host to connect to.
*
+ * Literal IPv6 addresses should be wrapped in square brackets.
+ *
* @param string $host
*
* @return $this
*/
public function setHost($host)
{
- $this->_params['host'] = $host;
+ $this->params['host'] = $host;
return $this;
}
@@ -79,7 +80,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getHost()
{
- return $this->_params['host'];
+ return $this->params['host'];
}
/**
@@ -91,7 +92,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setPort($port)
{
- $this->_params['port'] = (int) $port;
+ $this->params['port'] = (int) $port;
return $this;
}
@@ -103,7 +104,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getPort()
{
- return $this->_params['port'];
+ return $this->params['port'];
}
/**
@@ -115,8 +116,8 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setTimeout($timeout)
{
- $this->_params['timeout'] = (int) $timeout;
- $this->_buffer->setParam('timeout', (int) $timeout);
+ $this->params['timeout'] = (int) $timeout;
+ $this->buffer->setParam('timeout', (int) $timeout);
return $this;
}
@@ -128,7 +129,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getTimeout()
{
- return $this->_params['timeout'];
+ return $this->params['timeout'];
}
/**
@@ -142,11 +143,11 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
{
$encryption = strtolower($encryption);
if ('tls' == $encryption) {
- $this->_params['protocol'] = 'tcp';
- $this->_params['tls'] = true;
+ $this->params['protocol'] = 'tcp';
+ $this->params['tls'] = true;
} else {
- $this->_params['protocol'] = $encryption;
- $this->_params['tls'] = false;
+ $this->params['protocol'] = $encryption;
+ $this->params['tls'] = false;
}
return $this;
@@ -159,7 +160,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getEncryption()
{
- return $this->_params['tls'] ? 'tls' : $this->_params['protocol'];
+ return $this->params['tls'] ? 'tls' : $this->params['protocol'];
}
/**
@@ -171,7 +172,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setStreamOptions($options)
{
- $this->_params['stream_context_options'] = $options;
+ $this->params['stream_context_options'] = $options;
return $this;
}
@@ -183,19 +184,21 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getStreamOptions()
{
- return $this->_params['stream_context_options'];
+ return $this->params['stream_context_options'];
}
/**
* Sets the source IP.
*
+ * IPv6 addresses should be wrapped in square brackets.
+ *
* @param string $source
*
* @return $this
*/
public function setSourceIp($source)
{
- $this->_params['sourceIp'] = $source;
+ $this->params['sourceIp'] = $source;
return $this;
}
@@ -207,7 +210,36 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getSourceIp()
{
- return isset($this->_params['sourceIp']) ? $this->_params['sourceIp'] : null;
+ return $this->params['sourceIp'] ?? null;
+ }
+
+ /**
+ * Sets whether SMTP pipelining is enabled.
+ *
+ * By default, support is auto-detected using the PIPELINING SMTP extension.
+ * Use this function to override that in the unlikely event of compatibility
+ * issues.
+ *
+ * @param bool $enabled
+ *
+ * @return $this
+ */
+ public function setPipelining($enabled)
+ {
+ $this->pipelining = $enabled;
+
+ return $this;
+ }
+
+ /**
+ * Returns whether SMTP pipelining is enabled.
+ *
+ * @return bool|null a boolean if pipelining is explicitly enabled or disabled,
+ * or null if support is auto-detected.
+ */
+ public function getPipelining()
+ {
+ return $this->pipelining;
}
/**
@@ -219,14 +251,15 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function setExtensionHandlers(array $handlers)
{
- $assoc = array();
+ $assoc = [];
foreach ($handlers as $handler) {
$assoc[$handler->getHandledKeyword()] = $handler;
}
-
- @uasort($assoc, array($this, '_sortHandlers'));
- $this->_handlers = $assoc;
- $this->_setHandlerParams();
+ uasort($assoc, function ($a, $b) {
+ return $a->getPriorityOver($b->getHandledKeyword());
+ });
+ $this->handlers = $assoc;
+ $this->setHandlerParams();
return $this;
}
@@ -238,7 +271,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
*/
public function getExtensionHandlers()
{
- return array_values($this->_handlers);
+ return array_values($this->handlers);
}
/**
@@ -250,15 +283,17 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
* @param string $command
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
+ * @param bool $pipeline Do not wait for response
+ * @param string $address The address, if command is RCPT TO.
*
- * @return string
+ * @return string|null The server response, or null if pipelining is enabled
*/
- public function executeCommand($command, $codes = array(), &$failures = null)
+ public function executeCommand($command, $codes = [], &$failures = null, $pipeline = false, $address = null)
{
$failures = (array) $failures;
$stopSignal = false;
$response = null;
- foreach ($this->_getActiveHandlers() as $handler) {
+ foreach ($this->getActiveHandlers() as $handler) {
$response = $handler->onCommand(
$this, $command, $codes, $failures, $stopSignal
);
@@ -267,19 +302,19 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
}
}
- return parent::executeCommand($command, $codes, $failures);
+ return parent::executeCommand($command, $codes, $failures, $pipeline, $address);
}
/** Mixin handling method for ESMTP handlers */
public function __call($method, $args)
{
- foreach ($this->_handlers as $handler) {
+ foreach ($this->handlers as $handler) {
if (in_array(strtolower($method),
array_map('strtolower', (array) $handler->exposeMixinMethods())
)) {
- $return = call_user_func_array(array($handler, $method), $args);
+ $return = call_user_func_array([$handler, $method], $args);
// Allow fluid method calls
- if (null === $return && substr($method, 0, 3) == 'set') {
+ if (null === $return && 'set' == substr($method, 0, 3)) {
return $this;
} else {
return $return;
@@ -290,81 +325,87 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
}
/** Get the params to initialize the buffer */
- protected function _getBufferParams()
+ protected function getBufferParams()
{
- return $this->_params;
+ return $this->params;
}
/** Overridden to perform EHLO instead */
- protected function _doHeloCommand()
+ protected function doHeloCommand()
{
try {
$response = $this->executeCommand(
- sprintf("EHLO %s\r\n", $this->_domain), array(250)
+ sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
- return parent::_doHeloCommand();
+ return parent::doHeloCommand();
}
- if ($this->_params['tls']) {
+ if ($this->params['tls']) {
try {
- $this->executeCommand("STARTTLS\r\n", array(220));
+ $this->executeCommand("STARTTLS\r\n", [220]);
- if (!$this->_buffer->startTLS()) {
+ if (!$this->buffer->startTLS()) {
throw new Swift_TransportException('Unable to connect with TLS encryption');
}
try {
$response = $this->executeCommand(
- sprintf("EHLO %s\r\n", $this->_domain), array(250)
+ sprintf("EHLO %s\r\n", $this->domain), [250]
);
} catch (Swift_TransportException $e) {
- return parent::_doHeloCommand();
+ return parent::doHeloCommand();
}
} catch (Swift_TransportException $e) {
- $this->_throwException($e);
+ $this->throwException($e);
}
}
- $this->_capabilities = $this->_getCapabilities($response);
- $this->_setHandlerParams();
- foreach ($this->_getActiveHandlers() as $handler) {
+ $this->capabilities = $this->getCapabilities($response);
+ if (!isset($this->pipelining)) {
+ $this->pipelining = isset($this->capabilities['PIPELINING']);
+ }
+
+ $this->setHandlerParams();
+ foreach ($this->getActiveHandlers() as $handler) {
$handler->afterEhlo($this);
}
}
/** Overridden to add Extension support */
- protected function _doMailFromCommand($address)
+ protected function doMailFromCommand($address)
{
- $handlers = $this->_getActiveHandlers();
- $params = array();
+ $address = $this->addressEncoder->encodeString($address);
+ $handlers = $this->getActiveHandlers();
+ $params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getMailParams());
}
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
$this->executeCommand(
- sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), array(250)
+ sprintf("MAIL FROM:<%s>%s\r\n", $address, $paramStr), [250], $failures, true
);
}
/** Overridden to add Extension support */
- protected function _doRcptToCommand($address)
+ protected function doRcptToCommand($address)
{
- $handlers = $this->_getActiveHandlers();
- $params = array();
+ $address = $this->addressEncoder->encodeString($address);
+ $handlers = $this->getActiveHandlers();
+ $params = [];
foreach ($handlers as $handler) {
$params = array_merge($params, (array) $handler->getRcptParams());
}
$paramStr = !empty($params) ? ' '.implode(' ', $params) : '';
$this->executeCommand(
- sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), array(250, 251, 252)
+ sprintf("RCPT TO:<%s>%s\r\n", $address, $paramStr), [250, 251, 252], $failures, true, $address
);
}
/** Determine ESMTP capabilities by function group */
- private function _getCapabilities($ehloResponse)
+ private function getCapabilities($ehloResponse)
{
- $capabilities = array();
+ $capabilities = [];
$ehloResponse = trim($ehloResponse);
$lines = explode("\r\n", $ehloResponse);
array_shift($lines);
@@ -372,7 +413,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
if (preg_match('/^[0-9]{3}[ -]([A-Z0-9-]+)((?:[ =].*)?)$/Di', $line, $matches)) {
$keyword = strtoupper($matches[1]);
$paramStr = strtoupper(ltrim($matches[2], ' ='));
- $params = !empty($paramStr) ? explode(' ', $paramStr) : array();
+ $params = !empty($paramStr) ? explode(' ', $paramStr) : [];
$capabilities[$keyword] = $params;
}
}
@@ -381,31 +422,25 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
}
/** Set parameters which are used by each extension handler */
- private function _setHandlerParams()
+ private function setHandlerParams()
{
- foreach ($this->_handlers as $keyword => $handler) {
- if (array_key_exists($keyword, $this->_capabilities)) {
- $handler->setKeywordParams($this->_capabilities[$keyword]);
+ foreach ($this->handlers as $keyword => $handler) {
+ if (array_key_exists($keyword, $this->capabilities)) {
+ $handler->setKeywordParams($this->capabilities[$keyword]);
}
}
}
/** Get ESMTP handlers which are currently ok to use */
- private function _getActiveHandlers()
+ private function getActiveHandlers()
{
- $handlers = array();
- foreach ($this->_handlers as $keyword => $handler) {
- if (array_key_exists($keyword, $this->_capabilities)) {
+ $handlers = [];
+ foreach ($this->handlers as $keyword => $handler) {
+ if (array_key_exists($keyword, $this->capabilities)) {
$handlers[] = $handler;
}
}
return $handlers;
}
-
- /** Custom sort for extension handler ordering */
- private function _sortHandlers($a, $b)
- {
- return $a->getPriorityOver($b->getHandledKeyword());
- }
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
index 311a0f2add..21bce4b607 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/FailoverTransport.php
@@ -20,7 +20,7 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
*
* @var Swift_Transport
*/
- private $_currentTransport;
+ private $currentTransport;
// needed as __construct is called from elsewhere explicitly
public function __construct()
@@ -29,40 +29,57 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
}
/**
+ * {@inheritdoc}
+ */
+ public function ping()
+ {
+ $maxTransports = count($this->transports);
+ for ($i = 0; $i < $maxTransports
+ && $transport = $this->getNextTransport(); ++$i) {
+ if ($transport->ping()) {
+ return true;
+ } else {
+ $this->killCurrentTransport();
+ }
+ }
+
+ return count($this->transports) > 0;
+ }
+
+ /**
* Send the given Message.
*
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- $maxTransports = count($this->_transports);
+ $maxTransports = count($this->transports);
$sent = 0;
- $this->_lastUsedTransport = null;
+ $this->lastUsedTransport = null;
for ($i = 0; $i < $maxTransports
- && $transport = $this->_getNextTransport(); ++$i) {
+ && $transport = $this->getNextTransport(); ++$i) {
try {
if (!$transport->isStarted()) {
$transport->start();
}
if ($sent = $transport->send($message, $failedRecipients)) {
- $this->_lastUsedTransport = $transport;
+ $this->lastUsedTransport = $transport;
return $sent;
}
} catch (Swift_TransportException $e) {
- $this->_killCurrentTransport();
+ $this->killCurrentTransport();
}
}
- if (count($this->_transports) == 0) {
+ if (0 == count($this->transports)) {
throw new Swift_TransportException(
'All Transports in FailoverTransport failed, or no Transports available'
);
@@ -71,18 +88,18 @@ class Swift_Transport_FailoverTransport extends Swift_Transport_LoadBalancedTran
return $sent;
}
- protected function _getNextTransport()
+ protected function getNextTransport()
{
- if (!isset($this->_currentTransport)) {
- $this->_currentTransport = parent::_getNextTransport();
+ if (!isset($this->currentTransport)) {
+ $this->currentTransport = parent::getNextTransport();
}
- return $this->_currentTransport;
+ return $this->currentTransport;
}
- protected function _killCurrentTransport()
+ protected function killCurrentTransport()
{
- $this->_currentTransport = null;
- parent::_killCurrentTransport();
+ $this->currentTransport = null;
+ parent::killCurrentTransport();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
index e2adc567e4..a12ce8d2da 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/LoadBalancedTransport.php
@@ -20,21 +20,21 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*
* @var Swift_Transport[]
*/
- private $_deadTransports = array();
+ private $deadTransports = [];
/**
* The Transports which are used in rotation.
*
* @var Swift_Transport[]
*/
- protected $_transports = array();
+ protected $transports = [];
/**
* The Transport used in the last successful send operation.
*
* @var Swift_Transport
*/
- protected $_lastUsedTransport = null;
+ protected $lastUsedTransport = null;
// needed as __construct is called from elsewhere explicitly
public function __construct()
@@ -48,8 +48,8 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function setTransports(array $transports)
{
- $this->_transports = $transports;
- $this->_deadTransports = array();
+ $this->transports = $transports;
+ $this->deadTransports = [];
}
/**
@@ -59,7 +59,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function getTransports()
{
- return array_merge($this->_transports, $this->_deadTransports);
+ return array_merge($this->transports, $this->deadTransports);
}
/**
@@ -69,7 +69,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function getLastUsedTransport()
{
- return $this->_lastUsedTransport;
+ return $this->lastUsedTransport;
}
/**
@@ -79,7 +79,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function isStarted()
{
- return count($this->_transports) > 0;
+ return count($this->transports) > 0;
}
/**
@@ -87,7 +87,7 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function start()
{
- $this->_transports = array_merge($this->_transports, $this->_deadTransports);
+ $this->transports = array_merge($this->transports, $this->deadTransports);
}
/**
@@ -95,44 +95,57 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*/
public function stop()
{
- foreach ($this->_transports as $transport) {
+ foreach ($this->transports as $transport) {
$transport->stop();
}
}
/**
+ * {@inheritdoc}
+ */
+ public function ping()
+ {
+ foreach ($this->transports as $transport) {
+ if (!$transport->ping()) {
+ $this->killCurrentTransport();
+ }
+ }
+
+ return count($this->transports) > 0;
+ }
+
+ /**
* Send the given Message.
*
* Recipient/sender data will be retrieved from the Message API.
* The return value is the number of recipients who were accepted for delivery.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- $maxTransports = count($this->_transports);
+ $maxTransports = count($this->transports);
$sent = 0;
- $this->_lastUsedTransport = null;
+ $this->lastUsedTransport = null;
for ($i = 0; $i < $maxTransports
- && $transport = $this->_getNextTransport(); ++$i) {
+ && $transport = $this->getNextTransport(); ++$i) {
try {
if (!$transport->isStarted()) {
$transport->start();
}
if ($sent = $transport->send($message, $failedRecipients)) {
- $this->_lastUsedTransport = $transport;
+ $this->lastUsedTransport = $transport;
break;
}
} catch (Swift_TransportException $e) {
- $this->_killCurrentTransport();
+ $this->killCurrentTransport();
}
}
- if (count($this->_transports) == 0) {
+ if (0 == count($this->transports)) {
throw new Swift_TransportException(
'All Transports in LoadBalancedTransport failed, or no Transports available'
);
@@ -143,12 +156,10 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
- foreach ($this->_transports as $transport) {
+ foreach ($this->transports as $transport) {
$transport->registerPlugin($plugin);
}
}
@@ -158,10 +169,10 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
*
* @return Swift_Transport
*/
- protected function _getNextTransport()
+ protected function getNextTransport()
{
- if ($next = array_shift($this->_transports)) {
- $this->_transports[] = $next;
+ if ($next = array_shift($this->transports)) {
+ $this->transports[] = $next;
}
return $next;
@@ -170,14 +181,14 @@ class Swift_Transport_LoadBalancedTransport implements Swift_Transport
/**
* Tag the currently used (top of stack) transport as dead/useless.
*/
- protected function _killCurrentTransport()
+ protected function killCurrentTransport()
{
- if ($transport = array_pop($this->_transports)) {
+ if ($transport = array_pop($this->transports)) {
try {
$transport->stop();
} catch (Exception $e) {
}
- $this->_deadTransports[] = $transport;
+ $this->deadTransports[] = $transport;
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php
deleted file mode 100644
index 77489cedc6..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailInvoker.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * This interface intercepts calls to the mail() function.
- *
- * @author Chris Corbyn
- */
-interface Swift_Transport_MailInvoker
-{
- /**
- * Send mail via the mail() function.
- *
- * This method takes the same arguments as PHP mail().
- *
- * @param string $to
- * @param string $subject
- * @param string $body
- * @param string $headers
- * @param string $extraParams
- *
- * @return bool
- */
- public function mail($to, $subject, $body, $headers = null, $extraParams = null);
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php
deleted file mode 100644
index 48ef4a702e..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/MailTransport.php
+++ /dev/null
@@ -1,297 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Sends Messages using the mail() function.
- *
- * It is advised that users do not use this transport if at all possible
- * since a number of plugin features cannot be used in conjunction with this
- * transport due to the internal interface in PHP itself.
- *
- * The level of error reporting with this transport is incredibly weak, again
- * due to limitations of PHP's internal mail() function. You'll get an
- * all-or-nothing result from sending.
- *
- * @author Chris Corbyn
- *
- * @deprecated since 5.4.5 (to be removed in 6.0)
- */
-class Swift_Transport_MailTransport implements Swift_Transport
-{
- /** Additional parameters to pass to mail() */
- private $_extraParams = '-f%s';
-
- /** The event dispatcher from the plugin API */
- private $_eventDispatcher;
-
- /** An invoker that calls the mail() function */
- private $_invoker;
-
- /**
- * Create a new MailTransport with the $log.
- *
- * @param Swift_Transport_MailInvoker $invoker
- * @param Swift_Events_EventDispatcher $eventDispatcher
- */
- public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher)
- {
- @trigger_error(sprintf('The %s class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead.', __CLASS__), E_USER_DEPRECATED);
-
- $this->_invoker = $invoker;
- $this->_eventDispatcher = $eventDispatcher;
- }
-
- /**
- * Not used.
- */
- public function isStarted()
- {
- return false;
- }
-
- /**
- * Not used.
- */
- public function start()
- {
- }
-
- /**
- * Not used.
- */
- public function stop()
- {
- }
-
- /**
- * Set the additional parameters used on the mail() function.
- *
- * This string is formatted for sprintf() where %s is the sender address.
- *
- * @param string $params
- *
- * @return $this
- */
- public function setExtraParams($params)
- {
- $this->_extraParams = $params;
-
- return $this;
- }
-
- /**
- * Get the additional parameters used on the mail() function.
- *
- * This string is formatted for sprintf() where %s is the sender address.
- *
- * @return string
- */
- public function getExtraParams()
- {
- return $this->_extraParams;
- }
-
- /**
- * Send the given Message.
- *
- * Recipient/sender data will be retrieved from the Message API.
- * The return value is the number of recipients who were accepted for delivery.
- *
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
- *
- * @return int
- */
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
- {
- $failedRecipients = (array) $failedRecipients;
-
- if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
- if ($evt->bubbleCancelled()) {
- return 0;
- }
- }
-
- $count = (
- count((array) $message->getTo())
- + count((array) $message->getCc())
- + count((array) $message->getBcc())
- );
-
- $toHeader = $message->getHeaders()->get('To');
- $subjectHeader = $message->getHeaders()->get('Subject');
-
- if (0 === $count) {
- $this->_throwException(new Swift_TransportException('Cannot send message without a recipient'));
- }
- $to = $toHeader ? $toHeader->getFieldBody() : '';
- $subject = $subjectHeader ? $subjectHeader->getFieldBody() : '';
-
- $reversePath = $this->_getReversePath($message);
-
- // Remove headers that would otherwise be duplicated
- $message->getHeaders()->remove('To');
- $message->getHeaders()->remove('Subject');
-
- $messageStr = $message->toString();
-
- if ($toHeader) {
- $message->getHeaders()->set($toHeader);
- }
- $message->getHeaders()->set($subjectHeader);
-
- // Separate headers from body
- if (false !== $endHeaders = strpos($messageStr, "\r\n\r\n")) {
- $headers = substr($messageStr, 0, $endHeaders)."\r\n"; //Keep last EOL
- $body = substr($messageStr, $endHeaders + 4);
- } else {
- $headers = $messageStr."\r\n";
- $body = '';
- }
-
- unset($messageStr);
-
- if ("\r\n" != PHP_EOL) {
- // Non-windows (not using SMTP)
- $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))) {
- if ($evt) {
- $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
- $evt->setFailedRecipients($failedRecipients);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
- }
- } else {
- $failedRecipients = array_merge(
- $failedRecipients,
- array_keys((array) $message->getTo()),
- array_keys((array) $message->getCc()),
- array_keys((array) $message->getBcc())
- );
-
- if ($evt) {
- $evt->setResult(Swift_Events_SendEvent::RESULT_FAILED);
- $evt->setFailedRecipients($failedRecipients);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
- }
-
- $message->generateId();
-
- $count = 0;
- }
-
- return $count;
- }
-
- /**
- * Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
- */
- public function registerPlugin(Swift_Events_EventListener $plugin)
- {
- $this->_eventDispatcher->bindEventListener($plugin);
- }
-
- /** Throw a TransportException, first sending it to any listeners */
- protected function _throwException(Swift_TransportException $e)
- {
- if ($evt = $this->_eventDispatcher->createTransportExceptionEvent($this, $e)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'exceptionThrown');
- if (!$evt->bubbleCancelled()) {
- throw $e;
- }
- } else {
- throw $e;
- }
- }
-
- /** Determine the best-use reverse path for this message */
- private function _getReversePath(Swift_Mime_Message $message)
- {
- $return = $message->getReturnPath();
- $sender = $message->getSender();
- $from = $message->getFrom();
- $path = null;
- if (!empty($return)) {
- $path = $return;
- } elseif (!empty($sender)) {
- $keys = array_keys($sender);
- $path = array_shift($keys);
- } elseif (!empty($from)) {
- $keys = array_keys($from);
- $path = array_shift($keys);
- }
-
- return $path;
- }
-
- /**
- * Fix CVE-2016-10074 by disallowing potentially unsafe shell characters.
- *
- * Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
- *
- * @param string $string The string to be validated
- *
- * @return bool
- */
- private function _isShellSafe($string)
- {
- // Future-proof
- if (escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))) {
- return false;
- }
-
- $length = strlen($string);
- for ($i = 0; $i < $length; ++$i) {
- $c = $string[$i];
- // All other characters have a special meaning in at least one common shell, including = and +.
- // Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
- // Note that this does permit non-Latin alphanumeric characters based on the current locale.
- if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Return php mail extra params to use for invoker->mail.
- *
- * @param $extraParams
- * @param $reversePath
- *
- * @return string|null
- */
- private function _formatExtraParams($extraParams, $reversePath)
- {
- if (false !== strpos($extraParams, '-f%s')) {
- if (empty($reversePath) || false === $this->_isShellSafe($reversePath)) {
- $extraParams = str_replace('-f%s', '', $extraParams);
- } else {
- $extraParams = sprintf($extraParams, $reversePath);
- }
- }
-
- return !empty($extraParams) ? $extraParams : null;
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
index ad20e0e535..5934ca93b3 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/NullTransport.php
@@ -16,14 +16,14 @@
class Swift_Transport_NullTransport implements Swift_Transport
{
/** The event dispatcher from the plugin API */
- private $_eventDispatcher;
+ private $eventDispatcher;
/**
* Constructor.
*/
public function __construct(Swift_Events_EventDispatcher $eventDispatcher)
{
- $this->_eventDispatcher = $eventDispatcher;
+ $this->eventDispatcher = $eventDispatcher;
}
/**
@@ -51,17 +51,24 @@ class Swift_Transport_NullTransport implements Swift_Transport
}
/**
+ * {@inheritdoc}
+ */
+ public function ping()
+ {
+ return true;
+ }
+
+ /**
* Sends the given message.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent emails
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
+ if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
if ($evt->bubbleCancelled()) {
return 0;
}
@@ -69,7 +76,7 @@ class Swift_Transport_NullTransport implements Swift_Transport
if ($evt) {
$evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed');
}
$count = (
@@ -83,11 +90,9 @@ class Swift_Transport_NullTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
- $this->_eventDispatcher->bindEventListener($plugin);
+ $this->eventDispatcher->bindEventListener($plugin);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
index 6430d5f6b3..7f0476adaf 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SendmailTransport.php
@@ -24,22 +24,21 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
*
* @var array
*/
- private $_params = array(
+ private $params = [
'timeout' => 30,
'blocking' => 1,
'command' => '/usr/sbin/sendmail -bs',
'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,
- );
+ ];
/**
* Create a new SendmailTransport with $buf for I/O.
*
- * @param Swift_Transport_IoBuffer $buf
- * @param Swift_Events_EventDispatcher $dispatcher
+ * @param string $localDomain
*/
- public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher)
+ public function __construct(Swift_Transport_IoBuffer $buf, Swift_Events_EventDispatcher $dispatcher, $localDomain = '127.0.0.1', Swift_AddressEncoder $addressEncoder = null)
{
- parent::__construct($buf, $dispatcher);
+ parent::__construct($buf, $dispatcher, $localDomain, $addressEncoder);
}
/**
@@ -68,7 +67,7 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
*/
public function setCommand($command)
{
- $this->_params['command'] = $command;
+ $this->params['command'] = $command;
return $this;
}
@@ -80,7 +79,7 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
*/
public function getCommand()
{
- return $this->_params['command'];
+ return $this->params['command'];
}
/**
@@ -92,12 +91,11 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
* NOTE: If using 'sendmail -t' you will not be aware of any failures until
* they bounce (i.e. send() will always return 100% success).
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
$failedRecipients = (array) $failedRecipients;
$command = $this->getCommand();
@@ -105,23 +103,23 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
$count = 0;
if (false !== strpos($command, ' -t')) {
- if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
+ if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
if ($evt->bubbleCancelled()) {
return 0;
}
}
if (false === strpos($command, ' -f')) {
- $command .= ' -f'.escapeshellarg($this->_getReversePath($message));
+ $command .= ' -f'.escapeshellarg($this->getReversePath($message));
}
- $buffer->initialize(array_merge($this->_params, array('command' => $command)));
+ $buffer->initialize(array_merge($this->params, ['command' => $command]));
if (false === strpos($command, ' -i') && false === strpos($command, ' -oi')) {
- $buffer->setWriteTranslations(array("\r\n" => "\n", "\n." => "\n.."));
+ $buffer->setWriteTranslations(["\r\n" => "\n", "\n." => "\n.."]);
} else {
- $buffer->setWriteTranslations(array("\r\n" => "\n"));
+ $buffer->setWriteTranslations(["\r\n" => "\n"]);
}
$count = count((array) $message->getTo())
@@ -130,20 +128,20 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
;
$message->toByteStream($buffer);
$buffer->flushBuffers();
- $buffer->setWriteTranslations(array());
+ $buffer->setWriteTranslations([]);
$buffer->terminate();
if ($evt) {
$evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS);
$evt->setFailedRecipients($failedRecipients);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed');
}
$message->generateId();
} elseif (false !== strpos($command, ' -bs')) {
$count = parent::send($message, $failedRecipients);
} else {
- $this->_throwException(new Swift_TransportException(
+ $this->throwException(new Swift_TransportException(
'Unsupported sendmail command flags ['.$command.']. '.
'Must be one of "-bs" or "-t" but can include additional flags.'
));
@@ -153,8 +151,8 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
}
/** Get the params to initialize the buffer */
- protected function _getBufferParams()
+ protected function getBufferParams()
{
- return $this->_params;
+ return $this->params;
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php
deleted file mode 100644
index 4cab66bd6b..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SimpleMailInvoker.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * This is the implementation class for {@link Swift_Transport_MailInvoker}.
- *
- * @author Chris Corbyn
- */
-class Swift_Transport_SimpleMailInvoker implements Swift_Transport_MailInvoker
-{
- /**
- * Send mail via the mail() function.
- *
- * This method takes the same arguments as PHP mail().
- *
- * @param string $to
- * @param string $subject
- * @param string $body
- * @param string $headers
- * @param string $extraParams
- *
- * @return bool
- */
- public function mail($to, $subject, $body, $headers = null, $extraParams = null)
- {
- if (!ini_get('safe_mode')) {
- return @mail($to, $subject, $body, $headers, $extraParams);
- }
-
- return @mail($to, $subject, $body, $headers);
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
index 90e913f8ed..e8ce65c264 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SmtpAgent.php
@@ -32,5 +32,5 @@ interface Swift_Transport_SmtpAgent
* @param int[] $codes
* @param string[] $failures An array of failures by-reference
*/
- public function executeCommand($command, $codes = array(), &$failures = null);
+ public function executeCommand($command, $codes = [], &$failures = null);
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
index e4b87f3479..0cb6a5b80a 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/SpoolTransport.php
@@ -16,30 +16,28 @@
class Swift_Transport_SpoolTransport implements Swift_Transport
{
/** The spool instance */
- private $_spool;
+ private $spool;
/** The event dispatcher from the plugin API */
- private $_eventDispatcher;
+ private $eventDispatcher;
/**
* Constructor.
*/
public function __construct(Swift_Events_EventDispatcher $eventDispatcher, Swift_Spool $spool = null)
{
- $this->_eventDispatcher = $eventDispatcher;
- $this->_spool = $spool;
+ $this->eventDispatcher = $eventDispatcher;
+ $this->spool = $spool;
}
/**
* Sets the spool object.
*
- * @param Swift_Spool $spool
- *
* @return $this
*/
public function setSpool(Swift_Spool $spool)
{
- $this->_spool = $spool;
+ $this->spool = $spool;
return $this;
}
@@ -51,7 +49,7 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
*/
public function getSpool()
{
- return $this->_spool;
+ return $this->spool;
}
/**
@@ -79,27 +77,34 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
}
/**
+ * {@inheritdoc}
+ */
+ public function ping()
+ {
+ return true;
+ }
+
+ /**
* Sends the given message.
*
- * @param Swift_Mime_Message $message
- * @param string[] $failedRecipients An array of failures by-reference
+ * @param string[] $failedRecipients An array of failures by-reference
*
* @return int The number of sent e-mail's
*/
- public function send(Swift_Mime_Message $message, &$failedRecipients = null)
+ public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
{
- if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
- $this->_eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
+ if ($evt = $this->eventDispatcher->createSendEvent($this, $message)) {
+ $this->eventDispatcher->dispatchEvent($evt, 'beforeSendPerformed');
if ($evt->bubbleCancelled()) {
return 0;
}
}
- $success = $this->_spool->queueMessage($message);
+ $success = $this->spool->queueMessage($message);
if ($evt) {
$evt->setResult($success ? Swift_Events_SendEvent::RESULT_SPOOLED : Swift_Events_SendEvent::RESULT_FAILED);
- $this->_eventDispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->eventDispatcher->dispatchEvent($evt, 'sendPerformed');
}
return 1;
@@ -107,11 +112,9 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
/**
* Register a plugin.
- *
- * @param Swift_Events_EventListener $plugin
*/
public function registerPlugin(Swift_Events_EventListener $plugin)
{
- $this->_eventDispatcher->bindEventListener($plugin);
+ $this->eventDispatcher->bindEventListener($plugin);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
index 3a9fe76b24..ab17f5c9bb 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php
@@ -11,55 +11,51 @@
/**
* A generic IoBuffer implementation supporting remote sockets and local processes.
*
- * @author Chris Corbyn
+ * @author Chris Corbyn
*/
class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableInputStream implements Swift_Transport_IoBuffer
{
/** A primary socket */
- private $_stream;
+ private $stream;
/** The input stream */
- private $_in;
+ private $in;
/** The output stream */
- private $_out;
+ private $out;
/** Buffer initialization parameters */
- private $_params = array();
+ private $params = [];
/** The ReplacementFilterFactory */
- private $_replacementFactory;
+ private $replacementFactory;
/** Translations performed on data being streamed into the buffer */
- private $_translations = array();
+ private $translations = [];
/**
* Create a new StreamBuffer using $replacementFactory for transformations.
- *
- * @param Swift_ReplacementFilterFactory $replacementFactory
*/
public function __construct(Swift_ReplacementFilterFactory $replacementFactory)
{
- $this->_replacementFactory = $replacementFactory;
+ $this->replacementFactory = $replacementFactory;
}
/**
* Perform any initialization needed, using the given $params.
*
* Parameters will vary depending upon the type of IoBuffer used.
- *
- * @param array $params
*/
public function initialize(array $params)
{
- $this->_params = $params;
+ $this->params = $params;
switch ($params['type']) {
case self::TYPE_PROCESS:
- $this->_establishProcessConnection();
+ $this->establishProcessConnection();
break;
case self::TYPE_SOCKET:
default:
- $this->_establishSocketConnection();
+ $this->establishSocketConnection();
break;
}
}
@@ -72,21 +68,21 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
*/
public function setParam($param, $value)
{
- if (isset($this->_stream)) {
+ if (isset($this->stream)) {
switch ($param) {
case 'timeout':
- if ($this->_stream) {
- stream_set_timeout($this->_stream, $value);
+ if ($this->stream) {
+ stream_set_timeout($this->stream, $value);
}
break;
case 'blocking':
- if ($this->_stream) {
- stream_set_blocking($this->_stream, 1);
+ if ($this->stream) {
+ stream_set_blocking($this->stream, 1);
}
}
}
- $this->_params[$param] = $value;
+ $this->params[$param] = $value;
}
public function startTLS()
@@ -95,12 +91,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
// To support modern tls we allow explicit tls1.0, tls1.1, tls1.2
// Ssl3 and older are not allowed because they are vulnerable
// @TODO make tls arguments configurable
- $cryptoType = STREAM_CRYPTO_METHOD_TLS_CLIENT;
- if (PHP_VERSION_ID >= 50600) {
- $cryptoType = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
- }
-
- return stream_socket_enable_crypto($this->_stream, true, $cryptoType);
+ return stream_socket_enable_crypto($this->stream, true, STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
}
/**
@@ -108,22 +99,22 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
*/
public function terminate()
{
- if (isset($this->_stream)) {
- switch ($this->_params['type']) {
+ if (isset($this->stream)) {
+ switch ($this->params['type']) {
case self::TYPE_PROCESS:
- fclose($this->_in);
- fclose($this->_out);
- proc_close($this->_stream);
+ fclose($this->in);
+ fclose($this->out);
+ proc_close($this->stream);
break;
case self::TYPE_SOCKET:
default:
- fclose($this->_stream);
+ fclose($this->stream);
break;
}
}
- $this->_stream = null;
- $this->_out = null;
- $this->_in = null;
+ $this->stream = null;
+ $this->out = null;
+ $this->in = null;
}
/**
@@ -136,19 +127,19 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
*/
public function setWriteTranslations(array $replacements)
{
- foreach ($this->_translations as $search => $replace) {
+ foreach ($this->translations as $search => $replace) {
if (!isset($replacements[$search])) {
$this->removeFilter($search);
- unset($this->_translations[$search]);
+ unset($this->translations[$search]);
}
}
foreach ($replacements as $search => $replace) {
- if (!isset($this->_translations[$search])) {
+ if (!isset($this->translations[$search])) {
$this->addFilter(
- $this->_replacementFactory->createFilter($search, $replace), $search
+ $this->replacementFactory->createFilter($search, $replace), $search
);
- $this->_translations[$search] = true;
+ $this->translations[$search] = true;
}
}
}
@@ -161,20 +152,20 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
*
* @param int $sequence of last write to scan from
*
- * @throws Swift_IoException
- *
* @return string
+ *
+ * @throws Swift_IoException
*/
public function readLine($sequence)
{
- if (isset($this->_out) && !feof($this->_out)) {
- $line = fgets($this->_out);
- if (strlen($line) == 0) {
- $metas = stream_get_meta_data($this->_out);
+ if (isset($this->out) && !feof($this->out)) {
+ $line = fgets($this->out);
+ if (0 == strlen($line)) {
+ $metas = stream_get_meta_data($this->out);
if ($metas['timed_out']) {
throw new Swift_IoException(
'Connection to '.
- $this->_getReadConnectionDescription().
+ $this->getReadConnectionDescription().
' Timed Out'
);
}
@@ -193,20 +184,20 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
*
* @param int $length
*
- * @throws Swift_IoException
- *
* @return string|bool
+ *
+ * @throws Swift_IoException
*/
public function read($length)
{
- if (isset($this->_out) && !feof($this->_out)) {
- $ret = fread($this->_out, $length);
- if (strlen($ret) == 0) {
- $metas = stream_get_meta_data($this->_out);
+ if (isset($this->out) && !feof($this->out)) {
+ $ret = fread($this->out, $length);
+ if (0 == strlen($ret)) {
+ $metas = stream_get_meta_data($this->out);
if ($metas['timed_out']) {
throw new Swift_IoException(
'Connection to '.
- $this->_getReadConnectionDescription().
+ $this->getReadConnectionDescription().
' Timed Out'
);
}
@@ -222,22 +213,22 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
}
/** Flush the stream contents */
- protected function _flush()
+ protected function flush()
{
- if (isset($this->_in)) {
- fflush($this->_in);
+ if (isset($this->in)) {
+ fflush($this->in);
}
}
/** Write this bytes to the stream */
- protected function _commit($bytes)
+ protected function doCommit($bytes)
{
- if (isset($this->_in)) {
+ if (isset($this->in)) {
$bytesToWrite = strlen($bytes);
$totalBytesWritten = 0;
while ($totalBytesWritten < $bytesToWrite) {
- $bytesWritten = fwrite($this->_in, substr($bytes, $totalBytesWritten));
+ $bytesWritten = fwrite($this->in, substr($bytes, $totalBytesWritten));
if (false === $bytesWritten || 0 === $bytesWritten) {
break;
}
@@ -246,7 +237,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
}
if ($totalBytesWritten > 0) {
- return ++$this->_sequence;
+ return ++$this->sequence;
}
}
}
@@ -254,78 +245,79 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
/**
* Establishes a connection to a remote server.
*/
- private function _establishSocketConnection()
+ private function establishSocketConnection()
{
- $host = $this->_params['host'];
- if (!empty($this->_params['protocol'])) {
- $host = $this->_params['protocol'].'://'.$host;
+ $host = $this->params['host'];
+ if (!empty($this->params['protocol'])) {
+ $host = $this->params['protocol'].'://'.$host;
}
$timeout = 15;
- if (!empty($this->_params['timeout'])) {
- $timeout = $this->_params['timeout'];
+ if (!empty($this->params['timeout'])) {
+ $timeout = $this->params['timeout'];
}
- $options = array();
- if (!empty($this->_params['sourceIp'])) {
- $options['socket']['bindto'] = $this->_params['sourceIp'].':0';
+ $options = [];
+ if (!empty($this->params['sourceIp'])) {
+ $options['socket']['bindto'] = $this->params['sourceIp'].':0';
}
- if (isset($this->_params['stream_context_options'])) {
- $options = array_merge($options, $this->_params['stream_context_options']);
+
+ if (isset($this->params['stream_context_options'])) {
+ $options = array_merge($options, $this->params['stream_context_options']);
}
$streamContext = stream_context_create($options);
- $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
- if (false === $this->_stream) {
+ $this->stream = @stream_socket_client($host.':'.$this->params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext);
+ if (false === $this->stream) {
throw new Swift_TransportException(
- 'Connection could not be established with host '.$this->_params['host'].
+ 'Connection could not be established with host '.$this->params['host'].
' ['.$errstr.' #'.$errno.']'
);
}
- if (!empty($this->_params['blocking'])) {
- stream_set_blocking($this->_stream, 1);
+ if (!empty($this->params['blocking'])) {
+ stream_set_blocking($this->stream, 1);
} else {
- stream_set_blocking($this->_stream, 0);
+ stream_set_blocking($this->stream, 0);
}
- stream_set_timeout($this->_stream, $timeout);
- $this->_in = &$this->_stream;
- $this->_out = &$this->_stream;
+ stream_set_timeout($this->stream, $timeout);
+ $this->in = &$this->stream;
+ $this->out = &$this->stream;
}
/**
* Opens a process for input/output.
*/
- private function _establishProcessConnection()
+ private function establishProcessConnection()
{
- $command = $this->_params['command'];
- $descriptorSpec = array(
- 0 => array('pipe', 'r'),
- 1 => array('pipe', 'w'),
- 2 => array('pipe', 'w'),
- );
- $pipes = array();
- $this->_stream = proc_open($command, $descriptorSpec, $pipes);
+ $command = $this->params['command'];
+ $descriptorSpec = [
+ 0 => ['pipe', 'r'],
+ 1 => ['pipe', 'w'],
+ 2 => ['pipe', 'w'],
+ ];
+ $pipes = [];
+ $this->stream = proc_open($command, $descriptorSpec, $pipes);
stream_set_blocking($pipes[2], 0);
if ($err = stream_get_contents($pipes[2])) {
throw new Swift_TransportException(
'Process could not be started ['.$err.']'
);
}
- $this->_in = &$pipes[0];
- $this->_out = &$pipes[1];
+ $this->in = &$pipes[0];
+ $this->out = &$pipes[1];
}
- private function _getReadConnectionDescription()
+ private function getReadConnectionDescription()
{
- switch ($this->_params['type']) {
+ switch ($this->params['type']) {
case self::TYPE_PROCESS:
- return 'Process '.$this->_params['command'];
+ return 'Process '.$this->params['command'];
break;
case self::TYPE_SOCKET:
default:
- $host = $this->_params['host'];
- if (!empty($this->_params['protocol'])) {
- $host = $this->_params['protocol'].'://'.$host;
+ $host = $this->params['host'];
+ if (!empty($this->params['protocol'])) {
+ $host = $this->params['protocol'].'://'.$host;
}
- $host .= ':'.$this->_params['port'];
+ $host .= ':'.$this->params['port'];
return $host;
break;
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php
index 4ae2412e62..c7417455b3 100644
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php
+++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/TransportException.php
@@ -18,9 +18,8 @@ class Swift_TransportException extends Swift_IoException
/**
* Create a new TransportException with $message.
*
- * @param string $message
- * @param int $code
- * @param Exception $previous
+ * @param string $message
+ * @param int $code
*/
public function __construct($message, $code = 0, Exception $previous = null)
{
diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Validate.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Validate.php
deleted file mode 100644
index e16c212c49..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Validate.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/**
- * Utility Class allowing users to simply check expressions again Swift Grammar.
- *
- * @author Xavier De Cock <xdecock@gmail.com>
- */
-class Swift_Validate
-{
- /**
- * Grammar Object.
- *
- * @var Swift_Mime_Grammar
- */
- private static $grammar = null;
-
- /**
- * Checks if an e-mail address matches the current grammars.
- *
- * @param string $email
- *
- * @return bool
- */
- public static function email($email)
- {
- if (self::$grammar === null) {
- self::$grammar = Swift_DependencyContainer::getInstance()
- ->lookup('mime.grammar');
- }
-
- return (bool) preg_match(
- '/^'.self::$grammar->getDefinition('addr-spec').'$/D',
- $email
- );
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php
index 6023448e85..9d94d77401 100644
--- a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php
+++ b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/cache_deps.php
@@ -12,11 +12,11 @@ Swift_DependencyContainer::getInstance()
->register('cache.array')
->asSharedInstanceOf('Swift_KeyCache_ArrayKeyCache')
- ->withDependencies(array('cache.inputstream'))
+ ->withDependencies(['cache.inputstream'])
->register('cache.disk')
->asSharedInstanceOf('Swift_KeyCache_DiskKeyCache')
- ->withDependencies(array('cache.inputstream', 'tempdir'))
+ ->withDependencies(['cache.inputstream', 'tempdir'])
->register('cache.inputstream')
->asNewInstanceOf('Swift_KeyCache_SimpleKeyCacheInputStream')
diff --git a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
index d575e4f2de..307756c89f 100644
--- a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
+++ b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/mime_deps.php
@@ -6,96 +6,112 @@ Swift_DependencyContainer::getInstance()
->register('properties.charset')
->asValue('utf-8')
- ->register('mime.grammar')
- ->asSharedInstanceOf('Swift_Mime_Grammar')
+ ->register('email.validator')
+ ->asSharedInstanceOf('Egulias\EmailValidator\EmailValidator')
+
+ ->register('mime.idgenerator.idright')
+ // As SERVER_NAME can come from the user in certain configurations, check that
+ // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use
+ // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
+ ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated')
+
+ ->register('mime.idgenerator')
+ ->asSharedInstanceOf('Swift_Mime_IdGenerator')
+ ->withDependencies([
+ 'mime.idgenerator.idright',
+ ])
->register('mime.message')
->asNewInstanceOf('Swift_Mime_SimpleMessage')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
- 'mime.qpcontentencoder',
+ 'mime.textcontentencoder',
'cache',
- 'mime.grammar',
+ 'mime.idgenerator',
'properties.charset',
- ))
+ ])
->register('mime.part')
->asNewInstanceOf('Swift_Mime_MimePart')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
- 'mime.qpcontentencoder',
+ 'mime.textcontentencoder',
'cache',
- 'mime.grammar',
+ 'mime.idgenerator',
'properties.charset',
- ))
+ ])
->register('mime.attachment')
->asNewInstanceOf('Swift_Mime_Attachment')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
'mime.base64contentencoder',
'cache',
- 'mime.grammar',
- ))
+ 'mime.idgenerator',
+ ])
->addConstructorValue($swift_mime_types)
->register('mime.embeddedfile')
->asNewInstanceOf('Swift_Mime_EmbeddedFile')
- ->withDependencies(array(
+ ->withDependencies([
'mime.headerset',
'mime.base64contentencoder',
'cache',
- 'mime.grammar',
- ))
+ 'mime.idgenerator',
+ ])
->addConstructorValue($swift_mime_types)
->register('mime.headerfactory')
->asNewInstanceOf('Swift_Mime_SimpleHeaderFactory')
- ->withDependencies(array(
- 'mime.qpheaderencoder',
- 'mime.rfc2231encoder',
- 'mime.grammar',
- 'properties.charset',
- ))
+ ->withDependencies([
+ 'mime.qpheaderencoder',
+ 'mime.rfc2231encoder',
+ 'email.validator',
+ 'properties.charset',
+ 'address.idnaddressencoder',
+ ])
->register('mime.headerset')
->asNewInstanceOf('Swift_Mime_SimpleHeaderSet')
- ->withDependencies(array('mime.headerfactory', 'properties.charset'))
+ ->withDependencies(['mime.headerfactory', 'properties.charset'])
->register('mime.qpheaderencoder')
->asNewInstanceOf('Swift_Mime_HeaderEncoder_QpHeaderEncoder')
- ->withDependencies(array('mime.charstream'))
+ ->withDependencies(['mime.charstream'])
->register('mime.base64headerencoder')
->asNewInstanceOf('Swift_Mime_HeaderEncoder_Base64HeaderEncoder')
- ->withDependencies(array('mime.charstream'))
+ ->withDependencies(['mime.charstream'])
->register('mime.charstream')
->asNewInstanceOf('Swift_CharacterStream_NgCharacterStream')
- ->withDependencies(array('mime.characterreaderfactory', 'properties.charset'))
+ ->withDependencies(['mime.characterreaderfactory', 'properties.charset'])
->register('mime.bytecanonicalizer')
->asSharedInstanceOf('Swift_StreamFilters_ByteArrayReplacementFilter')
- ->addConstructorValue(array(array(0x0D, 0x0A), array(0x0D), array(0x0A)))
- ->addConstructorValue(array(array(0x0A), array(0x0A), array(0x0D, 0x0A)))
+ ->addConstructorValue([[0x0D, 0x0A], [0x0D], [0x0A]])
+ ->addConstructorValue([[0x0A], [0x0A], [0x0D, 0x0A]])
->register('mime.characterreaderfactory')
->asSharedInstanceOf('Swift_CharacterReaderFactory_SimpleCharacterReaderFactory')
+ ->register('mime.textcontentencoder')
+ ->asAliasOf('mime.qpcontentencoder')
+
->register('mime.safeqpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoder')
- ->withDependencies(array('mime.charstream', 'mime.bytecanonicalizer'))
+ ->withDependencies(['mime.charstream', 'mime.bytecanonicalizer'])
->register('mime.rawcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_RawContentEncoder')
->register('mime.nativeqpcontentencoder')
- ->withDependencies(array('properties.charset'))
+ ->withDependencies(['properties.charset'])
->asNewInstanceOf('Swift_Mime_ContentEncoder_NativeQpContentEncoder')
- ->register('mime.qpcontentencoderproxy')
+ ->register('mime.qpcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_QpContentEncoderProxy')
- ->withDependencies(array('mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'))
+ ->withDependencies(['mime.safeqpcontentencoder', 'mime.nativeqpcontentencoder', 'properties.charset'])
->register('mime.7bitcontentencoder')
->asNewInstanceOf('Swift_Mime_ContentEncoder_PlainContentEncoder')
@@ -112,12 +128,7 @@ Swift_DependencyContainer::getInstance()
->register('mime.rfc2231encoder')
->asNewInstanceOf('Swift_Encoder_Rfc2231Encoder')
- ->withDependencies(array('mime.charstream'))
-
- // 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(PHP_VERSION_ID >= 50407 ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')
+ ->withDependencies(['mime.charstream'])
;
unset($swift_mime_types);
diff --git a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php
index 77e432cfac..34a63c78e5 100644
--- a/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php
+++ b/vendor/swiftmailer/swiftmailer/lib/dependency_maps/transport_deps.php
@@ -1,24 +1,29 @@
<?php
Swift_DependencyContainer::getInstance()
+ ->register('transport.localdomain')
+ // As SERVER_NAME can come from the user in certain configurations, check that
+ // it does not contain forbidden characters (see RFC 952 and RFC 2181). Use
+ // preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
+ ->asValue(!empty($_SERVER['SERVER_NAME']) && '' === preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) ? trim($_SERVER['SERVER_NAME'], '[]') : '127.0.0.1')
+
->register('transport.smtp')
->asNewInstanceOf('Swift_Transport_EsmtpTransport')
- ->withDependencies(array(
+ ->withDependencies([
'transport.buffer',
- array('transport.authhandler'),
+ 'transport.smtphandlers',
'transport.eventdispatcher',
- ))
+ 'transport.localdomain',
+ 'address.idnaddressencoder',
+ ])
->register('transport.sendmail')
->asNewInstanceOf('Swift_Transport_SendmailTransport')
- ->withDependencies(array(
+ ->withDependencies([
'transport.buffer',
'transport.eventdispatcher',
- ))
-
- ->register('transport.mail')
- ->asNewInstanceOf('Swift_Transport_MailTransport')
- ->withDependencies(array('transport.mailinvoker', 'transport.eventdispatcher'))
+ 'transport.localdomain',
+ ])
->register('transport.loadbalanced')
->asNewInstanceOf('Swift_Transport_LoadBalancedTransport')
@@ -28,30 +33,40 @@ Swift_DependencyContainer::getInstance()
->register('transport.spool')
->asNewInstanceOf('Swift_Transport_SpoolTransport')
- ->withDependencies(array('transport.eventdispatcher'))
+ ->withDependencies(['transport.eventdispatcher'])
->register('transport.null')
->asNewInstanceOf('Swift_Transport_NullTransport')
- ->withDependencies(array('transport.eventdispatcher'))
-
- ->register('transport.mailinvoker')
- ->asSharedInstanceOf('Swift_Transport_SimpleMailInvoker')
+ ->withDependencies(['transport.eventdispatcher'])
->register('transport.buffer')
->asNewInstanceOf('Swift_Transport_StreamBuffer')
- ->withDependencies(array('transport.replacementfactory'))
+ ->withDependencies(['transport.replacementfactory'])
+
+ ->register('transport.smtphandlers')
+ ->asArray()
+ ->withDependencies(['transport.authhandler'])
->register('transport.authhandler')
->asNewInstanceOf('Swift_Transport_Esmtp_AuthHandler')
- ->withDependencies(array(
- array(
- 'transport.crammd5auth',
- 'transport.loginauth',
- 'transport.plainauth',
- 'transport.ntlmauth',
- 'transport.xoauth2auth',
- ),
- ))
+ ->withDependencies(['transport.authhandlers'])
+
+ ->register('transport.authhandlers')
+ ->asArray()
+ ->withDependencies([
+ 'transport.crammd5auth',
+ 'transport.loginauth',
+ 'transport.plainauth',
+ 'transport.ntlmauth',
+ 'transport.xoauth2auth',
+ ])
+
+ ->register('transport.smtputf8handler')
+ ->asNewInstanceOf('Swift_Transport_Esmtp_SmtpUtf8Handler')
+
+ ->register('transport.8bitmimehandler')
+ ->asNewInstanceOf('Swift_Transport_Esmtp_EightBitMimeHandler')
+ ->addConstructorValue('8BITMIME')
->register('transport.crammd5auth')
->asNewInstanceOf('Swift_Transport_Esmtp_Auth_CramMd5Authenticator')
@@ -73,4 +88,10 @@ Swift_DependencyContainer::getInstance()
->register('transport.replacementfactory')
->asSharedInstanceOf('Swift_StreamFilters_StringReplacementFilterFactory')
+
+ ->register('address.idnaddressencoder')
+ ->asNewInstanceOf('Swift_AddressEncoder_IdnAddressEncoder')
+
+ ->register('address.utf8addressencoder')
+ ->asNewInstanceOf('Swift_AddressEncoder_Utf8AddressEncoder')
;
diff --git a/vendor/swiftmailer/swiftmailer/lib/mime_types.php b/vendor/swiftmailer/swiftmailer/lib/mime_types.php
index b42c1cc1a3..72c6fd2afa 100644
--- a/vendor/swiftmailer/swiftmailer/lib/mime_types.php
+++ b/vendor/swiftmailer/swiftmailer/lib/mime_types.php
@@ -17,7 +17,7 @@
// You may add or take away what you like (lowercase required)
-$swift_mime_types = array(
+$swift_mime_types = [
'3dml' => 'text/vnd.in3d.3dml',
'3ds' => 'image/x-3ds',
'3g2' => 'video/3gpp2',
@@ -1004,4 +1004,4 @@ $swift_mime_types = array(
'zirz' => 'application/vnd.zul',
'zmm' => 'application/vnd.handheld-entertainment+xml',
'123' => 'application/vnd.lotus-1-2-3',
-);
+];
diff --git a/vendor/swiftmailer/swiftmailer/lib/preferences.php b/vendor/swiftmailer/swiftmailer/lib/preferences.php
index 0b430e67de..27b7065dbe 100644
--- a/vendor/swiftmailer/swiftmailer/lib/preferences.php
+++ b/vendor/swiftmailer/swiftmailer/lib/preferences.php
@@ -17,9 +17,3 @@ $preferences->setCharset('utf-8');
if (@is_writable($tmpDir = sys_get_temp_dir())) {
$preferences->setTempDir($tmpDir)->setCacheType('disk');
}
-
-// this should only be done when Swiftmailer won't use the native QP content encoder
-// see mime_deps.php
-if (PHP_VERSION_ID < 50407) {
- $preferences->setQPDotEscape(false);
-}
diff --git a/vendor/swiftmailer/swiftmailer/lib/swift_init.php b/vendor/swiftmailer/swiftmailer/lib/swift_init.php
deleted file mode 100644
index ff7196344b..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/swift_init.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/*
- * Dependency injection initialization for Swift Mailer.
- */
-
-if (defined('SWIFT_INIT_LOADED')) {
- return;
-}
-
-define('SWIFT_INIT_LOADED', true);
-
-// Load in dependency maps
-require __DIR__.'/dependency_maps/cache_deps.php';
-require __DIR__.'/dependency_maps/mime_deps.php';
-require __DIR__.'/dependency_maps/message_deps.php';
-require __DIR__.'/dependency_maps/transport_deps.php';
-
-// Load in global library preferences
-require __DIR__.'/preferences.php';
diff --git a/vendor/swiftmailer/swiftmailer/lib/swift_required.php b/vendor/swiftmailer/swiftmailer/lib/swift_required.php
index 03a72ceae1..d696056aab 100644
--- a/vendor/swiftmailer/swiftmailer/lib/swift_required.php
+++ b/vendor/swiftmailer/swiftmailer/lib/swift_required.php
@@ -8,23 +8,15 @@
* file that was distributed with this source code.
*/
-/*
- * Autoloader and dependency injection initialization for Swift Mailer.
- */
-
-if (class_exists('Swift', false)) {
- return;
-}
-
-// Load Swift utility class
require __DIR__.'/classes/Swift.php';
-if (!function_exists('_swiftmailer_init')) {
- function _swiftmailer_init()
- {
- require __DIR__.'/swift_init.php';
- }
-}
+Swift::registerAutoload(function () {
+ // Load in dependency maps
+ require __DIR__.'/dependency_maps/cache_deps.php';
+ require __DIR__.'/dependency_maps/mime_deps.php';
+ require __DIR__.'/dependency_maps/message_deps.php';
+ require __DIR__.'/dependency_maps/transport_deps.php';
-// Start the autoloader and lazy-load the init script to set up dependency injection
-Swift::registerAutoload('_swiftmailer_init');
+ // Load in global library preferences
+ require __DIR__.'/preferences.php';
+});
diff --git a/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php b/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php
deleted file mode 100644
index 2b5181a93f..0000000000
--- a/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-/*
- * This file is part of SwiftMailer.
- * (c) 2004-2009 Chris Corbyn
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-/*
- * Autoloader and dependency injection initialization for Swift Mailer.
- */
-
-if (class_exists('Swift', false)) {
- return;
-}
-
-// Load Swift utility class
-require __DIR__.'/Swift.php';
-
-if (!function_exists('_swiftmailer_init')) {
- function _swiftmailer_init()
- {
- require __DIR__.'/swift_init.php';
- }
-}
-
-// Start the autoloader and lazy-load the init script to set up dependency injection
-Swift::registerAutoload('_swiftmailer_init');
diff --git a/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php b/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
index 85f2d69f21..7120db16af 100755
--- a/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
+++ b/vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php
@@ -25,12 +25,12 @@ function generateUpToDateMimeArray()
$mime_xml = @file_get_contents(FREEDESKTOP_XML_URL);
// prepare valid mime types
- $valid_mime_types = array();
+ $valid_mime_types = [];
// split mime type and extensions eg. "video/x-matroska mkv mk3d mks"
- if (preg_match_all('/^#?([a-z0-9\-\+\/\.]+)[\t]+(.*)$/miu', $mime_types, $matches) !== false) {
+ if (false !== preg_match_all('/^#?([a-z0-9\-\+\/\.]+)[\t]+(.*)$/miu', $mime_types, $matches)) {
// collection of predefined mimetypes (bugfix for wrong resolved or missing mime types)
- $valid_mime_types_preset = array(
+ $valid_mime_types_preset = [
'php' => 'application/x-php',
'php3' => 'application/x-php',
'php4' => 'application/x-php',
@@ -95,7 +95,7 @@ function generateUpToDateMimeArray()
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xml' => 'application/xml',
- );
+ ];
// wrap array for generating file
foreach ($valid_mime_types_preset as $extension => $mime_type) {
@@ -103,9 +103,6 @@ function generateUpToDateMimeArray()
$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'";
}
- // collect extensions
- $valid_extensions = array();
-
// all extensions from second match
foreach ($matches[2] as $i => $extensions) {
// explode multiple extensions from string
@@ -113,7 +110,7 @@ function generateUpToDateMimeArray()
// force array for foreach
if (!is_array($extensions)) {
- $extensions = array($extensions);
+ $extensions = [$extensions];
}
foreach ($extensions as $extension) {
@@ -122,9 +119,6 @@ function generateUpToDateMimeArray()
// check if string length lower than 10
if (strlen($extension) < 10) {
- // add extension
- $valid_extensions[] = $extension;
-
if (!isset($valid_mime_types[$mime_type])) {
// generate array for mimetype to extension resolver (only first match)
$valid_mime_types[$extension] = "'{$extension}' => '{$mime_type}'";
@@ -145,18 +139,13 @@ function generateUpToDateMimeArray()
// get all matching extensions from match
foreach ((array) $node->glob['pattern'] as $extension) {
// skip none glob extensions
- if (strpos($extension, '.') === false) {
+ if (false === strpos($extension, '.')) {
continue;
}
// remove get only last part
$extension = explode('.', strtolower($extension));
$extension = end($extension);
-
- // maximum length in database column
- if (strlen($extension) <= 9) {
- $valid_extensions[] = $extension;
- }
}
if (isset($node->glob['pattern'][0])) {
@@ -167,7 +156,7 @@ function generateUpToDateMimeArray()
$extension = strtolower(trim($node->glob['ddpattern'][0], '*.'));
// skip none glob extensions and check if string length between 1 and 10
- if (strpos($extension, '.') !== false || strlen($extension) < 1 || strlen($extension) > 9) {
+ if (false !== strpos($extension, '.') || strlen($extension) < 1 || strlen($extension) > 9) {
continue;
}
diff --git a/vendor/swiftmailer/swiftmailer/phpunit.xml.dist b/vendor/swiftmailer/swiftmailer/phpunit.xml.dist
index 606c5b4495..9ec0c49a36 100644
--- a/vendor/swiftmailer/swiftmailer/phpunit.xml.dist
+++ b/vendor/swiftmailer/swiftmailer/phpunit.xml.dist
@@ -34,6 +34,5 @@
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
- <listener class="Mockery\Adapter\Phpunit\TestListener" />
</listeners>
</phpunit>
diff --git a/vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php b/vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php
index 069d11ab7f..0a4a6da899 100644
--- a/vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php
+++ b/vendor/swiftmailer/swiftmailer/tests/IdenticalBinaryConstraint.php
@@ -5,7 +5,7 @@
*
* @author Chris Corbyn
*/
-class IdenticalBinaryConstraint extends \PHPUnit_Framework_Constraint
+class IdenticalBinaryConstraint extends \PHPUnit\Framework\Constraint\Constraint
{
protected $value;
@@ -37,7 +37,7 @@ class IdenticalBinaryConstraint extends \PHPUnit_Framework_Constraint
*/
public function toString()
{
- return 'indentical binary';
+ return 'identical binary';
}
/**
diff --git a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php
index 71c5713beb..13bd240338 100644
--- a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php
+++ b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerSmokeTestCase.php
@@ -16,7 +16,7 @@ class SwiftMailerSmokeTestCase extends SwiftMailerTestCase
}
}
- protected function _getMailer()
+ protected function getMailer()
{
switch (SWIFT_SMOKE_TRANSPORT_TYPE) {
case 'smtp':
diff --git a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php
index f0e27361ce..fe2c62b424 100644
--- a/vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php
+++ b/vendor/swiftmailer/swiftmailer/tests/SwiftMailerTestCase.php
@@ -1,19 +1,23 @@
<?php
+use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
+
/**
* A base test case with some custom expectations.
*
* @author Rouven Weßling
*/
-class SwiftMailerTestCase extends \PHPUnit_Framework_TestCase
+class SwiftMailerTestCase extends \PHPUnit\Framework\TestCase
{
+ use MockeryPHPUnitIntegration;
+
public static function regExp($pattern)
{
if (!is_string($pattern)) {
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
- return new PHPUnit_Framework_Constraint_PCREMatch($pattern);
+ return new \PHPUnit\Framework\Constraint\RegularExpression($pattern);
}
public function assertIdenticalBinary($expected, $actual, $message = '')
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default b/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default
index 5717c98f94..362cac0d8a 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default
@@ -1,7 +1,7 @@
<?php
/*
- Swift Mailer V4 accpetance test configuration.
+ Swift Mailer acceptance test configuration.
YOU ONLY NEED TO EDIT THIS FILE IF YOU WISH TO RUN THE ACCEPTANCE TESTS.
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php
index 5c0b8264e3..3e0b313da7 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php
@@ -5,8 +5,8 @@ require_once __DIR__.'/Mime/AttachmentAcceptanceTest.php';
class Swift_AttachmentAcceptanceTest extends Swift_Mime_AttachmentAcceptanceTest
{
- protected function _createAttachment()
+ protected function createAttachment()
{
- return Swift_Attachment::newInstance();
+ return new Swift_Attachment();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
index 49ad20a82e..8695b6e297 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
@@ -1,23 +1,23 @@
<?php
-class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit\Framework\TestCase
{
private $_testFile;
protected function setUp()
{
- $this->_testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__;
- file_put_contents($this->_testFile, 'abcdefghijklm');
+ $this->testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__;
+ file_put_contents($this->testFile, 'abcdefghijklm');
}
protected function tearDown()
{
- unlink($this->_testFile);
+ unlink($this->testFile);
}
public function testFileDataCanBeRead()
{
- $file = $this->_createFileStream($this->_testFile);
+ $file = $this->createFileStream($this->testFile);
$str = '';
while (false !== $bytes = $file->read(8192)) {
$str .= $bytes;
@@ -27,7 +27,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
public function testFileDataCanBeReadSequentially()
{
- $file = $this->_createFileStream($this->_testFile);
+ $file = $this->createFileStream($this->testFile);
$this->assertEquals('abcde', $file->read(5));
$this->assertEquals('fghijklm', $file->read(8));
$this->assertFalse($file->read(1));
@@ -35,20 +35,20 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
public function testFilenameIsReturned()
{
- $file = $this->_createFileStream($this->_testFile);
- $this->assertEquals($this->_testFile, $file->getPath());
+ $file = $this->createFileStream($this->testFile);
+ $this->assertEquals($this->testFile, $file->getPath());
}
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');
@@ -57,28 +57,28 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
public function testWritingToFileWithCanonicalization()
{
- $file = $this->_createFileStream($this->_testFile, true);
- $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF');
+ $file = $this->createFileStream($this->testFile, true);
+ $file->addFilter($this->createFilter(["\r\n", "\r"], "\n"), 'allToLF');
$file->write("foo\r\nbar\r");
$file->write("\nzip\r\ntest\r");
$file->flushBuffers();
- $this->assertEquals("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile));
+ $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 = $this->createFileStream($this->testFile, true);
+ $file->addFilter($this->createFilter(["\r\n", "\r"], "\n"), 'allToLF');
$file->write('');
$file->flushBuffers();
- $this->assertEquals('', file_get_contents($this->_testFile));
+ $this->assertEquals('', file_get_contents($this->testFile));
}
public function testBindingOtherStreamsMirrorsWriteOperations()
{
- $file = $this->_createFileStream($this->_testFile, true);
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $file = $this->createFileStream($this->testFile, true);
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->at(0))
->method('write')
@@ -102,11 +102,11 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
public function testBindingOtherStreamsMirrorsFlushOperations()
{
- $file = $this->_createFileStream(
- $this->_testFile, true
+ $file = $this->createFileStream(
+ $this->testFile, true
);
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->once())
->method('flushBuffers');
@@ -121,9 +121,9 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
public function testUnbindingStreamPreventsFurtherWrites()
{
- $file = $this->_createFileStream($this->_testFile, true);
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $file = $this->createFileStream($this->testFile, true);
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->at(0))
->method('write')
@@ -145,17 +145,17 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
$file->write('y');
}
- private function _createFilter($search, $replace)
+ private function createFilter($search, $replace)
{
return new Swift_StreamFilters_StringReplacementFilter($search, $replace);
}
- private function _createMockInputStream()
+ private function createMockInputStream()
{
return $this->getMockBuilder('Swift_InputByteStream')->getMock();
}
- private function _createFileStream($file, $writable = false)
+ private function createFileStream($file, $writable = false)
{
return new Swift_ByteStream_FileByteStream($file, $writable);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
index c13e5704e5..fcc7ad4d07 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
@@ -1,28 +1,28 @@
<?php
-class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_factory;
- private $_prefix = 'Swift_CharacterReader_';
+ private $factory;
+ private $prefix = 'Swift_CharacterReader_';
protected function setUp()
{
- $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
}
public function testCreatingUtf8Reader()
{
- foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) {
- $reader = $this->_factory->getReaderFor($utf8);
- $this->assertInstanceOf($this->_prefix.'Utf8Reader', $reader);
+ foreach (['utf8', 'utf-8', 'UTF-8', 'UTF8'] as $utf8) {
+ $reader = $this->factory->getReaderFor($utf8);
+ $this->assertInstanceOf($this->prefix.'Utf8Reader', $reader);
}
}
public function testCreatingIso8859XReaders()
{
- $charsets = array();
+ $charsets = [];
foreach (range(1, 16) as $number) {
- foreach (array('iso', 'iec') as $body) {
+ foreach (['iso', 'iec'] as $body) {
$charsets[] = $body.'-8859-'.$number;
$charsets[] = $body.'8859-'.$number;
$charsets[] = strtoupper($body).'-8859-'.$number;
@@ -31,15 +31,15 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
}
foreach ($charsets as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingWindows125XReaders()
{
- $charsets = array();
+ $charsets = [];
foreach (range(0, 8) as $number) {
$charsets[] = 'windows-125'.$number;
$charsets[] = 'windows125'.$number;
@@ -48,15 +48,15 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
}
foreach ($charsets as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingCodePageReaders()
{
- $charsets = array();
+ $charsets = [];
foreach (range(0, 8) as $number) {
$charsets[] = 'cp-125'.$number;
$charsets[] = 'cp125'.$number;
@@ -64,8 +64,8 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
$charsets[] = 'CP125'.$number;
}
- foreach (array(437, 737, 850, 855, 857, 858, 860,
- 861, 863, 865, 866, 869, ) as $number) {
+ foreach ([437, 737, 850, 855, 857, 858, 860,
+ 861, 863, 865, 866, 869, ] as $number) {
$charsets[] = 'cp-'.$number;
$charsets[] = 'cp'.$number;
$charsets[] = 'CP-'.$number;
@@ -73,34 +73,34 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
}
foreach ($charsets as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingAnsiReader()
{
- foreach (array('ansi', 'ANSI') as $ansi) {
- $reader = $this->_factory->getReaderFor($ansi);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['ansi', 'ANSI'] as $ansi) {
+ $reader = $this->factory->getReaderFor($ansi);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingMacintoshReader()
{
- foreach (array('macintosh', 'MACINTOSH') as $mac) {
- $reader = $this->_factory->getReaderFor($mac);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['macintosh', 'MACINTOSH'] as $mac) {
+ $reader = $this->factory->getReaderFor($mac);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingKOIReaders()
{
- $charsets = array();
- foreach (array('7', '8-r', '8-u', '8u', '8r') as $end) {
+ $charsets = [];
+ foreach (['7', '8-r', '8-u', '8u', '8r'] as $end) {
$charsets[] = 'koi-'.$end;
$charsets[] = 'koi'.$end;
$charsets[] = 'KOI-'.$end;
@@ -108,71 +108,71 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
}
foreach ($charsets as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingIsciiReaders()
{
- foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['iscii', 'ISCII', 'viscii', 'VISCII'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingMIKReader()
{
- foreach (array('mik', 'MIK') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['mik', 'MIK'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingCorkReader()
{
- foreach (array('cork', 'CORK', 't1', 'T1') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['cork', 'CORK', 't1', 'T1'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(1, $reader->getInitialByteSize());
}
}
public function testCreatingUcs2Reader()
{
- foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['ucs-2', 'UCS-2', 'ucs2', 'UCS2'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(2, $reader->getInitialByteSize());
}
}
public function testCreatingUtf16Reader()
{
- foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['utf-16', 'UTF-16', 'utf16', 'UTF16'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(2, $reader->getInitialByteSize());
}
}
public function testCreatingUcs4Reader()
{
- foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['ucs-4', 'UCS-4', 'ucs4', 'UCS4'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(4, $reader->getInitialByteSize());
}
}
public function testCreatingUtf32Reader()
{
- foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) {
- $reader = $this->_factory->getReaderFor($charset);
- $this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
+ foreach (['utf-32', 'UTF-32', 'utf32', 'UTF32'] as $charset) {
+ $reader = $this->factory->getReaderFor($charset);
+ $this->assertInstanceOf($this->prefix.'GenericFixedWidthReader', $reader);
$this->assertEquals(4, $reader->getInitialByteSize());
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
index e83c2bf57e..3c1b515b55 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php
@@ -4,21 +4,19 @@ require_once 'swift_required.php';
//This is more of a "cross your fingers and hope it works" test!
-class Swift_DependencyContainerAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_DependencyContainerAcceptanceTest extends PHPUnit\Framework\TestCase
{
public function testNoLookupsFail()
{
$di = Swift_DependencyContainer::getInstance();
foreach ($di->listItems() as $itemName) {
try {
- // to be removed in 6.0
- if ('transport.mail' === $itemName) {
- continue;
- }
$di->lookup($itemName);
} catch (Swift_DependencyException $e) {
$this->fail($e->getMessage());
}
}
+ // previous loop would fail if there is an issue
+ $this->addToAssertionCount(1);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php
index fc5a8147df..a172e9724f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php
@@ -5,8 +5,8 @@ require_once __DIR__.'/Mime/EmbeddedFileAcceptanceTest.php';
class Swift_EmbeddedFileAcceptanceTest extends Swift_Mime_EmbeddedFileAcceptanceTest
{
- protected function _createEmbeddedFile()
+ protected function createEmbeddedFile()
{
- return Swift_EmbeddedFile::newInstance();
+ return new Swift_EmbeddedFile();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php
index bada5094db..f7098c1188 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php
@@ -1,35 +1,35 @@
<?php
-class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_encoder;
+ private $samplesDir;
+ private $encoder;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
- $this->_encoder = new Swift_Encoder_Base64Encoder();
+ $this->samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->encoder = new Swift_Encoder_Base64Encoder();
}
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
$text = file_get_contents($sampleDir.'/'.$sampleFile);
- $encodedText = $this->_encoder->encodeString($text);
+ $encodedText = $this->encoder->encodeString($text);
$this->assertEquals(
base64_decode($encodedText), $text,
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
index 442d9a94b1..5bbf067d4f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
@@ -1,35 +1,35 @@
<?php
-class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_factory;
+ private $samplesDir;
+ private $factory;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
- $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
}
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_ArrayCharacterStream(
- $this->_factory, $encoding);
+ $this->factory, $encoding);
$encoder = new Swift_Encoder_QpEncoder($charStream);
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
index bcb6b957cb..20c68d5de6 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
@@ -1,35 +1,35 @@
<?php
-class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_factory;
+ private $samplesDir;
+ private $factory;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
- $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
+ $this->factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
}
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_ArrayCharacterStream(
- $this->_factory, $encoding);
+ $this->factory, $encoding);
$encoder = new Swift_Encoder_Rfc2231Encoder($charStream);
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php
deleted file mode 100644
index 6a4d05d3c8..0000000000
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-
-require_once 'swift_required.php';
-
-class Swift_EncodingAcceptanceTest extends \PHPUnit_Framework_TestCase
-{
- public function testGet7BitEncodingReturns7BitEncoder()
- {
- $encoder = Swift_Encoding::get7BitEncoding();
- $this->assertEquals('7bit', $encoder->getName());
- }
-
- public function testGet8BitEncodingReturns8BitEncoder()
- {
- $encoder = Swift_Encoding::get8BitEncoding();
- $this->assertEquals('8bit', $encoder->getName());
- }
-
- public function testGetQpEncodingReturnsQpEncoder()
- {
- $encoder = Swift_Encoding::getQpEncoding();
- $this->assertEquals('quoted-printable', $encoder->getName());
- }
-
- public function testGetBase64EncodingReturnsBase64Encoder()
- {
- $encoder = Swift_Encoding::getBase64Encoding();
- $this->assertEquals('base64', $encoder->getName());
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
index 5fab14cec1..c54986b2b1 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
@@ -1,79 +1,79 @@
<?php
-class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_cache;
- private $_key1 = 'key1';
- private $_key2 = 'key2';
+ private $cache;
+ private $key1 = 'key1';
+ private $key2 = 'key2';
protected function setUp()
{
- $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ $this->cache = new Swift_KeyCache_ArrayKeyCache(
new Swift_KeyCache_SimpleKeyCacheInputStream()
);
}
public function testStringDataCanBeSetAndFetched()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeOverwritten()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('whatever', $this->cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeAppended()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
+ $this->cache->setString(
+ $this->key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testing', $this->cache->getString($this->key1, 'foo'));
}
public function testHasKeyReturnValue()
{
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyIsWellPartitioned()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $this->cache->getString($this->key2, 'foo'));
}
public function testItemKeyIsWellPartitioned()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $this->cache->getString($this->key1, 'bar'));
}
public function testByteStreamCanBeImported()
@@ -81,10 +81,10 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test
$os = new Swift_ByteStream_ArrayByteStream();
$os->write('abcdef');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdef', $this->cache->getString($this->key1, 'foo'));
}
public function testByteStreamCanBeAppended()
@@ -95,40 +95,40 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test
$os2 = new Swift_ByteStream_ArrayByteStream();
$os2->write('xyzuvw');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
);
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdefxyzuvw', $this->cache->getString($this->key1, 'foo'));
}
public function testByteStreamAndStringCanBeAppended()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
);
$os = new Swift_ByteStream_ArrayByteStream();
$os->write('abcdef');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testabcdef', $this->cache->getString($this->key1, 'foo'));
}
public function testDataCanBeExportedToByteStream()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$is = new Swift_ByteStream_ArrayByteStream();
- $this->_cache->exportToByteStream($this->_key1, 'foo', $is);
+ $this->cache->exportToByteStream($this->key1, 'foo', $is);
$string = '';
while (false !== $bytes = $is->read(8192)) {
@@ -140,34 +140,34 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test
public function testKeyCanBeCleared()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
- $this->_cache->clearKey($this->_key1, 'foo');
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
+ $this->cache->clearKey($this->key1, 'foo');
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyCanBeCleared()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));
- $this->_cache->clearAll($this->_key1);
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'bar'));
+ $this->cache->clearAll($this->key1);
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
+ $this->assertFalse($this->cache->hasKey($this->key1, 'bar'));
}
public function testKeyCacheInputStream()
{
- $is = $this->_cache->getInputByteStream($this->_key1, 'foo');
+ $is = $this->cache->getInputByteStream($this->key1, 'foo');
$is->write('abc');
$is->write('xyz');
- $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcxyz', $this->cache->getString($this->key1, 'foo'));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
index 0e027c2d71..976474235c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
@@ -1,79 +1,79 @@
<?php
-class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_cache;
- private $_key1;
- private $_key2;
+ private $cache;
+ private $key1;
+ private $key2;
protected function setUp()
{
- $this->_key1 = uniqid(microtime(true), true);
- $this->_key2 = uniqid(microtime(true), true);
- $this->_cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir());
+ $this->key1 = uniqid(microtime(true), true);
+ $this->key2 = uniqid(microtime(true), true);
+ $this->cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir());
}
public function testStringDataCanBeSetAndFetched()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeOverwritten()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('whatever', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('whatever', $this->cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeAppended()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
+ $this->cache->setString(
+ $this->key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testing', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testing', $this->cache->getString($this->key1, 'foo'));
}
public function testHasKeyReturnValue()
{
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyIsWellPartitioned()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $this->_cache->getString($this->_key2, 'foo'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $this->cache->getString($this->key2, 'foo'));
}
public function testItemKeyIsWellPartitioned()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $this->_cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $this->_cache->getString($this->_key1, 'bar'));
+ $this->assertEquals('test', $this->cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $this->cache->getString($this->key1, 'bar'));
}
public function testByteStreamCanBeImported()
@@ -81,10 +81,10 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC
$os = new Swift_ByteStream_ArrayByteStream();
$os->write('abcdef');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('abcdef', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdef', $this->cache->getString($this->key1, 'foo'));
}
public function testByteStreamCanBeAppended()
@@ -95,40 +95,40 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC
$os2 = new Swift_ByteStream_ArrayByteStream();
$os2->write('xyzuvw');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
);
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdefxyzuvw', $this->cache->getString($this->key1, 'foo'));
}
public function testByteStreamAndStringCanBeAppended()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
);
$os = new Swift_ByteStream_ArrayByteStream();
$os->write('abcdef');
- $this->_cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
+ $this->cache->importFromByteStream(
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testabcdef', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testabcdef', $this->cache->getString($this->key1, 'foo'));
}
public function testDataCanBeExportedToByteStream()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$is = new Swift_ByteStream_ArrayByteStream();
- $this->_cache->exportToByteStream($this->_key1, 'foo', $is);
+ $this->cache->exportToByteStream($this->key1, 'foo', $is);
$string = '';
while (false !== $bytes = $is->read(8192)) {
@@ -140,34 +140,34 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC
public function testKeyCanBeCleared()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
- $this->_cache->clearKey($this->_key1, 'foo');
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
+ $this->cache->clearKey($this->key1, 'foo');
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyCanBeCleared()
{
- $this->_cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->_cache->setString(
- $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
+ $this->cache->setString(
+ $this->key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo'));
- $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar'));
- $this->_cache->clearAll($this->_key1);
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo'));
- $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'foo'));
+ $this->assertTrue($this->cache->hasKey($this->key1, 'bar'));
+ $this->cache->clearAll($this->key1);
+ $this->assertFalse($this->cache->hasKey($this->key1, 'foo'));
+ $this->assertFalse($this->cache->hasKey($this->key1, 'bar'));
}
public function testKeyCacheInputStream()
{
- $is = $this->_cache->getInputByteStream($this->_key1, 'foo');
+ $is = $this->cache->getInputByteStream($this->key1, 'foo');
$is->write('abc');
$is->write('xyz');
- $this->assertEquals('abcxyz', $this->_cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcxyz', $this->cache->getString($this->key1, 'foo'));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php
index 5f4e9835ed..16adb23b0e 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php
@@ -7,10 +7,10 @@ class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest
{
public function testAddPartWrapper()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
$date = $message->getDate();
@@ -21,7 +21,7 @@ class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -45,11 +45,11 @@ class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest
);
}
- protected function _createMessage()
+ protected function createMessage()
{
Swift_DependencyContainer::getInstance()
->register('properties.charset')->asValue(null);
- return Swift_Message::newInstance();
+ return new Swift_Message();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
index 7353d9d6a1..920faed9bf 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
@@ -1,19 +1,21 @@
<?php
-class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_contentEncoder;
- private $_cache;
- private $_grammar;
- private $_headers;
+ private $contentEncoder;
+ private $cache;
+ private $headers;
+ private $emailValidator;
protected function setUp()
{
- $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ $this->cache = new Swift_KeyCache_ArrayKeyCache(
new Swift_KeyCache_SimpleKeyCacheInputStream()
);
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
- $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+ $this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
@@ -21,15 +23,16 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
- $this->_grammar = new Swift_Mime_Grammar();
- $this->_headers = new Swift_Mime_SimpleHeaderSet(
- new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ $this->emailValidator = new EmailValidator();
+ $this->idGenerator = new Swift_Mime_IdGenerator('example.com');
+ $this->headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->emailValidator)
);
}
public function testDispositionIsSetInHeader()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setDisposition('inline');
$this->assertEquals(
@@ -42,7 +45,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testDispositionIsAttachmentByDefault()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$this->assertEquals(
'Content-Type: application/pdf'."\r\n".
@@ -54,7 +57,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFilenameIsSetInHeader()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$this->assertEquals(
@@ -67,7 +70,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testSizeIsSetInHeader()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setSize(12340);
$this->assertEquals(
@@ -80,7 +83,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleParametersInHeader()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setSize(12340);
@@ -94,7 +97,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testEndToEnd()
{
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setSize(12340);
@@ -109,13 +112,13 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
);
}
- protected function _createAttachment()
+ protected function createAttachment()
{
$entity = new Swift_Mime_Attachment(
- $this->_headers,
- $this->_contentEncoder,
- $this->_cache,
- $this->_grammar
+ $this->headers,
+ $this->contentEncoder,
+ $this->cache,
+ $this->idGenerator
);
return $entity;
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 a72f5ff45f..a87b30ee6d 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php
@@ -1,30 +1,30 @@
<?php
-class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_encoder;
+ private $samplesDir;
+ private $encoder;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
- $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+ $this->samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
}
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
@@ -35,7 +35,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPU
$is = new Swift_ByteStream_ArrayByteStream();
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$encoded = '';
while (false !== $bytes = $is->read(8192)) {
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 0dfc4e2288..bf0a04eea2 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php
@@ -1,34 +1,34 @@
<?php
-class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
protected $_samplesDir;
/**
* @var Swift_Mime_ContentEncoder_NativeQpContentEncoder
*/
- protected $_encoder;
+ protected $encoder;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
- $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder();
+ $this->samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder();
}
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
@@ -38,7 +38,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH
$os->write($text);
$is = new Swift_ByteStream_ArrayByteStream();
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$encoded = '';
while (false !== $bytes = $is->read(8192)) {
@@ -60,7 +60,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH
public function testEncodingAndDecodingSamplesFromDiConfiguredInstance()
{
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertSame('=C3=A4=C3=B6=C3=BC=C3=9F', $encoder->encodeString('äöüß'));
}
@@ -69,17 +69,17 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH
*/
public function testCharsetChangeNotImplemented()
{
- $this->_encoder->charsetChanged('utf-8');
- $this->_encoder->charsetChanged('charset');
- $this->_encoder->encodeString('foo');
+ $this->encoder->charsetChanged('utf-8');
+ $this->encoder->charsetChanged('charset');
+ $this->encoder->encodeString('foo');
}
public function testGetName()
{
- $this->assertSame('quoted-printable', $this->_encoder->getName());
+ $this->assertSame('quoted-printable', $this->encoder->getName());
}
- private function _createEncoderFromContainer()
+ private function createEncoderFromContainer()
{
return Swift_DependencyContainer::getInstance()
->lookup('mime.nativeqpcontentencoder')
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 5eff4e2fbc..544873a92f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php
@@ -1,35 +1,35 @@
<?php
-class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_encoder;
+ private $samplesDir;
+ private $encoder;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
- $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');
+ $this->samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');
}
public function testEncodingAndDecodingSamplesString()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
$text = file_get_contents($sampleDir.'/'.$sampleFile);
- $encodedText = $this->_encoder->encodeString($text);
+ $encodedText = $this->encoder->encodeString($text);
$this->assertEquals(
$encodedText, $text,
@@ -45,18 +45,18 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUn
public function testEncodingAndDecodingSamplesByteStream()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
@@ -67,7 +67,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUn
$is = new Swift_ByteStream_ArrayByteStream();
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$encoded = '';
while (false !== $bytes = $is->read(8192)) {
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 a383b5840a..26d1a9bd2a 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
@@ -1,14 +1,14 @@
<?php
-class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_samplesDir;
- private $_factory;
+ private $samplesDir;
+ private $factory;
protected function setUp()
{
- $this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
- $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
+ $this->samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
+ $this->factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
}
protected function tearDown()
@@ -18,23 +18,23 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
public function testEncodingAndDecodingSamples()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
$encoding = $encodingDir;
$charStream = new Swift_CharacterStream_NgCharacterStream(
- $this->_factory, $encoding);
+ $this->factory, $encoding);
$encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
@@ -65,21 +65,21 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
public function testEncodingAndDecodingSamplesFromDiConfiguredInstance()
{
- $sampleFp = opendir($this->_samplesDir);
+ $sampleFp = opendir($this->samplesDir);
while (false !== $encodingDir = readdir($sampleFp)) {
- if (substr($encodingDir, 0, 1) == '.') {
+ if ('.' == substr($encodingDir, 0, 1)) {
continue;
}
$encoding = $encodingDir;
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
- $sampleDir = $this->_samplesDir.'/'.$encodingDir;
+ $sampleDir = $this->samplesDir.'/'.$encodingDir;
if (is_dir($sampleDir)) {
$fileFp = opendir($sampleDir);
while (false !== $sampleFile = readdir($fileFp)) {
- if (substr($sampleFile, 0, 1) == '.') {
+ if ('.' == substr($sampleFile, 0, 1)) {
continue;
}
@@ -110,25 +110,25 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
public function testEncodingLFTextWithDiConfiguredInstance()
{
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\nb\nc"));
}
public function testEncodingCRTextWithDiConfiguredInstance()
{
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\rb\rc"));
}
public function testEncodingLFCRTextWithDiConfiguredInstance()
{
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a\r\n\r\nb\r\n\r\nc", $encoder->encodeString("a\n\rb\n\rc"));
}
public function testEncodingCRLFTextWithDiConfiguredInstance()
{
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a\r\nb\r\nc", $encoder->encodeString("a\r\nb\r\nc"));
}
@@ -136,11 +136,11 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
{
// Enable DotEscaping
Swift_Preferences::getInstance()->setQPDotEscape(true);
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a=2E\r\n=2E\r\n=2Eb\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc"));
// Return to default
Swift_Preferences::getInstance()->setQPDotEscape(false);
- $encoder = $this->_createEncoderFromContainer();
+ $encoder = $this->createEncoderFromContainer();
$this->assertEquals("a.\r\n.\r\n.b\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc"));
}
@@ -151,7 +151,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
$this->testEncodingAndDecodingSamplesFromDiConfiguredInstance();
}
- private function _createEncoderFromContainer()
+ private function createEncoderFromContainer()
{
return Swift_DependencyContainer::getInstance()
->lookup('mime.qpcontentencoder')
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
index 0f7aa728af..5603a67d71 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
@@ -1,19 +1,21 @@
<?php
-class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_contentEncoder;
- private $_cache;
- private $_grammar;
- private $_headers;
+ private $contentEncoder;
+ private $cache;
+ private $headers;
+ private $emailValidator;
protected function setUp()
{
- $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ $this->cache = new Swift_KeyCache_ArrayKeyCache(
new Swift_KeyCache_SimpleKeyCacheInputStream()
);
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
- $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+ $this->contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
@@ -21,15 +23,16 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
- $this->_grammar = new Swift_Mime_Grammar();
- $this->_headers = new Swift_Mime_SimpleHeaderSet(
- new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ $this->emailValidator = new EmailValidator();
+ $this->idGenerator = new Swift_Mime_IdGenerator('example.com');
+ $this->headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->emailValidator)
);
}
public function testContentIdIsSetInHeader()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$file->setContentType('application/pdf');
$file->setId('foo@bar');
$this->assertEquals(
@@ -43,7 +46,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testDispositionIsSetInHeader()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$id = $file->getId();
$file->setContentType('application/pdf');
$file->setDisposition('attachment');
@@ -58,7 +61,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFilenameIsSetInHeader()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$id = $file->getId();
$file->setContentType('application/pdf');
$file->setFilename('foo.pdf');
@@ -73,7 +76,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testSizeIsSetInHeader()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$id = $file->getId();
$file->setContentType('application/pdf');
$file->setSize(12340);
@@ -88,7 +91,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleParametersInHeader()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$id = $file->getId();
$file->setContentType('application/pdf');
$file->setFilename('foo.pdf');
@@ -105,7 +108,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testEndToEnd()
{
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$id = $file->getId();
$file->setContentType('application/pdf');
$file->setFilename('foo.pdf');
@@ -122,13 +125,13 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
);
}
- protected function _createEmbeddedFile()
+ protected function createEmbeddedFile()
{
$entity = new Swift_Mime_EmbeddedFile(
- $this->_headers,
- $this->_contentEncoder,
- $this->_cache,
- $this->_grammar
+ $this->headers,
+ $this->contentEncoder,
+ $this->cache,
+ $this->idGenerator
);
return $entity;
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 e3fad6debe..13795135e1 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php
@@ -1,12 +1,12 @@
<?php
-class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_encoder;
+ private $encoder;
protected function setUp()
{
- $this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();
+ $this->encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();
}
public function testEncodingJIS()
@@ -15,14 +15,14 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUni
// base64_encode and split cannot handle long JIS text to fold
$subject = '長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い件名';
- $encodedWrapperLength = strlen('=?iso-2022-jp?'.$this->_encoder->getName().'??=');
+ $encodedWrapperLength = strlen('=?iso-2022-jp?'.$this->encoder->getName().'??=');
$old = mb_internal_encoding();
mb_internal_encoding('utf-8');
$newstring = mb_encode_mimeheader($subject, 'iso-2022-jp', 'B', "\r\n");
mb_internal_encoding($old);
- $encoded = $this->_encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp');
+ $encoded = $this->encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp');
$this->assertEquals(
$encoded, $newstring,
'Encoded string should decode back to original string for sample '
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
index a7f6fc517a..5a12daad7a 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
@@ -1,23 +1,25 @@
<?php
-class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- private $_contentEncoder;
- private $_cache;
- private $_grammar;
- private $_headers;
+ private $contentEncoder;
+ private $cache;
+ private $headers;
+ private $emailValidator;
protected function setUp()
{
- $this->_cache = new Swift_KeyCache_ArrayKeyCache(
+ $this->cache = new Swift_KeyCache_ArrayKeyCache(
new Swift_KeyCache_SimpleKeyCacheInputStream()
);
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
- $this->_contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
+ $this->contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'),
new Swift_StreamFilters_ByteArrayReplacementFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
)
);
@@ -27,15 +29,16 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
- $this->_grammar = new Swift_Mime_Grammar();
- $this->_headers = new Swift_Mime_SimpleHeaderSet(
- new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar)
+ $this->emailValidator = new EmailValidator();
+ $this->idGenerator = new Swift_Mime_IdGenerator('example.com');
+ $this->headers = new Swift_Mime_SimpleHeaderSet(
+ new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->emailValidator)
);
}
public function testCharsetIsSetInHeader()
{
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('utf-8');
$part->setBody('foobar');
@@ -50,7 +53,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFormatIsSetInHeaders()
{
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setFormat('flowed');
$part->setBody('> foobar');
@@ -65,7 +68,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testDelSpIsSetInHeaders()
{
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setDelSp(true);
$part->setBody('foobar');
@@ -80,7 +83,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testAll3ParamsInHeaders()
{
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('utf-8');
$part->setFormat('fixed');
@@ -97,7 +100,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testBodyIsCanonicalized()
{
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('utf-8');
$part->setBody("foobar\r\rtest\ning\r");
@@ -113,14 +116,14 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
);
}
- protected function _createMimePart()
+ protected function createMimePart()
{
$entity = new Swift_Mime_MimePart(
- $this->_headers,
- $this->_contentEncoder,
- $this->_cache,
- $this->_grammar
- );
+ $this->headers,
+ $this->contentEncoder,
+ $this->cache,
+ $this->idGenerator
+ );
return $entity;
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
index 912768eeaf..1d981e784d 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
@@ -12,12 +12,12 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
/* -- RFC 2822, 3.6.
*/
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
'Content-Type: text/plain'."\r\n".
@@ -29,13 +29,13 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testSubjectIsDisplayedIfSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -47,13 +47,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testDateCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$id = $message->getId();
- $message->setDate(1234);
+ $date = new DateTimeImmutable();
+ $message->setDate($date);
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', 1234)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -65,13 +66,13 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMessageIdCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setId('foo@bar');
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <foo@bar>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -83,14 +84,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testContentTypeCanBeChanged()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setContentType('text/html');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -102,7 +103,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testCharsetCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setContentType('text/html');
$message->setCharset('iso-8859-1');
@@ -110,7 +111,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -122,14 +123,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFormatCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setFormat('flowed');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -141,7 +142,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testEncoderCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setContentType('text/html');
$message->setEncoder(
@@ -151,7 +152,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -163,14 +164,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFromAddressCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setFrom('chris.corbyn@swiftmailer.org');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: chris.corbyn@swiftmailer.org'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -182,14 +183,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testFromAddressCanBeSetWithName()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris Corbyn'));
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris Corbyn']);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -201,17 +202,17 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleFromAddressesCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array(
+ $message->setFrom([
'chris.corbyn@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org',
- ));
+ ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>, mark@swiftmailer.org'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -223,17 +224,17 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testReturnPathAddressCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -245,17 +246,17 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testEmptyReturnPathHeaderCanBeUsed()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Return-Path: <>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -267,7 +268,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testSenderCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
$message->setSender('chris.corbyn@swiftmailer.org');
$id = $message->getId();
@@ -275,7 +276,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Sender: chris.corbyn@swiftmailer.org'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -287,15 +288,15 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testSenderCanBeSetWithName()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setSender(array('chris.corbyn@swiftmailer.org' => 'Chris'));
+ $message->setSender(['chris.corbyn@swiftmailer.org' => 'Chris']);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Sender: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: '."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -307,15 +308,15 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testReplyToCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array('chris@w3style.co.uk' => 'Myself'));
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo(['chris@w3style.co.uk' => 'Myself']);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>'."\r\n".
@@ -328,18 +329,18 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleReplyAddressCanBeUsed()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
+ ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -352,19 +353,19 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testToAddressCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
+ ]);
$message->setTo('mark@swiftmailer.org');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -378,21 +379,21 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleToAddressesCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
- $message->setTo(array(
+ ]);
+ $message->setTo([
'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
+ ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -406,22 +407,22 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testCcAddressCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
- $message->setTo(array(
+ ]);
+ $message->setTo([
'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
+ ]);
$message->setCc('john@some-site.com');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -436,25 +437,25 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testMultipleCcAddressesCanBeSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
- $message->setTo(array(
+ ]);
+ $message->setTo([
'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
- $message->setCc(array(
+ ]);
+ $message->setCc([
'john@some-site.com' => 'John West',
'fred@another-site.co.uk' => 'Big Fred',
- ));
+ ]);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -471,26 +472,26 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
{
//Obviously Transports need to setBcc(array()) and send to each Bcc recipient
// separately in accordance with RFC 2822/2821
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
- $message->setTo(array(
+ ]);
+ $message->setTo([
'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
- $message->setCc(array(
+ ]);
+ $message->setCc([
'john@some-site.com' => 'John West',
'fred@another-site.co.uk' => 'Big Fred',
- ));
+ ]);
$message->setBcc('x@alphabet.tld');
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -508,26 +509,26 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
{
//Obviously Transports need to setBcc(array()) and send to each Bcc recipient
// separately in accordance with RFC 2822/2821
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setSubject('just a test subject');
- $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris'));
- $message->setReplyTo(array(
+ $message->setFrom(['chris.corbyn@swiftmailer.org' => 'Chris']);
+ $message->setReplyTo([
'chris@w3style.co.uk' => 'Myself',
'my.other@address.com' => 'Me',
- ));
- $message->setTo(array(
+ ]);
+ $message->setTo([
'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
- $message->setCc(array(
+ ]);
+ $message->setCc([
'john@some-site.com' => 'John West',
'fred@another-site.co.uk' => 'Big Fred',
- ));
- $message->setBcc(array('x@alphabet.tld', 'a@alphabet.tld' => 'A'));
+ ]);
+ $message->setBcc(['x@alphabet.tld', 'a@alphabet.tld' => 'A']);
$id = $message->getId();
$date = $message->getDate();
$this->assertEquals(
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris <chris.corbyn@swiftmailer.org>'."\r\n".
'Reply-To: Myself <chris@w3style.co.uk>, Me <my.other@address.com>'."\r\n".
@@ -543,11 +544,11 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testStringBodyIsAppended()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setBody(
'just a test body'."\r\n".
'with a new line'
@@ -557,7 +558,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -572,11 +573,11 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testStringBodyIsEncoded()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setBody(
'Just s'.pack('C*', 0xC2, 0x01, 0x01).'me multi-'."\r\n".
'line message!'
@@ -586,7 +587,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -601,24 +602,24 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testChildrenCanBeAttached()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
$date = $message->getDate();
$boundary = $message->getBoundary();
- $part1 = $this->_createMimePart();
+ $part1 = $this->createMimePart();
$part1->setContentType('text/plain');
$part1->setCharset('iso-8859-1');
$part1->setBody('foo');
$message->attach($part1);
- $part2 = $this->_createMimePart();
+ $part2 = $this->createMimePart();
$part2->setContentType('text/html');
$part2->setCharset('iso-8859-1');
$part2->setBody('test <b>foo</b>');
@@ -628,7 +629,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -654,24 +655,24 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testAttachmentsBeingAttached()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('iso-8859-1');
$part->setBody('foo');
$message->attach($part);
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setBody('<pdf data>');
@@ -716,31 +717,31 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testAttachmentsAndEmbeddedFilesBeingAttached()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('iso-8859-1');
$part->setBody('foo');
$message->attach($part);
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setBody('<pdf data>');
$message->attach($attachment);
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$file->setContentType('image/jpeg');
$file->setFilename('myimage.jpg');
$file->setBody('<image data>');
@@ -802,29 +803,29 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testComplexEmbeddingOfContent()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setBody('<pdf data>');
$message->attach($attachment);
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$file->setContentType('image/jpeg');
$file->setFilename('myimage.jpg');
$file->setBody('<image data>');
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/html');
$part->setCharset('iso-8859-1');
$part->setBody('foo <img src="'.$message->embed($file).'" />');
@@ -879,31 +880,31 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testAttachingAndDetachingContent()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
- $part = $this->_createMimePart();
+ $part = $this->createMimePart();
$part->setContentType('text/plain');
$part->setCharset('iso-8859-1');
$part->setBody('foo');
$message->attach($part);
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setBody('<pdf data>');
$message->attach($attachment);
- $file = $this->_createEmbeddedFile();
+ $file = $this->createEmbeddedFile();
$file->setContentType('image/jpeg');
$file->setFilename('myimage.jpg');
$file->setBody('<image data>');
@@ -954,24 +955,24 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testBoundaryDoesNotAppearAfterAllPartsAreDetached()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
$date = $message->getDate();
$boundary = $message->getBoundary();
- $part1 = $this->_createMimePart();
+ $part1 = $this->createMimePart();
$part1->setContentType('text/plain');
$part1->setCharset('iso-8859-1');
$part1->setBody('foo');
$message->attach($part1);
- $part2 = $this->_createMimePart();
+ $part2 = $this->createMimePart();
$part2->setContentType('text/html');
$part2->setCharset('iso-8859-1');
$part2->setBody('test <b>foo</b>');
@@ -984,7 +985,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -997,11 +998,11 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testCharsetFormatOrDelSpAreNotShownWhenBoundaryIsSet()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setCharset('utf-8');
$message->setFormat('flowed');
$message->setDelSp(true);
@@ -1010,14 +1011,14 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$date = $message->getDate();
$boundary = $message->getBoundary();
- $part1 = $this->_createMimePart();
+ $part1 = $this->createMimePart();
$part1->setContentType('text/plain');
$part1->setCharset('iso-8859-1');
$part1->setBody('foo');
$message->attach($part1);
- $part2 = $this->_createMimePart();
+ $part2 = $this->createMimePart();
$part2->setContentType('text/html');
$part2->setCharset('iso-8859-1');
$part2->setBody('test <b>foo</b>');
@@ -1027,7 +1028,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -1053,20 +1054,20 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testBodyCanBeSetWithAttachments()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setContentType('text/html');
$message->setCharset('iso-8859-1');
$message->setBody('foo');
$id = $message->getId();
- $date = date('r', $message->getDate());
+ $date = $message->getDate()->format('r');
$boundary = $message->getBoundary();
- $attachment = $this->_createAttachment();
+ $attachment = $this->createAttachment();
$attachment->setContentType('application/pdf');
$attachment->setFilename('foo.pdf');
$attachment->setBody('<pdf data>');
@@ -1103,21 +1104,21 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testHtmlPartAlwaysAppearsLast()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$id = $message->getId();
- $date = date('r', $message->getDate());
+ $date = $message->getDate()->format('r');
$boundary = $message->getBoundary();
- $part1 = $this->_createMimePart();
+ $part1 = $this->createMimePart();
$part1->setContentType('text/html');
$part1->setBody('foo');
- $part2 = $this->_createMimePart();
+ $part2 = $this->createMimePart();
$part2->setContentType('text/plain');
$part2->setBody('bar');
@@ -1153,19 +1154,19 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testBodyBecomesPartIfOtherPartsAttached()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setContentType('text/html');
$message->setBody('foo');
$id = $message->getId();
- $date = date('r', $message->getDate());
+ $date = $message->getDate()->format('r');
$boundary = $message->getBoundary();
- $part2 = $this->_createMimePart();
+ $part2 = $this->createMimePart();
$part2->setContentType('text/plain');
$part2->setBody('bar');
@@ -1200,11 +1201,11 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
public function testBodyIsCanonicalized()
{
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->setReturnPath('chris@w3style.co.uk');
$message->setSubject('just a test subject');
- $message->setFrom(array(
- 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ));
+ $message->setFrom([
+ 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', ]);
$message->setBody(
'just a test body'."\n".
'with a new line'
@@ -1214,7 +1215,7 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(
'Return-Path: <chris@w3style.co.uk>'."\r\n".
'Message-ID: <'.$id.'>'."\r\n".
- 'Date: '.date('r', $date)."\r\n".
+ 'Date: '.$date->format('r')."\r\n".
'Subject: just a test subject'."\r\n".
'From: Chris Corbyn <chris.corbyn@swiftmailer.org>'."\r\n".
'MIME-Version: 1.0'."\r\n".
@@ -1227,22 +1228,22 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
);
}
- protected function _createMessage()
+ protected function createMessage()
{
return new Swift_Message();
}
- protected function _createMimePart()
+ protected function createMimePart()
{
return new Swift_MimePart();
}
- protected function _createAttachment()
+ protected function createAttachment()
{
return new Swift_Attachment();
}
- protected function _createEmbeddedFile()
+ protected function createEmbeddedFile()
{
return new Swift_EmbeddedFile();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php
index f42405dfd1..581afc7db7 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php
@@ -5,11 +5,11 @@ require_once __DIR__.'/Mime/MimePartAcceptanceTest.php';
class Swift_MimePartAcceptanceTest extends Swift_Mime_MimePartAcceptanceTest
{
- protected function _createMimePart()
+ protected function createMimePart()
{
Swift_DependencyContainer::getInstance()
->register('properties.charset')->asValue(null);
- return Swift_MimePart::newInstance();
+ return new Swift_MimePart();
}
}
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 21abc13112..9bc09f88ad 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
@@ -1,10 +1,10 @@
<?php
-abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit_Framework_TestCase
+abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit\Framework\TestCase
{
- protected $_buffer;
+ protected $buffer;
- abstract protected function _initializeBuffer();
+ abstract protected function initializeBuffer();
protected function setUp()
{
@@ -15,49 +15,49 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e
);
}
- $this->_buffer = new Swift_Transport_StreamBuffer(
+ $this->buffer = new Swift_Transport_StreamBuffer(
$this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
);
}
public function testReadLine()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
- $line = $this->_buffer->readLine(0);
+ $line = $this->buffer->readLine(0);
$this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
- $seq = $this->_buffer->write("QUIT\r\n");
+ $seq = $this->buffer->write("QUIT\r\n");
$this->assertTrue((bool) $seq);
- $line = $this->_buffer->readLine($seq);
+ $line = $this->buffer->readLine($seq);
$this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
- $this->_buffer->terminate();
+ $this->buffer->terminate();
}
public function testWrite()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
- $line = $this->_buffer->readLine(0);
+ $line = $this->buffer->readLine(0);
$this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
- $seq = $this->_buffer->write("HELO foo\r\n");
+ $seq = $this->buffer->write("HELO foo\r\n");
$this->assertTrue((bool) $seq);
- $line = $this->_buffer->readLine($seq);
+ $line = $this->buffer->readLine($seq);
$this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
- $seq = $this->_buffer->write("QUIT\r\n");
+ $seq = $this->buffer->write("QUIT\r\n");
$this->assertTrue((bool) $seq);
- $line = $this->_buffer->readLine($seq);
+ $line = $this->buffer->readLine($seq);
$this->assertRegExp('/^[0-9]{3}.*?\r\n$/D', $line);
- $this->_buffer->terminate();
+ $this->buffer->terminate();
}
public function testBindingOtherStreamsMirrorsWriteOperations()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->at(0))
->method('write')
@@ -72,37 +72,37 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e
->method('write')
->with('y');
- $this->_buffer->bind($is1);
- $this->_buffer->bind($is2);
+ $this->buffer->bind($is1);
+ $this->buffer->bind($is2);
- $this->_buffer->write('x');
- $this->_buffer->write('y');
+ $this->buffer->write('x');
+ $this->buffer->write('y');
}
public function testBindingOtherStreamsMirrorsFlushOperations()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->once())
->method('flushBuffers');
$is2->expects($this->once())
->method('flushBuffers');
- $this->_buffer->bind($is1);
- $this->_buffer->bind($is2);
+ $this->buffer->bind($is1);
+ $this->buffer->bind($is2);
- $this->_buffer->flushBuffers();
+ $this->buffer->flushBuffers();
}
public function testUnbindingStreamPreventsFurtherWrites()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
- $is1 = $this->_createMockInputStream();
- $is2 = $this->_createMockInputStream();
+ $is1 = $this->createMockInputStream();
+ $is2 = $this->createMockInputStream();
$is1->expects($this->at(0))
->method('write')
@@ -114,17 +114,17 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest e
->method('write')
->with('x');
- $this->_buffer->bind($is1);
- $this->_buffer->bind($is2);
+ $this->buffer->bind($is1);
+ $this->buffer->bind($is2);
- $this->_buffer->write('x');
+ $this->buffer->write('x');
- $this->_buffer->unbind($is2);
+ $this->buffer->unbind($is2);
- $this->_buffer->write('y');
+ $this->buffer->write('y');
}
- private function _createMockInputStream()
+ 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 4c3c7d3a3c..739a7ece40 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php
@@ -15,19 +15,19 @@ class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest extends Swift_Trans
parent::setUp();
}
- protected function _initializeBuffer()
+ protected function initializeBuffer()
{
$parts = explode(':', SWIFT_SMTP_HOST);
$host = $parts[0];
- $port = isset($parts[1]) ? $parts[1] : 25;
+ $port = $parts[1] ?? 25;
- $this->_buffer->initialize(array(
+ $this->buffer->initialize([
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
'host' => $host,
'port' => $port,
'protocol' => 'tcp',
'blocking' => 1,
'timeout' => 15,
- ));
+ ]);
}
}
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 a37439d7cb..34ef3cbe48 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php
@@ -16,11 +16,11 @@ class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport
parent::setUp();
}
- protected function _initializeBuffer()
+ protected function initializeBuffer()
{
- $this->_buffer->initialize(array(
+ $this->buffer->initialize([
'type' => Swift_Transport_IoBuffer::TYPE_PROCESS,
'command' => SWIFT_SENDMAIL_PATH.' -bs',
- ));
+ ]);
}
}
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 59362b0179..67073f895e 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
@@ -1,12 +1,10 @@
<?php
-class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_TestCase
+class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit\Framework\TestCase
{
- protected $_buffer;
-
- protected $_randomHighPort;
-
- protected $_server;
+ protected $buffer;
+ protected $server;
+ protected $randomHighPort;
protected function setUp()
{
@@ -19,39 +17,39 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_
$serverStarted = false;
for ($i = 0; $i < 5; ++$i) {
- $this->_randomHighPort = rand(50000, 65000);
- $this->_server = stream_socket_server('tcp://127.0.0.1:'.$this->_randomHighPort);
- if ($this->_server) {
+ $this->randomHighPort = random_int(50000, 65000);
+ $this->server = stream_socket_server('tcp://127.0.0.1:'.$this->randomHighPort);
+ if ($this->server) {
$serverStarted = true;
}
}
- $this->_buffer = new Swift_Transport_StreamBuffer(
+ $this->buffer = new Swift_Transport_StreamBuffer(
$this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
);
}
- protected function _initializeBuffer()
+ protected function initializeBuffer()
{
$host = '127.0.0.1';
- $port = $this->_randomHighPort;
+ $port = $this->randomHighPort;
- $this->_buffer->initialize(array(
+ $this->buffer->initialize([
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
'host' => $host,
'port' => $port,
'protocol' => 'tcp',
'blocking' => 1,
'timeout' => 1,
- ));
+ ]);
}
public function testTimeoutException()
{
- $this->_initializeBuffer();
+ $this->initializeBuffer();
$e = null;
try {
- $line = $this->_buffer->readLine(0);
+ $line = $this->buffer->readLine(0);
} catch (Exception $e) {
}
$this->assertInstanceOf('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout');
@@ -60,8 +58,8 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_
protected function tearDown()
{
- if ($this->_server) {
- stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR);
+ 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 32e0fe8497..e3bee2c8c7 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php
@@ -22,19 +22,19 @@ class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest extends Swift_Transpo
parent::setUp();
}
- protected function _initializeBuffer()
+ protected function initializeBuffer()
{
$parts = explode(':', SWIFT_SSL_HOST);
$host = $parts[0];
- $port = isset($parts[1]) ? $parts[1] : 25;
+ $port = $parts[1] ?? 25;
- $this->_buffer->initialize(array(
+ $this->buffer->initialize([
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
'host' => $host,
'port' => $port,
'protocol' => 'ssl',
'blocking' => 1,
'timeout' => 15,
- ));
+ ]);
}
}
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 1053a877e4..a5092a249b 100644
--- a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php
@@ -21,19 +21,19 @@ class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transpo
parent::setUp();
}
- protected function _initializeBuffer()
+ protected function initializeBuffer()
{
$parts = explode(':', SWIFT_TLS_HOST);
$host = $parts[0];
- $port = isset($parts[1]) ? $parts[1] : 25;
+ $port = $parts[1] ?? 25;
- $this->_buffer->initialize(array(
+ $this->buffer->initialize([
'type' => Swift_Transport_IoBuffer::TYPE_SOCKET,
'host' => $host,
'port' => $port,
'protocol' => 'tls',
'blocking' => 1,
'timeout' => 15,
- ));
+ ]);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php
index ba29ba87a9..e9085a99fe 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php
@@ -1,34 +1,34 @@
<?php
-class Swift_Bug111Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug111Test extends \PHPUnit\Framework\TestCase
{
public function testUnstructuredHeaderSlashesShouldNotBeEscaped()
{
- $complicated_header = array(
- 'to' => array(
+ $complicated_header = [
+ 'to' => [
'email1@example.com',
'email2@example.com',
'email3@example.com',
'email4@example.com',
'email5@example.com',
- ),
- 'sub' => array(
- '-name-' => array(
+ ],
+ 'sub' => [
+ '-name-' => [
'email1',
'"email2"',
'email3\\',
'email4',
'email5',
- ),
- '-url-' => array(
+ ],
+ '-url-' => [
'http://google.com',
'http://yahoo.com',
'http://hotmail.com',
'http://aol.com',
'http://facebook.com',
- ),
- ),
- );
+ ],
+ ],
+ ];
$json = json_encode($complicated_header);
$message = new Swift_Message();
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php
index 40b5a772c4..34aa13635e 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php
@@ -1,19 +1,19 @@
<?php
-class Swift_Bug118Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug118Test extends \PHPUnit\Framework\TestCase
{
- private $_message;
+ private $message;
protected function setUp()
{
- $this->_message = new Swift_Message();
+ $this->message = new Swift_Message();
}
public function testCallingGenerateIdChangesTheMessageId()
{
- $currentId = $this->_message->getId();
- $this->_message->generateId();
- $newId = $this->_message->getId();
+ $currentId = $this->message->getId();
+ $this->message->generateId();
+ $newId = $this->message->getId();
$this->assertNotEquals($currentId, $newId);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
index 7563f4d390..67c95510d9 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php
@@ -1,8 +1,10 @@
<?php
-class Swift_Bug206Test extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Bug206Test extends \PHPUnit\Framework\TestCase
{
- private $_factory;
+ private $factory;
protected function setUp()
{
@@ -13,23 +15,23 @@ class Swift_Bug206Test extends \PHPUnit_Framework_TestCase
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
- $grammar = new Swift_Mime_Grammar();
- $this->_factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar);
+ $emailValidator = new EmailValidator();
+ $this->factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator);
}
public function testMailboxHeaderEncoding()
{
- $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Name, Name', ' "Family Name, Name" <email@example.org>');
- $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé, Name', ' Family =?utf-8?Q?Nam=C3=A9=2C?= Name');
- $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé , Name', ' Family =?utf-8?Q?Nam=C3=A9_=2C?= Name');
- $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé ;Name', ' Family =?utf-8?Q?Nam=C3=A9_=3BName?= ');
+ $this->doTestHeaderIsFullyEncoded('email@example.org', 'Family Name, Name', ' "Family Name, Name" <email@example.org>');
+ $this->doTestHeaderIsFullyEncoded('email@example.org', 'Family Namé, Name', ' Family =?utf-8?Q?Nam=C3=A9=2C?= Name');
+ $this->doTestHeaderIsFullyEncoded('email@example.org', 'Family Namé , Name', ' Family =?utf-8?Q?Nam=C3=A9_=2C?= Name');
+ $this->doTestHeaderIsFullyEncoded('email@example.org', 'Family Namé ;Name', ' Family =?utf-8?Q?Nam=C3=A9_=3BName?= ');
}
- private function _testHeaderIsFullyEncoded($email, $name, $expected)
+ private function doTestHeaderIsFullyEncoded($email, $name, $expected)
{
- $mailboxHeader = $this->_factory->createMailboxHeader('To', array(
+ $mailboxHeader = $this->factory->createMailboxHeader('To', [
$email => $name,
- ));
+ ]);
$headerBody = substr($mailboxHeader->toString(), 3, strlen($expected));
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php
index f5f057aeed..ddf6ca13d6 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug274Test.php
@@ -1,11 +1,14 @@
<?php
-class Swift_Bug274Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug274Test extends \PHPUnit\Framework\TestCase
{
+ /**
+ * @expectedException \Swift_IoException
+ * @expectedMessageException The path cannot be empty
+ */
public function testEmptyFileNameAsAttachment()
{
$message = new Swift_Message();
- $this->setExpectedException('Swift_IoException', 'The path cannot be empty');
$message->attach(Swift_Attachment::fromPath(''));
}
@@ -17,5 +20,6 @@ class Swift_Bug274Test extends \PHPUnit_Framework_TestCase
} catch (Exception $e) {
$this->fail('Path should not be empty');
}
+ $this->addToAssertionCount(1);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php
index 768bf3d8fc..0c8dd17553 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Bug34Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug34Test extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
@@ -9,23 +9,23 @@ class Swift_Bug34Test extends \PHPUnit_Framework_TestCase
public function testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentAsAnAlternative()
{
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
$message->setCharset('utf-8');
$message->setSubject('test subject');
$message->addPart('plain part', 'text/plain');
- $image = Swift_Image::newInstance('<image data>', 'image.gif', 'image/gif');
+ $image = new Swift_Image('<image data>', 'image.gif', 'image/gif');
$cid = $message->embed($image);
$message->setBody('<img src="'.$cid.'" />', 'text/html');
- $message->setTo(array('user@domain.tld' => 'User'));
+ $message->setTo(['user@domain.tld' => 'User']);
- $message->setFrom(array('other@domain.tld' => 'Other'));
- $message->setSender(array('other@domain.tld' => 'Other'));
+ $message->setFrom(['other@domain.tld' => 'Other']);
+ $message->setSender(['other@domain.tld' => 'Other']);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$cidVal = $image->getId();
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php
index 98999f04bf..66644e93e1 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Bug35Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug35Test extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
@@ -9,23 +9,23 @@ class Swift_Bug35Test extends \PHPUnit_Framework_TestCase
public function testHTMLPartAppearsLastEvenWhenAttachmentsAdded()
{
- $message = Swift_Message::newInstance();
+ $message = new Swift_Message();
$message->setCharset('utf-8');
$message->setSubject('test subject');
$message->addPart('plain part', 'text/plain');
- $attachment = Swift_Attachment::newInstance('<data>', 'image.gif', 'image/gif');
+ $attachment = new Swift_Attachment('<data>', 'image.gif', 'image/gif');
$message->attach($attachment);
$message->setBody('HTML part', 'text/html');
- $message->setTo(array('user@domain.tld' => 'User'));
+ $message->setTo(['user@domain.tld' => 'User']);
- $message->setFrom(array('other@domain.tld' => 'Other'));
- $message->setSender(array('other@domain.tld' => 'Other'));
+ $message->setFrom(['other@domain.tld' => 'Other']);
+ $message->setSender(['other@domain.tld' => 'Other']);
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$this->assertRegExp(
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php
index 9deae4f7b0..472c8058e0 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php
@@ -1,16 +1,16 @@
<?php
-class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug38Test extends \PHPUnit\Framework\TestCase
{
- private $_attFile;
- private $_attFileName;
- private $_attFileType;
+ private $attFile;
+ private $attFileName;
+ private $attFileType;
protected function setUp()
{
- $this->_attFileName = 'data.txt';
- $this->_attFileType = 'text/plain';
- $this->_attFile = __DIR__.'/../../_samples/files/data.txt';
+ $this->attFileName = 'data.txt';
+ $this->attFileType = 'text/plain';
+ $this->attFile = __DIR__.'/../../_samples/files/data.txt';
Swift_Preferences::getInstance()->setCharset('utf-8');
}
@@ -28,7 +28,7 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
$message->setBody('HTML part', 'text/html');
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$imgId = $image->getId();
@@ -82,7 +82,7 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
$message->setBody('HTML part', 'text/html');
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$imgId = $image->getId();
@@ -133,14 +133,14 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
$message->setCc('other@domain.tld');
$message->setFrom('user@domain.tld');
- $attachment = Swift_Attachment::fromPath($this->_attFile);
+ $attachment = Swift_Attachment::fromPath($this->attFile);
$message->attach($attachment);
$message->setBody('HTML part', 'text/html');
$id = $message->getId();
- $date = preg_quote(date('r', $message->getDate()), '~');
+ $date = preg_quote($message->getDate()->format('r'), '~');
$boundary = $message->getBoundary();
$streamA = new Swift_ByteStream_ArrayByteStream();
@@ -164,11 +164,11 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
'HTML part'.
"\r\n\r\n".
'--'.$boundary."\r\n".
- 'Content-Type: '.$this->_attFileType.'; name='.$this->_attFileName."\r\n".
+ 'Content-Type: '.$this->attFileType.'; name='.$this->attFileName."\r\n".
'Content-Transfer-Encoding: base64'."\r\n".
- 'Content-Disposition: attachment; filename='.$this->_attFileName."\r\n".
+ 'Content-Disposition: attachment; filename='.$this->attFileName."\r\n".
"\r\n".
- preg_quote(base64_encode(file_get_contents($this->_attFile)), '~').
+ preg_quote(base64_encode(file_get_contents($this->attFile)), '~').
"\r\n\r\n".
'--'.$boundary.'--'."\r\n".
'$~D'
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php
index b83984fec9..e4d1d7c047 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug518Test.php
@@ -2,7 +2,7 @@
use Mockery as m;
-class Swift_Bug518Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug518Test extends \SwiftMailerTestCase
{
public function testIfEmailChangesAfterQueued()
{
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php
index 48074f0e83..fdeb89b967 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php
@@ -2,41 +2,41 @@
class Swift_Bug51Test extends \SwiftMailerTestCase
{
- private $_attachmentFile;
- private $_outputFile;
+ private $attachmentFile;
+ private $outputFile;
protected function setUp()
{
- $this->_attachmentFile = sys_get_temp_dir().'/attach.rand.bin';
- file_put_contents($this->_attachmentFile, '');
+ $this->attachmentFile = sys_get_temp_dir().'/attach.rand.bin';
+ file_put_contents($this->attachmentFile, '');
- $this->_outputFile = sys_get_temp_dir().'/attach.out.bin';
- file_put_contents($this->_outputFile, '');
+ $this->outputFile = sys_get_temp_dir().'/attach.out.bin';
+ file_put_contents($this->outputFile, '');
}
protected function tearDown()
{
- unlink($this->_attachmentFile);
- unlink($this->_outputFile);
+ unlink($this->attachmentFile);
+ unlink($this->outputFile);
}
public function testAttachmentsDoNotGetTruncatedUsingToByteStream()
{
//Run 100 times with 10KB attachments
for ($i = 0; $i < 10; ++$i) {
- $message = $this->_createMessageWithRandomAttachment(
- 10000, $this->_attachmentFile
+ $message = $this->createMessageWithRandomAttachment(
+ 10000, $this->attachmentFile
);
- file_put_contents($this->_outputFile, '');
+ file_put_contents($this->outputFile, '');
$message->toByteStream(
- new Swift_ByteStream_FileByteStream($this->_outputFile, true)
+ new Swift_ByteStream_FileByteStream($this->outputFile, true)
);
- $emailSource = file_get_contents($this->_outputFile);
+ $emailSource = file_get_contents($this->outputFile);
$this->assertAttachmentFromSourceMatches(
- file_get_contents($this->_attachmentFile),
+ file_get_contents($this->attachmentFile),
$emailSource
);
}
@@ -46,14 +46,14 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
{
//Run 100 times with 10KB attachments
for ($i = 0; $i < 10; ++$i) {
- $message = $this->_createMessageWithRandomAttachment(
- 10000, $this->_attachmentFile
+ $message = $this->createMessageWithRandomAttachment(
+ 10000, $this->attachmentFile
);
$emailSource = $message->toString();
$this->assertAttachmentFromSourceMatches(
- file_get_contents($this->_attachmentFile),
+ file_get_contents($this->attachmentFile),
$emailSource
);
}
@@ -79,7 +79,7 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
$this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64));
}
- private function _fillFileWithRandomBytes($byteCount, $file)
+ private function fillFileWithRandomBytes($byteCount, $file)
{
// I was going to use dd with if=/dev/random but this way seems more
// cross platform even if a hella expensive!!
@@ -87,17 +87,17 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
file_put_contents($file, '');
$fp = fopen($file, 'wb');
for ($i = 0; $i < $byteCount; ++$i) {
- $byteVal = rand(0, 255);
+ $byteVal = random_int(0, 255);
fwrite($fp, pack('i', $byteVal));
}
fclose($fp);
}
- private function _createMessageWithRandomAttachment($size, $attachmentPath)
+ private function createMessageWithRandomAttachment($size, $attachmentPath)
{
- $this->_fillFileWithRandomBytes($size, $attachmentPath);
+ $this->fillFileWithRandomBytes($size, $attachmentPath);
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('test')
->setBody('test')
->setFrom('a@b.c')
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php
index 263cae51ac..6b224f1d9b 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug534Test.php
@@ -2,11 +2,11 @@
use Mockery as m;
-class Swift_Bug534Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug534Test extends \SwiftMailerTestCase
{
public function testEmbeddedImagesAreEmbedded()
{
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setFrom('from@example.com')
->setTo('to@example.com')
->setSubject('test')
@@ -15,7 +15,7 @@ class Swift_Bug534Test extends \PHPUnit_Framework_TestCase
$message->setBody('<img src="'.$cid.'" />', 'text/html');
$that = $this;
- $messageValidation = function (Swift_Mime_Message $message) use ($that) {
+ $messageValidation = function (Swift_Mime_SimpleMessage $message) use ($that) {
preg_match('/cid:(.*)"/', $message->toString(), $matches);
$cid = $matches[1];
preg_match('/Content-ID: <(.*)>/', $message->toString(), $matches);
@@ -25,7 +25,7 @@ class Swift_Bug534Test extends \PHPUnit_Framework_TestCase
return true;
};
- $failedRecipients = array();
+ $failedRecipients = [];
$transport = m::mock('Swift_Transport');
$transport->shouldReceive('isStarted')->andReturn(true);
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
index 3393fb8001..31036c6baa 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug650Test.php
@@ -1,6 +1,8 @@
<?php
-class Swift_Bug650Test extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Bug650Test extends \PHPUnit\Framework\TestCase
{
/**
* @dataProvider encodingDataProvider
@@ -13,24 +15,24 @@ class Swift_Bug650Test extends \PHPUnit_Framework_TestCase
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
$charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8');
$encoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream);
- $header = new Swift_Mime_Headers_MailboxHeader('To', $encoder, new Swift_Mime_Grammar());
+ $header = new Swift_Mime_Headers_MailboxHeader('To', $encoder, new EmailValidator());
$header->setCharset('utf-8');
- $header->setNameAddresses(array(
+ $header->setNameAddresses([
'test@example.com' => $name,
- ));
+ ]);
$this->assertSame('To: '.$expectedEncodedName." <test@example.com>\r\n", $header->toString());
}
public function encodingDataProvider()
{
- return array(
- array('this is " a test ö', 'this is =?utf-8?Q?=22?= a test =?utf-8?Q?=C3=B6?='),
- array(': this is a test ö', '=?utf-8?Q?=3A?= this is a test =?utf-8?Q?=C3=B6?='),
- array('( test ö', '=?utf-8?Q?=28?= test =?utf-8?Q?=C3=B6?='),
- array('[ test ö', '=?utf-8?Q?=5B?= test =?utf-8?Q?=C3=B6?='),
- array('@ test ö)', '=?utf-8?Q?=40?= test =?utf-8?Q?=C3=B6=29?='),
- );
+ return [
+ ['this is " a test ö', 'this is =?utf-8?Q?=22?= a test =?utf-8?Q?=C3=B6?='],
+ [': this is a test ö', '=?utf-8?Q?=3A?= this is a test =?utf-8?Q?=C3=B6?='],
+ ['( test ö', '=?utf-8?Q?=28?= test =?utf-8?Q?=C3=B6?='],
+ ['[ test ö', '=?utf-8?Q?=5B?= test =?utf-8?Q?=C3=B6?='],
+ ['@ test ö)', '=?utf-8?Q?=40?= test =?utf-8?Q?=C3=B6=29?='],
+ ];
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php
index d58242fb85..3075f67677 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php
@@ -1,20 +1,20 @@
<?php
-class Swift_Bug71Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug71Test extends \PHPUnit\Framework\TestCase
{
- private $_message;
+ private $message;
protected function setUp()
{
- $this->_message = new Swift_Message('test');
+ $this->message = new Swift_Message('test');
}
public function testCallingToStringAfterSettingNewBodyReflectsChanges()
{
- $this->_message->setBody('BODY1');
- $this->assertRegExp('/BODY1/', $this->_message->toString());
+ $this->message->setBody('BODY1');
+ $this->assertRegExp('/BODY1/', $this->message->toString());
- $this->_message->setBody('BODY2');
- $this->assertRegExp('/BODY2/', $this->_message->toString());
+ $this->message->setBody('BODY2');
+ $this->assertRegExp('/BODY2/', $this->message->toString());
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php
index 899083c019..1db2035709 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php
@@ -1,38 +1,38 @@
<?php
-class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
+class Swift_Bug76Test extends \PHPUnit\Framework\TestCase
{
- private $_inputFile;
- private $_outputFile;
- private $_encoder;
+ private $inputFile;
+ private $outputFile;
+ private $encoder;
protected function setUp()
{
- $this->_inputFile = sys_get_temp_dir().'/in.bin';
- file_put_contents($this->_inputFile, '');
+ $this->inputFile = sys_get_temp_dir().'/in.bin';
+ file_put_contents($this->inputFile, '');
- $this->_outputFile = sys_get_temp_dir().'/out.bin';
- file_put_contents($this->_outputFile, '');
+ $this->outputFile = sys_get_temp_dir().'/out.bin';
+ file_put_contents($this->outputFile, '');
- $this->_encoder = $this->_createEncoder();
+ $this->encoder = $this->createEncoder();
}
protected function tearDown()
{
- unlink($this->_inputFile);
- unlink($this->_outputFile);
+ unlink($this->inputFile);
+ unlink($this->outputFile);
}
public function testBase64EncodedLineLengthNeverExceeds76CharactersEvenIfArgsDo()
{
- $this->_fillFileWithRandomBytes(1000, $this->_inputFile);
+ $this->fillFileWithRandomBytes(1000, $this->inputFile);
- $os = $this->_createStream($this->_inputFile);
- $is = $this->_createStream($this->_outputFile);
+ $os = $this->createStream($this->inputFile);
+ $is = $this->createStream($this->outputFile);
- $this->_encoder->encodeByteStream($os, $is, 0, 80); //Exceeds 76
+ $this->encoder->encodeByteStream($os, $is, 0, 80); //Exceeds 76
- $this->assertMaxLineLength(76, $this->_outputFile,
+ $this->assertMaxLineLength(76, $this->outputFile,
'%s: Line length should not exceed 76 characters'
);
}
@@ -45,7 +45,7 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
}
}
- private function _fillFileWithRandomBytes($byteCount, $file)
+ private function fillFileWithRandomBytes($byteCount, $file)
{
// I was going to use dd with if=/dev/random but this way seems more
// cross platform even if a hella expensive!!
@@ -53,18 +53,18 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
file_put_contents($file, '');
$fp = fopen($file, 'wb');
for ($i = 0; $i < $byteCount; ++$i) {
- $byteVal = rand(0, 255);
+ $byteVal = random_int(0, 255);
fwrite($fp, pack('i', $byteVal));
}
fclose($fp);
}
- private function _createEncoder()
+ private function createEncoder()
{
return new Swift_Mime_ContentEncoder_Base64ContentEncoder();
}
- private function _createStream($file)
+ private function createStream($file)
{
return new Swift_ByteStream_FileByteStream($file, true);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php
index 35733ec55a..eb58071960 100644
--- a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php
@@ -1,7 +1,6 @@
<?php
-
-class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit_Framework_TestCase
+class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit\Framework\TestCase
{
/**
* @test
diff --git a/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php b/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php
index 159c2ae192..8a66039382 100644
--- a/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php
+++ b/vendor/swiftmailer/swiftmailer/tests/fixtures/MimeEntityFixture.php
@@ -1,6 +1,6 @@
<?php
-class MimeEntityFixture implements Swift_Mime_MimeEntity
+class MimeEntityFixture extends Swift_Mime_SimpleMimeEntity
{
private $level;
private $string;
@@ -61,7 +61,7 @@ class MimeEntityFixture implements Swift_Mime_MimeEntity
{
}
- public function setChildren(array $children)
+ public function setChildren(array $children, $compoundLevel = null)
{
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default b/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default
index 0de2763fa1..604d6de710 100644
--- a/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default
+++ b/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default
@@ -1,7 +1,7 @@
<?php
/*
- Swift Mailer V4 smoke test configuration.
+ Swift Mailer smoke test configuration.
YOU ONLY NEED TO EDIT THIS FILE IF YOU WISH TO RUN THE SMOKE TESTS.
diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php
index 5a4ccde3ee..0be2c81e1d 100644
--- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php
@@ -9,22 +9,22 @@ class Swift_Smoke_AttachmentSmokeTest extends SwiftMailerSmokeTestCase
protected function setUp()
{
- parent::setup(); // For skip
- $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
+ parent::setUp(); // For skip
+ $this->attFile = __DIR__.'/../../../_samples/files/textfile.zip';
}
public function testAttachmentSending()
{
- $mailer = $this->_getMailer();
- $message = Swift_Message::newInstance()
+ $mailer = $this->getMailer();
+ $message = (new Swift_Message())
->setSubject('[Swift Mailer] AttachmentSmokeTest')
- ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))
+ ->setFrom([SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'])
->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
->setBody('This message should contain an attached ZIP file (named "textfile.zip").'.PHP_EOL.
'When unzipped, the archive should produce a text file which reads:'.PHP_EOL.
- '"This is part of a Swift Mailer v4 smoke test."'
+ '"This is part of a Swift Mailer smoke test."'
)
- ->attach(Swift_Attachment::fromPath($this->_attFile))
+ ->attach(Swift_Attachment::fromPath($this->attFile))
;
$this->assertEquals(1, $mailer->send($message),
'%s: The smoke test should send a single message'
diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php
index c7501d46e3..79915b3426 100644
--- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php
@@ -7,10 +7,10 @@ class Swift_Smoke_BasicSmokeTest extends SwiftMailerSmokeTestCase
{
public function testBasicSending()
{
- $mailer = $this->_getMailer();
- $message = Swift_Message::newInstance()
+ $mailer = $this->getMailer();
+ $message = (new Swift_Message())
->setSubject('[Swift Mailer] BasicSmokeTest')
- ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))
+ ->setFrom([SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'])
->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
->setBody('One, two, three, four, five...'.PHP_EOL.
'six, seven, eight...'
diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php
index 3b13cc5d1b..8a2647a7ea 100644
--- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php
@@ -9,19 +9,19 @@ class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase
protected function setUp()
{
- $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
+ $this->attFile = __DIR__.'/../../../_samples/files/textfile.zip';
}
public function testAttachmentSending()
{
- $mailer = $this->_getMailer();
- $message = Swift_Message::newInstance('[Swift Mailer] HtmlWithAttachmentSmokeTest')
- ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'))
+ $mailer = $this->getMailer();
+ $message = (new Swift_Message('[Swift Mailer] HtmlWithAttachmentSmokeTest'))
+ ->setFrom([SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer'])
->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
- ->attach(Swift_Attachment::fromPath($this->_attFile))
+ ->attach(Swift_Attachment::fromPath($this->attFile))
->setBody('<p>This HTML-formatted message should contain an attached ZIP file (named "textfile.zip").'.PHP_EOL.
'When unzipped, the archive should produce a text file which reads:</p>'.PHP_EOL.
- '<p><q>This is part of a Swift Mailer v4 smoke test.</q></p>', 'text/html'
+ '<p><q>This is part of a Swift Mailer smoke test.</q></p>', 'text/html'
)
;
$this->assertEquals(1, $mailer->send($message),
diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php
index b9ebef52c9..6dc715e89f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php
@@ -9,26 +9,26 @@ class Swift_Smoke_InternationalSmokeTest extends SwiftMailerSmokeTestCase
protected function setUp()
{
- parent::setup(); // For skip
- $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
+ parent::setUp(); // For skip
+ $this->attFile = __DIR__.'/../../../_samples/files/textfile.zip';
}
public function testAttachmentSending()
{
- $mailer = $this->_getMailer();
- $message = Swift_Message::newInstance()
+ $mailer = $this->getMailer();
+ $message = (new Swift_Message())
->setCharset('utf-8')
->setSubject('[Swift Mailer] InternationalSmokeTest (διεθνής)')
- ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Χριστοφορου (Swift Mailer)'))
+ ->setFrom([SWIFT_SMOKE_EMAIL_ADDRESS => 'Χριστοφορου (Swift Mailer)'])
->setTo(SWIFT_SMOKE_EMAIL_ADDRESS)
->setBody('This message should contain an attached ZIP file (named "κείμενο, εδάφιο, θέμα.zip").'.PHP_EOL.
'When unzipped, the archive should produce a text file which reads:'.PHP_EOL.
- '"This is part of a Swift Mailer v4 smoke test."'.PHP_EOL.
+ '"This is part of a Swift Mailer smoke test."'.PHP_EOL.
PHP_EOL.
'Following is some arbitrary Greek text:'.PHP_EOL.
'Δεν βρέθηκαν λέξεις.'
)
- ->attach(Swift_Attachment::fromPath($this->_attFile)
+ ->attach(Swift_Attachment::fromPath($this->attFile)
->setContentType('application/zip')
->setFilename('κείμενο, εδάφιο, θέμα.zip')
)
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
index 60ebb661ab..29fe390f01 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php
@@ -1,12 +1,12 @@
<?php
-class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
+class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit\Framework\TestCase
{
public function testReadingSingleBytesFromBaseInput()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
- $output = array();
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
+ $output = [];
while (false !== $bytes = $bs->read(1)) {
$output[] = $bytes;
}
@@ -17,34 +17,34 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testReadingMultipleBytesFromBaseInput()
{
- $input = array('a', 'b', 'c', 'd');
- $bs = $this->_createArrayStream($input);
- $output = array();
+ $input = ['a', 'b', 'c', 'd'];
+ $bs = $this->createArrayStream($input);
+ $output = [];
while (false !== $bytes = $bs->read(2)) {
$output[] = $bytes;
}
- $this->assertEquals(array('ab', 'cd'), $output,
+ $this->assertEquals(['ab', 'cd'], $output,
'%s: Bytes read from stream should be in pairs'
);
}
public function testReadingOddOffsetOnLastByte()
{
- $input = array('a', 'b', 'c', 'd', 'e');
- $bs = $this->_createArrayStream($input);
- $output = array();
+ $input = ['a', 'b', 'c', 'd', 'e'];
+ $bs = $this->createArrayStream($input);
+ $output = [];
while (false !== $bytes = $bs->read(2)) {
$output[] = $bytes;
}
- $this->assertEquals(array('ab', 'cd', 'e'), $output,
+ $this->assertEquals(['ab', 'cd', 'e'], $output,
'%s: Bytes read from stream should be in pairs except final read'
);
}
public function testSettingPointerPartway()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
$bs->setReadPointer(1);
$this->assertEquals('b', $bs->read(1),
'%s: Byte should be second byte since pointer as at offset 1'
@@ -53,8 +53,9 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testResettingPointerAfterExhaustion()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+
+ $bs = $this->createArrayStream($input);
while (false !== $bs->read(1));
$bs->setReadPointer(0);
@@ -65,8 +66,8 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testPointerNeverSetsBelowZero()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
$bs->setReadPointer(-1);
$this->assertEquals('a', $bs->read(1),
@@ -76,8 +77,8 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testPointerNeverSetsAboveStackSize()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
$bs->setReadPointer(3);
$this->assertFalse($bs->read(1),
@@ -87,24 +88,24 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testBytesCanBeWrittenToStream()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
$bs->write('de');
- $output = array();
+ $output = [];
while (false !== $bytes = $bs->read(1)) {
$output[] = $bytes;
}
- $this->assertEquals(array('a', 'b', 'c', 'd', 'e'), $output,
+ $this->assertEquals(['a', 'b', 'c', 'd', 'e'], $output,
'%s: Bytes read from stream should be from initial stack + written'
);
}
public function testContentsCanBeFlushed()
{
- $input = array('a', 'b', 'c');
- $bs = $this->_createArrayStream($input);
+ $input = ['a', 'b', 'c'];
+ $bs = $this->createArrayStream($input);
$bs->flushBuffers();
@@ -115,19 +116,19 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testConstructorCanTakeStringArgument()
{
- $bs = $this->_createArrayStream('abc');
- $output = array();
+ $bs = $this->createArrayStream('abc');
+ $output = [];
while (false !== $bytes = $bs->read(1)) {
$output[] = $bytes;
}
- $this->assertEquals(array('a', 'b', 'c'), $output,
+ $this->assertEquals(['a', 'b', 'c'], $output,
'%s: Bytes read from stream should be the same as bytes in constructor'
);
}
public function testBindingOtherStreamsMirrorsWriteOperations()
{
- $bs = $this->_createArrayStream('');
+ $bs = $this->createArrayStream('');
$is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
$is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
@@ -153,7 +154,7 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testBindingOtherStreamsMirrorsFlushOperations()
{
- $bs = $this->_createArrayStream('');
+ $bs = $this->createArrayStream('');
$is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
$is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
@@ -170,7 +171,7 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
public function testUnbindingStreamPreventsFurtherWrites()
{
- $bs = $this->_createArrayStream('');
+ $bs = $this->createArrayStream('');
$is1 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
$is2 = $this->getMockBuilder('Swift_InputByteStream')->getMock();
@@ -194,7 +195,7 @@ class Swift_ByteStream_ArrayByteStreamTest extends \PHPUnit_Framework_TestCase
$bs->write('y');
}
- private function _createArrayStream($input)
+ private function createArrayStream($input)
{
return new Swift_ByteStream_ArrayByteStream($input);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php
index 3f7a46cf59..1ba5e784c0 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit_Framework_TestCase
+class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit\Framework\TestCase
{
public function testInitialByteSizeMatchesWidth()
{
@@ -16,19 +16,19 @@ class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit_Framewo
$reader = new Swift_CharacterReader_GenericFixedWidthReader(4);
$this->assertSame(
- 1, $reader->validateByteSequence(array(0x01, 0x02, 0x03), 3)
+ 1, $reader->validateByteSequence([0x01, 0x02, 0x03], 3)
); //3 octets
$this->assertSame(
- 2, $reader->validateByteSequence(array(0x01, 0x0A), 2)
+ 2, $reader->validateByteSequence([0x01, 0x0A], 2)
); //2 octets
$this->assertSame(
- 3, $reader->validateByteSequence(array(0xFE), 1)
+ 3, $reader->validateByteSequence([0xFE], 1)
); //1 octet
$this->assertSame(
- 0, $reader->validateByteSequence(array(0xFE, 0x03, 0x67, 0x9A), 4)
+ 0, $reader->validateByteSequence([0xFE, 0x03, 0x67, 0x9A], 4)
); //All 4 octets
}
@@ -37,7 +37,7 @@ class Swift_CharacterReader_GenericFixedWidthReaderTest extends \PHPUnit_Framewo
$reader = new Swift_CharacterReader_GenericFixedWidthReader(6);
$this->assertSame(-1, $reader->validateByteSequence(
- array(0xFE, 0x03, 0x67, 0x9A, 0x10, 0x09, 0x85), 7
+ [0xFE, 0x03, 0x67, 0x9A, 0x10, 0x09, 0x85], 7
)); //7 octets
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php
index 0d5673604b..b85b0ab1b9 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCase
+class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit\Framework\TestCase
{
/*
@@ -16,18 +16,18 @@ class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCas
*/
- private $_reader;
+ private $reader;
protected function setUp()
{
- $this->_reader = new Swift_CharacterReader_UsAsciiReader();
+ $this->reader = new Swift_CharacterReader_UsAsciiReader();
}
public function testAllValidAsciiCharactersReturnZero()
{
for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) {
$this->assertSame(
- 0, $this->_reader->validateByteSequence(array($ordinal), 1)
+ 0, $this->reader->validateByteSequence([$ordinal], 1)
);
}
}
@@ -36,7 +36,7 @@ class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCas
{
for ($ordinal = 0x00; $ordinal <= 0x7F; $ordinal += 2) {
$this->assertSame(
- -1, $this->_reader->validateByteSequence(array($ordinal, $ordinal + 1), 2)
+ -1, $this->reader->validateByteSequence([$ordinal, $ordinal + 1], 2)
);
}
}
@@ -45,7 +45,7 @@ class Swift_CharacterReader_UsAsciiReaderTest extends \PHPUnit_Framework_TestCas
{
for ($ordinal = 0x80; $ordinal <= 0xFF; ++$ordinal) {
$this->assertSame(
- -1, $this->_reader->validateByteSequence(array($ordinal), 1)
+ -1, $this->reader->validateByteSequence([$ordinal], 1)
);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php
index ec17eebe8b..06379118cf 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php
@@ -1,19 +1,19 @@
<?php
-class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
+class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit\Framework\TestCase
{
- private $_reader;
+ private $reader;
protected function setUp()
{
- $this->_reader = new Swift_CharacterReader_Utf8Reader();
+ $this->reader = new Swift_CharacterReader_Utf8Reader();
}
public function testLeading7BitOctetCausesReturnZero()
{
for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) {
$this->assertSame(
- 0, $this->_reader->validateByteSequence(array($ordinal), 1)
+ 0, $this->reader->validateByteSequence([$ordinal], 1)
);
}
}
@@ -22,7 +22,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
{
for ($octet = 0xC0; $octet <= 0xDF; ++$octet) {
$this->assertSame(
- 1, $this->_reader->validateByteSequence(array($octet), 1)
+ 1, $this->reader->validateByteSequence([$octet], 1)
);
}
}
@@ -31,7 +31,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
{
for ($octet = 0xE0; $octet <= 0xEF; ++$octet) {
$this->assertSame(
- 2, $this->_reader->validateByteSequence(array($octet), 1)
+ 2, $this->reader->validateByteSequence([$octet], 1)
);
}
}
@@ -40,7 +40,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
{
for ($octet = 0xF0; $octet <= 0xF7; ++$octet) {
$this->assertSame(
- 3, $this->_reader->validateByteSequence(array($octet), 1)
+ 3, $this->reader->validateByteSequence([$octet], 1)
);
}
}
@@ -49,7 +49,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
{
for ($octet = 0xF8; $octet <= 0xFB; ++$octet) {
$this->assertSame(
- 4, $this->_reader->validateByteSequence(array($octet), 1)
+ 4, $this->reader->validateByteSequence([$octet], 1)
);
}
}
@@ -58,7 +58,7 @@ class Swift_CharacterReader_Utf8ReaderTest extends \PHPUnit_Framework_TestCase
{
for ($octet = 0xFC; $octet <= 0xFD; ++$octet) {
$this->assertSame(
- 5, $this->_reader->validateByteSequence(array($octet), 1)
+ 5, $this->reader->validateByteSequence([$octet], 1)
);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
index 977051e99d..d0158a236c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php
@@ -4,20 +4,20 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
{
public function testValidatorAlgorithmOnImportString()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importString(pack('C*',
0xD0, 0x94,
@@ -32,22 +32,22 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testCharactersWrittenUseValidator()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -63,8 +63,8 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testReadCharactersAreInTact()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
@@ -72,15 +72,15 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
->zeroOrMoreTimes()
->andReturn(1);
//String
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
//Stream
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -108,8 +108,8 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testCharactersCanBeReadAsByteArrays()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
@@ -117,15 +117,15 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
->zeroOrMoreTimes()
->andReturn(1);
//String
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
//Stream
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -138,30 +138,30 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
)
);
- $this->assertEquals(array(0xD0, 0x94), $stream->readBytes(1));
- $this->assertEquals(array(0xD0, 0xB6, 0xD0, 0xBE), $stream->readBytes(2));
- $this->assertEquals(array(0xD0, 0xBB), $stream->readBytes(1));
+ $this->assertEquals([0xD0, 0x94], $stream->readBytes(1));
+ $this->assertEquals([0xD0, 0xB6, 0xD0, 0xBE], $stream->readBytes(2));
+ $this->assertEquals([0xD0, 0xBB], $stream->readBytes(1));
$this->assertEquals(
- array(0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B), $stream->readBytes(3)
+ [0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B], $stream->readBytes(3)
);
- $this->assertEquals(array(0xD1, 0x85), $stream->readBytes(1));
+ $this->assertEquals([0xD1, 0x85], $stream->readBytes(1));
$this->assertFalse($stream->readBytes(1));
}
public function testRequestingLargeCharCountPastEndOfStream()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -174,21 +174,21 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testRequestingByteArrayCountPastEndOfStream()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
- $this->assertEquals(array(0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE),
+ $this->assertEquals([0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE],
$stream->readBytes(100)
);
@@ -197,17 +197,17 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testPointerOffsetCanBeSet()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -224,17 +224,17 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testContentsCanBeFlushed()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE));
@@ -245,9 +245,9 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testByteStreamCanBeImportingUsesValidator()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
- $os = $this->_getByteStream();
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
+ $os = $this->getByteStream();
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
@@ -267,18 +267,18 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importByteStream($os);
}
public function testImportingStreamProducesCorrectCharArray()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
- $os = $this->_getByteStream();
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
+ $os = $this->getByteStream();
$stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8');
@@ -298,9 +298,9 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0), 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0], 1)->andReturn(1);
$stream->importByteStream($os);
@@ -313,15 +313,15 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
public function testAlgorithmWithFixedWidthCharsets()
{
- $reader = $this->_getReader();
- $factory = $this->_getFactory($reader);
+ $reader = $this->getReader();
+ $factory = $this->getFactory($reader);
$reader->shouldReceive('getInitialByteSize')
->zeroOrMoreTimes()
->andReturn(2);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD1, 0x8D), 2);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0, 0xBB), 2);
- $reader->shouldReceive('validateByteSequence')->once()->with(array(0xD0, 0xB0), 2);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD1, 0x8D], 2);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0, 0xBB], 2);
+ $reader->shouldReceive('validateByteSequence')->once()->with([0xD0, 0xB0], 2);
$stream = new Swift_CharacterStream_ArrayCharacterStream(
$factory, 'utf-8'
@@ -335,12 +335,12 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
$this->assertFalse($stream->read(1));
}
- private function _getReader()
+ private function getReader()
{
return $this->getMockery('Swift_CharacterReader');
}
- private function _getFactory($reader)
+ private function getFactory($reader)
{
$factory = $this->getMockery('Swift_CharacterReaderFactory');
$factory->shouldReceive('getReaderFor')
@@ -351,7 +351,7 @@ class Swift_CharacterStream_ArrayCharacterStreamTest extends \SwiftMailerTestCas
return $factory;
}
- private function _getByteStream()
+ private function getByteStream()
{
return $this->getMockery('Swift_OutputByteStream');
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php
index ccd14f6f6e..286f83281b 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php
@@ -12,165 +12,180 @@ class One
}
}
-class Swift_DependencyContainerTest extends \PHPUnit_Framework_TestCase
+class Swift_DependencyContainerTest extends \PHPUnit\Framework\TestCase
{
- private $_container;
+ private $container;
protected function setUp()
{
- $this->_container = new Swift_DependencyContainer();
+ $this->container = new Swift_DependencyContainer();
}
public function testRegisterAndLookupValue()
{
- $this->_container->register('foo')->asValue('bar');
- $this->assertEquals('bar', $this->_container->lookup('foo'));
+ $this->container->register('foo')->asValue('bar');
+ $this->assertEquals('bar', $this->container->lookup('foo'));
}
public function testHasReturnsTrueForRegisteredValue()
{
- $this->_container->register('foo')->asValue('bar');
- $this->assertTrue($this->_container->has('foo'));
+ $this->container->register('foo')->asValue('bar');
+ $this->assertTrue($this->container->has('foo'));
}
public function testHasReturnsFalseForUnregisteredValue()
{
- $this->assertFalse($this->_container->has('foo'));
+ $this->assertFalse($this->container->has('foo'));
}
public function testRegisterAndLookupNewInstance()
{
- $this->_container->register('one')->asNewInstanceOf('One');
- $this->assertInstanceOf('One', $this->_container->lookup('one'));
+ $this->container->register('one')->asNewInstanceOf('One');
+ $this->assertInstanceOf('One', $this->container->lookup('one'));
}
public function testHasReturnsTrueForRegisteredInstance()
{
- $this->_container->register('one')->asNewInstanceOf('One');
- $this->assertTrue($this->_container->has('one'));
+ $this->container->register('one')->asNewInstanceOf('One');
+ $this->assertTrue($this->container->has('one'));
}
public function testNewInstanceIsAlwaysNew()
{
- $this->_container->register('one')->asNewInstanceOf('One');
- $a = $this->_container->lookup('one');
- $b = $this->_container->lookup('one');
+ $this->container->register('one')->asNewInstanceOf('One');
+ $a = $this->container->lookup('one');
+ $b = $this->container->lookup('one');
$this->assertEquals($a, $b);
}
public function testRegisterAndLookupSharedInstance()
{
- $this->_container->register('one')->asSharedInstanceOf('One');
- $this->assertInstanceOf('One', $this->_container->lookup('one'));
+ $this->container->register('one')->asSharedInstanceOf('One');
+ $this->assertInstanceOf('One', $this->container->lookup('one'));
}
public function testHasReturnsTrueForSharedInstance()
{
- $this->_container->register('one')->asSharedInstanceOf('One');
- $this->assertTrue($this->_container->has('one'));
+ $this->container->register('one')->asSharedInstanceOf('One');
+ $this->assertTrue($this->container->has('one'));
}
public function testMultipleSharedInstancesAreSameInstance()
{
- $this->_container->register('one')->asSharedInstanceOf('One');
- $a = $this->_container->lookup('one');
- $b = $this->_container->lookup('one');
+ $this->container->register('one')->asSharedInstanceOf('One');
+ $a = $this->container->lookup('one');
+ $b = $this->container->lookup('one');
$this->assertEquals($a, $b);
}
+ public function testRegisterAndLookupArray()
+ {
+ $this->container->register('One')->asArray();
+ $this->assertSame([], $this->container->lookup('One'));
+ }
+
public function testNewInstanceWithDependencies()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('one')->asNewInstanceOf('One')
- ->withDependencies(array('foo'));
- $obj = $this->_container->lookup('one');
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('one')->asNewInstanceOf('One')
+ ->withDependencies(['foo']);
+ $obj = $this->container->lookup('one');
$this->assertSame('FOO', $obj->arg1);
}
public function testNewInstanceWithMultipleDependencies()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('bar')->asValue(42);
- $this->_container->register('one')->asNewInstanceOf('One')
- ->withDependencies(array('foo', 'bar'));
- $obj = $this->_container->lookup('one');
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('bar')->asValue(42);
+ $this->container->register('one')->asNewInstanceOf('One')
+ ->withDependencies(['foo', 'bar']);
+ $obj = $this->container->lookup('one');
$this->assertSame('FOO', $obj->arg1);
$this->assertSame(42, $obj->arg2);
}
public function testNewInstanceWithInjectedObjects()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('one')->asNewInstanceOf('One');
- $this->_container->register('two')->asNewInstanceOf('One')
- ->withDependencies(array('one', 'foo'));
- $obj = $this->_container->lookup('two');
- $this->assertEquals($this->_container->lookup('one'), $obj->arg1);
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('one')->asNewInstanceOf('One');
+ $this->container->register('two')->asNewInstanceOf('One')
+ ->withDependencies(['one', 'foo']);
+ $obj = $this->container->lookup('two');
+ $this->assertEquals($this->container->lookup('one'), $obj->arg1);
$this->assertSame('FOO', $obj->arg2);
}
public function testNewInstanceWithAddConstructorValue()
{
- $this->_container->register('one')->asNewInstanceOf('One')
+ $this->container->register('one')->asNewInstanceOf('One')
->addConstructorValue('x')
->addConstructorValue(99);
- $obj = $this->_container->lookup('one');
+ $obj = $this->container->lookup('one');
$this->assertSame('x', $obj->arg1);
$this->assertSame(99, $obj->arg2);
}
public function testNewInstanceWithAddConstructorLookup()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('bar')->asValue(42);
- $this->_container->register('one')->asNewInstanceOf('One')
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('bar')->asValue(42);
+ $this->container->register('one')->asNewInstanceOf('One')
->addConstructorLookup('foo')
->addConstructorLookup('bar');
- $obj = $this->_container->lookup('one');
+ $obj = $this->container->lookup('one');
$this->assertSame('FOO', $obj->arg1);
$this->assertSame(42, $obj->arg2);
}
public function testResolvedDependenciesCanBeLookedUp()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('one')->asNewInstanceOf('One');
- $this->_container->register('two')->asNewInstanceOf('One')
- ->withDependencies(array('one', 'foo'));
- $deps = $this->_container->createDependenciesFor('two');
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('one')->asNewInstanceOf('One');
+ $this->container->register('two')->asNewInstanceOf('One')
+ ->withDependencies(['one', 'foo']);
+ $deps = $this->container->createDependenciesFor('two');
$this->assertEquals(
- array($this->_container->lookup('one'), 'FOO'), $deps
+ [$this->container->lookup('one'), 'FOO'], $deps
);
}
public function testArrayOfDependenciesCanBeSpecified()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('one')->asNewInstanceOf('One');
- $this->_container->register('two')->asNewInstanceOf('One')
- ->withDependencies(array(array('one', 'foo'), 'foo'));
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('one')->asNewInstanceOf('One');
+ $this->container->register('two')->asNewInstanceOf('One')
+ ->withDependencies([['one', 'foo'], 'foo']);
- $obj = $this->_container->lookup('two');
- $this->assertEquals(array($this->_container->lookup('one'), 'FOO'), $obj->arg1);
+ $obj = $this->container->lookup('two');
+ $this->assertEquals([$this->container->lookup('one'), 'FOO'], $obj->arg1);
$this->assertSame('FOO', $obj->arg2);
}
+ public function testArrayWithDependencies()
+ {
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('bar')->asValue(42);
+ $this->container->register('one')->asArray('One')
+ ->withDependencies(['foo', 'bar']);
+ $this->assertSame(['FOO', 42], $this->container->lookup('one'));
+ }
+
public function testAliasCanBeSet()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('bar')->asAliasOf('foo');
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('bar')->asAliasOf('foo');
- $this->assertSame('FOO', $this->_container->lookup('bar'));
+ $this->assertSame('FOO', $this->container->lookup('bar'));
}
public function testAliasOfAliasCanBeSet()
{
- $this->_container->register('foo')->asValue('FOO');
- $this->_container->register('bar')->asAliasOf('foo');
- $this->_container->register('zip')->asAliasOf('bar');
- $this->_container->register('button')->asAliasOf('zip');
+ $this->container->register('foo')->asValue('FOO');
+ $this->container->register('bar')->asAliasOf('foo');
+ $this->container->register('zip')->asAliasOf('bar');
+ $this->container->register('button')->asAliasOf('zip');
- $this->assertSame('FOO', $this->_container->lookup('button'));
+ $this->assertSame('FOO', $this->container->lookup('button'));
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php
index b89eb9f52c..6387bad3b8 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php
@@ -1,12 +1,12 @@
<?php
-class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
+class Swift_Encoder_Base64EncoderTest extends \PHPUnit\Framework\TestCase
{
- private $_encoder;
+ private $encoder;
protected function setUp()
{
- $this->_encoder = new Swift_Encoder_Base64Encoder();
+ $this->encoder = new Swift_Encoder_Base64Encoder();
}
/*
@@ -28,15 +28,15 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
*/
$this->assertEquals(
- 'MTIz', $this->_encoder->encodeString('123'),
+ 'MTIz', $this->encoder->encodeString('123'),
'%s: 3 bytes of input should yield 4 bytes of output'
);
$this->assertEquals(
- 'MTIzNDU2', $this->_encoder->encodeString('123456'),
+ 'MTIzNDU2', $this->encoder->encodeString('123456'),
'%s: 6 bytes in input should yield 8 bytes of output'
);
$this->assertEquals(
- 'MTIzNDU2Nzg5', $this->_encoder->encodeString('123456789'),
+ 'MTIzNDU2Nzg5', $this->encoder->encodeString('123456789'),
'%s: 9 bytes in input should yield 12 bytes of output'
);
}
@@ -64,25 +64,25 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
*/
for ($i = 0; $i < 30; ++$i) {
- $input = pack('C', rand(0, 255));
+ $input = pack('C', random_int(0, 255));
$this->assertRegExp(
- '~^[a-zA-Z0-9/\+]{2}==$~', $this->_encoder->encodeString($input),
+ '~^[a-zA-Z0-9/\+]{2}==$~', $this->encoder->encodeString($input),
'%s: A single byte should have 2 bytes of padding'
);
}
for ($i = 0; $i < 30; ++$i) {
- $input = pack('C*', rand(0, 255), rand(0, 255));
+ $input = pack('C*', random_int(0, 255), random_int(0, 255));
$this->assertRegExp(
- '~^[a-zA-Z0-9/\+]{3}=$~', $this->_encoder->encodeString($input),
+ '~^[a-zA-Z0-9/\+]{3}=$~', $this->encoder->encodeString($input),
'%s: Two bytes should have 1 byte of padding'
);
}
for ($i = 0; $i < 30; ++$i) {
- $input = pack('C*', rand(0, 255), rand(0, 255), rand(0, 255));
+ $input = pack('C*', random_int(0, 255), random_int(0, 255), random_int(0, 255));
$this->assertRegExp(
- '~^[a-zA-Z0-9/\+]{4}$~', $this->_encoder->encodeString($input),
+ '~^[a-zA-Z0-9/\+]{4}$~', $this->encoder->encodeString($input),
'%s: Three bytes should have no padding'
);
}
@@ -114,7 +114,7 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
'NUVVZXWFla'; //48
$this->assertEquals(
- $output, $this->_encoder->encodeString($input),
+ $output, $this->encoder->encodeString($input),
'%s: Lines should be no more than 76 characters'
);
}
@@ -141,7 +141,7 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
'UlNUVVZXWFla'; //50 *
$this->assertEquals(
- $output, $this->_encoder->encodeString($input, 0, 50),
+ $output, $this->encoder->encodeString($input, 0, 50),
'%s: Lines should be no more than 100 characters'
);
}
@@ -166,7 +166,7 @@ class Swift_Encoder_Base64EncoderTest extends \PHPUnit_Framework_TestCase
'FRkdISUpLTE1OT1BRUlNUVVZXWFla'; //67
$this->assertEquals(
- $output, $this->_encoder->encodeString($input, 19),
+ $output, $this->encoder->encodeString($input, 19),
'%s: First line offset is 19 so first line should be 57 chars long'
);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php
index 6740f22c1a..10e5e1d0a9 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php
@@ -32,7 +32,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
foreach (array_merge(range(33, 60), range(62, 126)) as $ordinal) {
$char = chr($ordinal);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -40,7 +40,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
->with($char);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->atLeast()->times(1)
->andReturn(false);
@@ -82,19 +82,19 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
//HT
$string = 'a'.$HT.$HT."\r\n".'b';
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
->once()
->with($string);
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x09));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x09));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('a')]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x09]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x09]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0D]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0A]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')->once()->andReturn(false);
$encoder = new Swift_Encoder_QpEncoder($charStream);
@@ -106,19 +106,19 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
//SPACE
$string = 'a'.$SPACE.$SPACE."\r\n".'b';
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
->once()
->with($string);
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x20));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x20));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('a')]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x20]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x20]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0D]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0A]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')->once()->andReturn(false);
$encoder = new Swift_Encoder_QpEncoder($charStream);
@@ -159,22 +159,22 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
$string = 'a'."\r\n".'b'."\r\n".'c'."\r\n";
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
->once()
->with($string);
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('a')));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('b')));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(ord('c')));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0D));
- $charStream->shouldReceive('readBytes')->once()->andReturn(array(0x0A));
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('a')]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0D]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0A]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('b')]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0D]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0A]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([ord('c')]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0D]);
+ $charStream->shouldReceive('readBytes')->once()->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')->once()->andReturn(false);
$encoder = new Swift_Encoder_QpEncoder($charStream);
@@ -195,7 +195,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
$input = str_repeat('a', 140);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -206,7 +206,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
for ($i = 0; $i < 140; ++$i) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
if (75 == $i) {
$output .= "=\r\n";
@@ -226,7 +226,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
{
$input = str_repeat('a', 100);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -237,7 +237,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
for ($i = 0; $i < 100; ++$i) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
if (53 == $i) {
$output .= "=\r\n";
@@ -261,7 +261,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
foreach (range(0, 32) as $ordinal) {
$char = chr($ordinal);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -269,7 +269,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
->with($char);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->atLeast()->times(1)
->andReturn(false);
@@ -290,7 +290,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
$char = '=';
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -298,7 +298,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
->with($char);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(61));
+ ->andReturn([61]);
$charStream->shouldReceive('readBytes')
->atLeast()->times(1)
->andReturn(false);
@@ -317,7 +317,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
foreach (range(127, 255) as $ordinal) {
$char = chr($ordinal);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -325,7 +325,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
->with($char);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->atLeast()->times(1)
->andReturn(false);
@@ -342,7 +342,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
{
$input = str_repeat('a', 140);
- $charStream = $this->_createCharStream();
+ $charStream = $this->createCharStream();
$charStream->shouldReceive('flushContents')
->once();
$charStream->shouldReceive('importString')
@@ -353,7 +353,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
for ($i = 0; $i < 140; ++$i) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
if (53 == $i || 53 + 75 == $i) {
$output .= "=\r\n";
@@ -385,7 +385,7 @@ class Swift_Encoder_QpEncoderTest extends \SwiftMailerTestCase
);
}
- private function _createCharStream()
+ private function createCharStream()
{
return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php
index 28eae6f862..0ab8aa4c44 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php
@@ -2,7 +2,7 @@
class Swift_Encoder_Rfc2231EncoderTest extends \SwiftMailerTestCase
{
- private $_rfc2045Token = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+$/D';
+ private $rfc2045Token = '/^[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+$/D';
/* --
This algorithm is described in RFC 2231, but is barely touched upon except
@@ -39,7 +39,7 @@ class Swift_Encoder_Rfc2231EncoderTest extends \SwiftMailerTestCase
$encoded = $encoder->encodeString($string);
foreach (explode("\r\n", $encoded) as $line) {
- $this->assertRegExp($this->_rfc2045Token, $line,
+ $this->assertRegExp($this->rfc2045Token, $line,
'%s: Encoder should always return a valid RFC 2045 token.');
}
}
@@ -69,7 +69,7 @@ class Swift_Encoder_Rfc2231EncoderTest extends \SwiftMailerTestCase
$encoded = $encoder->encodeString($string);
foreach (explode("\r\n", $encoded) as $line) {
- $this->assertRegExp($this->_rfc2045Token, $line,
+ $this->assertRegExp($this->rfc2045Token, $line,
'%s: Encoder should always return a valid RFC 2045 token.');
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php
index a78bc3a360..2915870de6 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php
@@ -1,33 +1,33 @@
<?php
-class Swift_Events_CommandEventTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_CommandEventTest extends \PHPUnit\Framework\TestCase
{
public function testCommandCanBeFetchedByGetter()
{
- $evt = $this->_createEvent($this->_createTransport(), "FOO\r\n");
+ $evt = $this->createEvent($this->createTransport(), "FOO\r\n");
$this->assertEquals("FOO\r\n", $evt->getCommand());
}
public function testSuccessCodesCanBeFetchedViaGetter()
{
- $evt = $this->_createEvent($this->_createTransport(), "FOO\r\n", array(250));
- $this->assertEquals(array(250), $evt->getSuccessCodes());
+ $evt = $this->createEvent($this->createTransport(), "FOO\r\n", [250]);
+ $this->assertEquals([250], $evt->getSuccessCodes());
}
public function testSourceIsBuffer()
{
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport, "FOO\r\n");
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport, "FOO\r\n");
$ref = $evt->getSource();
$this->assertEquals($transport, $ref);
}
- private function _createEvent(Swift_Transport $source, $command, $successCodes = array())
+ private function createEvent(Swift_Transport $source, $command, $successCodes = [])
{
return new Swift_Events_CommandEvent($source, $command, $successCodes);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php
index 0cfe3caa43..b67461fadd 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php
@@ -1,11 +1,11 @@
<?php
-class Swift_Events_EventObjectTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_EventObjectTest extends \PHPUnit\Framework\TestCase
{
public function testEventSourceCanBeReturnedViaGetter()
{
$source = new stdClass();
- $evt = $this->_createEvent($source);
+ $evt = $this->createEvent($source);
$ref = $evt->getSource();
$this->assertEquals($source, $ref);
}
@@ -13,19 +13,19 @@ class Swift_Events_EventObjectTest extends \PHPUnit_Framework_TestCase
public function testEventDoesNotHaveCancelledBubbleWhenNew()
{
$source = new stdClass();
- $evt = $this->_createEvent($source);
+ $evt = $this->createEvent($source);
$this->assertFalse($evt->bubbleCancelled());
}
public function testBubbleCanBeCancelledInEvent()
{
$source = new stdClass();
- $evt = $this->_createEvent($source);
+ $evt = $this->createEvent($source);
$evt->cancelBubble();
$this->assertTrue($evt->bubbleCancelled());
}
- private function _createEvent($source)
+ 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 6f611acbeb..ba5c191c92 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php
@@ -1,10 +1,10 @@
<?php
-class Swift_Events_ResponseEventTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_ResponseEventTest extends \PHPUnit\Framework\TestCase
{
public function testResponseCanBeFetchViaGetter()
{
- $evt = $this->_createEvent($this->_createTransport(), "250 Ok\r\n", true);
+ $evt = $this->createEvent($this->createTransport(), "250 Ok\r\n", true);
$this->assertEquals("250 Ok\r\n", $evt->getResponse(),
'%s: Response should be available via getResponse()'
);
@@ -12,7 +12,7 @@ class Swift_Events_ResponseEventTest extends \PHPUnit_Framework_TestCase
public function testResultCanBeFetchedViaGetter()
{
- $evt = $this->_createEvent($this->_createTransport(), "250 Ok\r\n", false);
+ $evt = $this->createEvent($this->createTransport(), "250 Ok\r\n", false);
$this->assertFalse($evt->isValid(),
'%s: Result should be checkable via isValid()'
);
@@ -20,18 +20,18 @@ class Swift_Events_ResponseEventTest extends \PHPUnit_Framework_TestCase
public function testSourceIsBuffer()
{
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport, "250 Ok\r\n", true);
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport, "250 Ok\r\n", true);
$ref = $evt->getSource();
$this->assertEquals($transport, $ref);
}
- private function _createEvent(Swift_Transport $source, $response, $result)
+ private function createEvent(Swift_Transport $source, $response, $result)
{
return new Swift_Events_ResponseEvent($source, $response, $result);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php
index c4a6a7efcd..9f55589a60 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php
@@ -1,13 +1,13 @@
<?php
-class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_SendEventTest extends \PHPUnit\Framework\TestCase
{
public function testMessageCanBeFetchedViaGetter()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
+ $evt = $this->createEvent($transport, $message);
$ref = $evt->getMessage();
$this->assertEquals($message, $ref,
@@ -17,10 +17,10 @@ class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase
public function testTransportCanBeFetchViaGetter()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
+ $evt = $this->createEvent($transport, $message);
$ref = $evt->getTransport();
$this->assertEquals($transport, $ref,
@@ -30,10 +30,10 @@ class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase
public function testTransportCanBeFetchViaGetSource()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
+ $evt = $this->createEvent($transport, $message);
$ref = $evt->getSource();
$this->assertEquals($transport, $ref,
@@ -43,10 +43,10 @@ class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase
public function testResultCanBeSetAndGet()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
+ $evt = $this->createEvent($transport, $message);
$evt->setResult(
Swift_Events_SendEvent::RESULT_SUCCESS | Swift_Events_SendEvent::RESULT_TENTATIVE
@@ -58,40 +58,39 @@ class Swift_Events_SendEventTest extends \PHPUnit_Framework_TestCase
public function testFailedRecipientsCanBeSetAndGet()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
+ $evt = $this->createEvent($transport, $message);
- $evt->setFailedRecipients(array('foo@bar', 'zip@button'));
+ $evt->setFailedRecipients(['foo@bar', 'zip@button']);
- $this->assertEquals(array('foo@bar', 'zip@button'), $evt->getFailedRecipients(),
+ $this->assertEquals(['foo@bar', 'zip@button'], $evt->getFailedRecipients(),
'%s: FailedRecipients should be returned from getter'
);
}
public function testFailedRecipientsGetsPickedUpCorrectly()
{
- $message = $this->_createMessage();
- $transport = $this->_createTransport();
+ $message = $this->createMessage();
+ $transport = $this->createTransport();
- $evt = $this->_createEvent($transport, $message);
- $this->assertEquals(array(), $evt->getFailedRecipients());
+ $evt = $this->createEvent($transport, $message);
+ $this->assertEquals([], $evt->getFailedRecipients());
}
- private function _createEvent(Swift_Transport $source,
- Swift_Mime_Message $message)
+ private function createEvent(Swift_Transport $source, Swift_Mime_SimpleMessage $message)
{
return new Swift_Events_SendEvent($source, $message);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
- private function _createMessage()
+ private function createMessage()
{
- return $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ return $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
index 3f063ff7c6..d5dce2b9b5 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php
@@ -1,19 +1,19 @@
<?php
-class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit\Framework\TestCase
{
- private $_dispatcher;
+ private $dispatcher;
protected function setUp()
{
- $this->_dispatcher = new Swift_Events_SimpleEventDispatcher();
+ $this->dispatcher = new Swift_Events_SimpleEventDispatcher();
}
public function testSendEventCanBeCreated()
{
$transport = $this->getMockBuilder('Swift_Transport')->getMock();
- $message = $this->getMockBuilder('Swift_Mime_Message')->getMock();
- $evt = $this->_dispatcher->createSendEvent($transport, $message);
+ $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
+ $evt = $this->dispatcher->createSendEvent($transport, $message);
$this->assertInstanceOf('Swift_Events_SendEvent', $evt);
$this->assertSame($message, $evt->getMessage());
$this->assertSame($transport, $evt->getTransport());
@@ -22,17 +22,17 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
public function testCommandEventCanBeCreated()
{
$buf = $this->getMockBuilder('Swift_Transport')->getMock();
- $evt = $this->_dispatcher->createCommandEvent($buf, "FOO\r\n", array(250));
+ $evt = $this->dispatcher->createCommandEvent($buf, "FOO\r\n", [250]);
$this->assertInstanceOf('Swift_Events_CommandEvent', $evt);
$this->assertSame($buf, $evt->getSource());
$this->assertEquals("FOO\r\n", $evt->getCommand());
- $this->assertEquals(array(250), $evt->getSuccessCodes());
+ $this->assertEquals([250], $evt->getSuccessCodes());
}
public function testResponseEventCanBeCreated()
{
$buf = $this->getMockBuilder('Swift_Transport')->getMock();
- $evt = $this->_dispatcher->createResponseEvent($buf, "250 Ok\r\n", true);
+ $evt = $this->dispatcher->createResponseEvent($buf, "250 Ok\r\n", true);
$this->assertInstanceOf('Swift_Events_ResponseEvent', $evt);
$this->assertSame($buf, $evt->getSource());
$this->assertEquals("250 Ok\r\n", $evt->getResponse());
@@ -42,7 +42,7 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
public function testTransportChangeEventCanBeCreated()
{
$transport = $this->getMockBuilder('Swift_Transport')->getMock();
- $evt = $this->_dispatcher->createTransportChangeEvent($transport);
+ $evt = $this->dispatcher->createTransportChangeEvent($transport);
$this->assertInstanceOf('Swift_Events_TransportChangeEvent', $evt);
$this->assertSame($transport, $evt->getSource());
}
@@ -51,7 +51,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);
+ $evt = $this->dispatcher->createTransportExceptionEvent($transport, $ex);
$this->assertInstanceOf('Swift_Events_TransportExceptionEvent', $evt);
$this->assertSame($transport, $evt->getSource());
$this->assertSame($ex, $evt->getException());
@@ -61,13 +61,13 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
{
$transport = $this->getMockBuilder('Swift_Transport')->getMock();
- $evt = $this->_dispatcher->createTransportChangeEvent($transport);
+ $evt = $this->dispatcher->createTransportChangeEvent($transport);
$listenerA = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock();
$listenerB = $this->getMockBuilder('Swift_Events_TransportChangeListener')->getMock();
- $this->_dispatcher->bindEventListener($listenerA);
- $this->_dispatcher->bindEventListener($listenerB);
+ $this->dispatcher->bindEventListener($listenerA);
+ $this->dispatcher->bindEventListener($listenerB);
$listenerA->expects($this->once())
->method('transportStarted')
@@ -76,21 +76,21 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
->method('transportStarted')
->with($evt);
- $this->_dispatcher->dispatchEvent($evt, 'transportStarted');
+ $this->dispatcher->dispatchEvent($evt, 'transportStarted');
}
public function testListenersAreOnlyCalledIfImplementingCorrectInterface()
{
$transport = $this->getMockBuilder('Swift_Transport')->getMock();
- $message = $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
- $evt = $this->_dispatcher->createSendEvent($transport, $message);
+ $evt = $this->dispatcher->createSendEvent($transport, $message);
$targetListener = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
$otherListener = $this->getMockBuilder('DummyListener')->getMock();
- $this->_dispatcher->bindEventListener($targetListener);
- $this->_dispatcher->bindEventListener($otherListener);
+ $this->dispatcher->bindEventListener($targetListener);
+ $this->dispatcher->bindEventListener($otherListener);
$targetListener->expects($this->once())
->method('sendPerformed')
@@ -98,21 +98,21 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
$otherListener->expects($this->never())
->method('sendPerformed');
- $this->_dispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->dispatcher->dispatchEvent($evt, 'sendPerformed');
}
public function testListenersCanCancelBubblingOfEvent()
{
$transport = $this->getMockBuilder('Swift_Transport')->getMock();
- $message = $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ $message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
- $evt = $this->_dispatcher->createSendEvent($transport, $message);
+ $evt = $this->dispatcher->createSendEvent($transport, $message);
$listenerA = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
$listenerB = $this->getMockBuilder('Swift_Events_SendListener')->getMock();
- $this->_dispatcher->bindEventListener($listenerA);
- $this->_dispatcher->bindEventListener($listenerB);
+ $this->dispatcher->bindEventListener($listenerA);
+ $this->dispatcher->bindEventListener($listenerB);
$listenerA->expects($this->once())
->method('sendPerformed')
@@ -123,12 +123,12 @@ class Swift_Events_SimpleEventDispatcherTest extends \PHPUnit_Framework_TestCase
$listenerB->expects($this->never())
->method('sendPerformed');
- $this->_dispatcher->dispatchEvent($evt, 'sendPerformed');
+ $this->dispatcher->dispatchEvent($evt, 'sendPerformed');
$this->assertTrue($evt->bubbleCancelled());
}
- private function _createDispatcher(array $map)
+ private function createDispatcher(array $map)
{
return new Swift_Events_SimpleEventDispatcher($map);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php
index a260ccb53e..625b96c9bf 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php
@@ -1,29 +1,29 @@
<?php
-class Swift_Events_TransportChangeEventTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_TransportChangeEventTest extends \PHPUnit\Framework\TestCase
{
public function testGetTransportReturnsTransport()
{
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport);
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport);
$ref = $evt->getTransport();
$this->assertEquals($transport, $ref);
}
public function testSourceIsTransport()
{
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport);
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport);
$ref = $evt->getSource();
$this->assertEquals($transport, $ref);
}
- private function _createEvent(Swift_Transport $source)
+ private function createEvent(Swift_Transport $source)
{
return new Swift_Events_TransportChangeEvent($source);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
index 731dfad5fa..033b0e5b3e 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php
@@ -1,12 +1,12 @@
<?php
-class Swift_Events_TransportExceptionEventTest extends \PHPUnit_Framework_TestCase
+class Swift_Events_TransportExceptionEventTest extends \PHPUnit\Framework\TestCase
{
public function testExceptionCanBeFetchViaGetter()
{
- $ex = $this->_createException();
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport, $ex);
+ $ex = $this->createException();
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport, $ex);
$ref = $evt->getException();
$this->assertEquals($ex, $ref,
'%s: Exception should be available via getException()'
@@ -15,26 +15,26 @@ class Swift_Events_TransportExceptionEventTest extends \PHPUnit_Framework_TestCa
public function testSourceIsTransport()
{
- $ex = $this->_createException();
- $transport = $this->_createTransport();
- $evt = $this->_createEvent($transport, $ex);
+ $ex = $this->createException();
+ $transport = $this->createTransport();
+ $evt = $this->createEvent($transport, $ex);
$ref = $evt->getSource();
$this->assertEquals($transport, $ref,
'%s: Transport should be available via getSource()'
);
}
- private function _createEvent(Swift_Transport $transport, Swift_TransportException $ex)
+ private function createEvent(Swift_Transport $transport, Swift_TransportException $ex)
{
return new Swift_Events_TransportExceptionEvent($transport, $ex);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
- private function _createException()
+ private function createException()
{
return new Swift_TransportException('');
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
index f2ed5dd6d4..129c99e9b1 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
@@ -1,92 +1,92 @@
<?php
-class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase
+class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit\Framework\TestCase
{
- private $_key1 = 'key1';
- private $_key2 = 'key2';
+ private $key1 = 'key1';
+ private $key2 = 'key2';
public function testStringDataCanBeSetAndFetched()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('test', $cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeOverwritten()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$cache->setString(
- $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('whatever', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('whatever', $cache->getString($this->key1, 'foo'));
}
public function testStringDataCanBeAppended()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$cache->setString(
- $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
+ $this->key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testing', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testing', $cache->getString($this->key1, 'foo'));
}
public function testHasKeyReturnValue()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyIsWellPartitioned()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$cache->setString(
- $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $cache->getString($this->_key2, 'foo'));
+ $this->assertEquals('test', $cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $cache->getString($this->key2, 'foo'));
}
public function testItemKeyIsWellPartitioned()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$cache->setString(
- $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('test', $cache->getString($this->_key1, 'foo'));
- $this->assertEquals('ing', $cache->getString($this->_key1, 'bar'));
+ $this->assertEquals('test', $cache->getString($this->key1, 'foo'));
+ $this->assertEquals('ing', $cache->getString($this->key1, 'bar'));
}
public function testByteStreamCanBeImported()
{
- $os = $this->_createOutputStream();
+ $os = $this->createOutputStream();
$os->expects($this->at(0))
->method('read')
->will($this->returnValue('abc'));
@@ -97,17 +97,17 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase
->method('read')
->will($this->returnValue(false));
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_WRITE
);
- $this->assertEquals('abcdef', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdef', $cache->getString($this->key1, 'foo'));
}
public function testByteStreamCanBeAppended()
{
- $os1 = $this->_createOutputStream();
+ $os1 = $this->createOutputStream();
$os1->expects($this->at(0))
->method('read')
->will($this->returnValue('abc'));
@@ -118,7 +118,7 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase
->method('read')
->will($this->returnValue(false));
- $os2 = $this->_createOutputStream();
+ $os2 = $this->createOutputStream();
$os2->expects($this->at(0))
->method('read')
->will($this->returnValue('xyz'));
@@ -129,23 +129,23 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase
->method('read')
->will($this->returnValue(false));
- $is = $this->_createKeyCacheInputStream(true);
+ $is = $this->createKeyCacheInputStream(true);
- $cache = $this->_createCache($is);
+ $cache = $this->createCache($is);
$cache->importFromByteStream(
- $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
+ $this->key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND
);
$cache->importFromByteStream(
- $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
+ $this->key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('abcdefxyzuvw', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('abcdefxyzuvw', $cache->getString($this->key1, 'foo'));
}
public function testByteStreamAndStringCanBeAppended()
{
- $os = $this->_createOutputStream();
+ $os = $this->createOutputStream();
$os->expects($this->at(0))
->method('read')
->will($this->returnValue('abc'));
@@ -156,84 +156,84 @@ class Swift_KeyCache_ArrayKeyCacheTest extends \PHPUnit_Framework_TestCase
->method('read')
->will($this->returnValue(false));
- $is = $this->_createKeyCacheInputStream(true);
+ $is = $this->createKeyCacheInputStream(true);
- $cache = $this->_createCache($is);
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND
);
$cache->importFromByteStream(
- $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
+ $this->key1, 'foo', $os, Swift_KeyCache::MODE_APPEND
);
- $this->assertEquals('testabcdef', $cache->getString($this->_key1, 'foo'));
+ $this->assertEquals('testabcdef', $cache->getString($this->key1, 'foo'));
}
public function testDataCanBeExportedToByteStream()
{
//See acceptance test for more detail
- $is = $this->_createInputStream();
+ $is = $this->createInputStream();
$is->expects($this->atLeastOnce())
->method('write');
- $kcis = $this->_createKeyCacheInputStream(true);
+ $kcis = $this->createKeyCacheInputStream(true);
- $cache = $this->_createCache($kcis);
+ $cache = $this->createCache($kcis);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $cache->exportToByteStream($this->_key1, 'foo', $is);
+ $cache->exportToByteStream($this->key1, 'foo', $is);
}
public function testKeyCanBeCleared()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($cache->hasKey($this->_key1, 'foo'));
- $cache->clearKey($this->_key1, 'foo');
- $this->assertFalse($cache->hasKey($this->_key1, 'foo'));
+ $this->assertTrue($cache->hasKey($this->key1, 'foo'));
+ $cache->clearKey($this->key1, 'foo');
+ $this->assertFalse($cache->hasKey($this->key1, 'foo'));
}
public function testNsKeyCanBeCleared()
{
- $is = $this->_createKeyCacheInputStream();
- $cache = $this->_createCache($is);
+ $is = $this->createKeyCacheInputStream();
+ $cache = $this->createCache($is);
$cache->setString(
- $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE
);
$cache->setString(
- $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
+ $this->key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE
);
- $this->assertTrue($cache->hasKey($this->_key1, 'foo'));
- $this->assertTrue($cache->hasKey($this->_key1, 'bar'));
- $cache->clearAll($this->_key1);
- $this->assertFalse($cache->hasKey($this->_key1, 'foo'));
- $this->assertFalse($cache->hasKey($this->_key1, 'bar'));
+ $this->assertTrue($cache->hasKey($this->key1, 'foo'));
+ $this->assertTrue($cache->hasKey($this->key1, 'bar'));
+ $cache->clearAll($this->key1);
+ $this->assertFalse($cache->hasKey($this->key1, 'foo'));
+ $this->assertFalse($cache->hasKey($this->key1, 'bar'));
}
- private function _createCache($is)
+ private function createCache($is)
{
return new Swift_KeyCache_ArrayKeyCache($is);
}
- private function _createKeyCacheInputStream()
+ private function createKeyCacheInputStream()
{
return $this->getMockBuilder('Swift_KeyCache_KeyCacheInputStream')->getMock();
}
- private function _createOutputStream()
+ private function createOutputStream()
{
return $this->getMockBuilder('Swift_OutputByteStream')->getMock();
}
- private function _createInputStream()
+ private function createInputStream()
{
return $this->getMockBuilder('Swift_InputByteStream')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
index 38fbc0df66..4274aafd54 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php
@@ -1,25 +1,25 @@
<?php
-class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit_Framework_TestCase
+class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit\Framework\TestCase
{
- private $_nsKey = 'ns1';
+ private $nsKey = 'ns1';
public function testStreamWritesToCacheInAppendMode()
{
$cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
$cache->expects($this->at(0))
->method('setString')
- ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);
+ ->with($this->nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);
$cache->expects($this->at(1))
->method('setString')
- ->with($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);
+ ->with($this->nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);
$cache->expects($this->at(2))
->method('setString')
- ->with($this->_nsKey, 'foo', 'c', Swift_KeyCache::MODE_APPEND);
+ ->with($this->nsKey, 'foo', 'c', Swift_KeyCache::MODE_APPEND);
$stream = new Swift_KeyCache_SimpleKeyCacheInputStream();
$stream->setKeyCache($cache);
- $stream->setNsKey($this->_nsKey);
+ $stream->setNsKey($this->nsKey);
$stream->setItemKey('foo');
$stream->write('a');
@@ -32,11 +32,11 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit_Framework_Te
$cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
$cache->expects($this->once())
->method('clearKey')
- ->with($this->_nsKey, 'foo');
+ ->with($this->nsKey, 'foo');
$stream = new Swift_KeyCache_SimpleKeyCacheInputStream();
$stream->setKeyCache($cache);
- $stream->setNsKey($this->_nsKey);
+ $stream->setNsKey($this->nsKey);
$stream->setItemKey('foo');
$stream->flushBuffers();
@@ -47,17 +47,17 @@ class Swift_KeyCache_SimpleKeyCacheInputStreamTest extends \PHPUnit_Framework_Te
$cache = $this->getMockBuilder('Swift_KeyCache')->getMock();
$cache->expects($this->at(0))
->method('setString')
- ->with($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);
+ ->with($this->nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND);
$cache->expects($this->at(1))
->method('setString')
- ->with($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);
+ ->with($this->nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND);
$cache->expects($this->at(2))
->method('setString')
->with('test', 'bar', 'x', Swift_KeyCache::MODE_APPEND);
$stream = new Swift_KeyCache_SimpleKeyCacheInputStream();
$stream->setKeyCache($cache);
- $stream->setNsKey($this->_nsKey);
+ $stream->setNsKey($this->nsKey);
$stream->setItemKey('foo');
$stream->write('a');
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php
index ff0bce4fa3..12506ddfb1 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php
@@ -1,22 +1,22 @@
<?php
-class Swift_Mailer_ArrayRecipientIteratorTest extends \PHPUnit_Framework_TestCase
+class Swift_Mailer_ArrayRecipientIteratorTest extends \PHPUnit\Framework\TestCase
{
public function testHasNextReturnsFalseForEmptyArray()
{
- $it = new Swift_Mailer_ArrayRecipientIterator(array());
+ $it = new Swift_Mailer_ArrayRecipientIterator([]);
$this->assertFalse($it->hasNext());
}
public function testHasNextReturnsTrueIfItemsLeft()
{
- $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));
+ $it = new Swift_Mailer_ArrayRecipientIterator(['foo@bar' => 'Foo']);
$this->assertTrue($it->hasNext());
}
public function testReadingToEndOfListCausesHasNextToReturnFalse()
{
- $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));
+ $it = new Swift_Mailer_ArrayRecipientIterator(['foo@bar' => 'Foo']);
$this->assertTrue($it->hasNext());
$it->nextRecipient();
$this->assertFalse($it->hasNext());
@@ -24,19 +24,19 @@ class Swift_Mailer_ArrayRecipientIteratorTest extends \PHPUnit_Framework_TestCas
public function testReturnedValueHasPreservedKeyValuePair()
{
- $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo'));
- $this->assertEquals(array('foo@bar' => 'Foo'), $it->nextRecipient());
+ $it = new Swift_Mailer_ArrayRecipientIterator(['foo@bar' => 'Foo']);
+ $this->assertEquals(['foo@bar' => 'Foo'], $it->nextRecipient());
}
public function testIteratorMovesNextAfterEachIteration()
{
- $it = new Swift_Mailer_ArrayRecipientIterator(array(
+ $it = new Swift_Mailer_ArrayRecipientIterator([
'foo@bar' => 'Foo',
'zip@button' => 'Zip thing',
'test@test' => null,
- ));
- $this->assertEquals(array('foo@bar' => 'Foo'), $it->nextRecipient());
- $this->assertEquals(array('zip@button' => 'Zip thing'), $it->nextRecipient());
- $this->assertEquals(array('test@test' => null), $it->nextRecipient());
+ ]);
+ $this->assertEquals(['foo@bar' => 'Foo'], $it->nextRecipient());
+ $this->assertEquals(['zip@button' => 'Zip thing'], $it->nextRecipient());
+ $this->assertEquals(['test@test' => null], $it->nextRecipient());
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php
index 74951a70d3..a2a96d0f9a 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php
@@ -4,8 +4,8 @@ class Swift_MailerTest extends \SwiftMailerTestCase
{
public function testTransportIsStartedWhenSending()
{
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$started = false;
$transport->shouldReceive('isStarted')
@@ -21,14 +21,14 @@ class Swift_MailerTest extends \SwiftMailerTestCase
return;
});
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
$mailer->send($message);
}
public function testTransportIsOnlyStartedOnce()
{
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$started = false;
$transport->shouldReceive('isStarted')
@@ -44,7 +44,7 @@ class Swift_MailerTest extends \SwiftMailerTestCase
return;
});
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
for ($i = 0; $i < 10; ++$i) {
$mailer->send($message);
}
@@ -52,69 +52,69 @@ class Swift_MailerTest extends \SwiftMailerTestCase
public function testMessageIsPassedToTransport()
{
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$transport->shouldReceive('send')
->once()
->with($message, \Mockery::any());
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
$mailer->send($message);
}
public function testSendReturnsCountFromTransport()
{
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$transport->shouldReceive('send')
->once()
->with($message, \Mockery::any())
->andReturn(57);
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
$this->assertEquals(57, $mailer->send($message));
}
public function testFailedRecipientReferenceIsPassedToTransport()
{
- $failures = array();
+ $failures = [];
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$transport->shouldReceive('send')
->once()
->with($message, $failures)
->andReturn(57);
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
$mailer->send($message, $failures);
}
public function testSendRecordsRfcComplianceExceptionAsEntireSendFailure()
{
- $failures = array();
+ $failures = [];
$rfcException = new Swift_RfcComplianceException('test');
- $transport = $this->_createTransport();
- $message = $this->_createMessage();
+ $transport = $this->createTransport();
+ $message = $this->createMessage();
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo&invalid' => 'Foo', 'bar@valid.tld' => 'Bar'));
+ ->andReturn(['foo&invalid' => 'Foo', 'bar@valid.tld' => 'Bar']);
$transport->shouldReceive('send')
->once()
->with($message, $failures)
->andThrow($rfcException);
- $mailer = $this->_createMailer($transport);
+ $mailer = $this->createMailer($transport);
$this->assertEquals(0, $mailer->send($message, $failures), '%s: Should return 0');
- $this->assertEquals(array('foo&invalid', 'bar@valid.tld'), $failures, '%s: Failures should contain all addresses since the entire message failed to compile');
+ $this->assertEquals(['foo&invalid', 'bar@valid.tld'], $failures, '%s: Failures should contain all addresses since the entire message failed to compile');
}
public function testRegisterPluginDelegatesToTransport()
{
- $plugin = $this->_createPlugin();
- $transport = $this->_createTransport();
- $mailer = $this->_createMailer($transport);
+ $plugin = $this->createPlugin();
+ $transport = $this->createTransport();
+ $mailer = $this->createMailer($transport);
$transport->shouldReceive('registerPlugin')
->once()
@@ -123,22 +123,22 @@ class Swift_MailerTest extends \SwiftMailerTestCase
$mailer->registerPlugin($plugin);
}
- private function _createPlugin()
+ private function createPlugin()
{
return $this->getMockery('Swift_Events_EventListener')->shouldIgnoreMissing();
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockery('Swift_Transport')->shouldIgnoreMissing();
}
- private function _createMessage()
+ private function createMessage()
{
- return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
+ return $this->getMockery('Swift_Mime_SimpleMessage')->shouldIgnoreMissing();
}
- private function _createMailer(Swift_Transport $transport)
+ private function createMailer(Swift_Transport $transport)
{
return new Swift_Mailer($transport);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php
index 35a568c6e2..3ebbd7ea25 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MessageTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_MessageTest extends \PHPUnit_Framework_TestCase
+class Swift_MessageTest extends \PHPUnit\Framework\TestCase
{
public function testCloning()
{
@@ -8,7 +8,9 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase
$message2 = new Swift_Message('subj', 'body', 'ctype');
$message1_clone = clone $message1;
- $this->_recursiveObjectCloningCheck($message1, $message2, $message1_clone);
+ $this->recursiveObjectCloningCheck($message1, $message2, $message1_clone);
+ // the test above will fail if the two messages are not identical
+ $this->addToAssertionCount(1);
}
public function testCloningWithSigners()
@@ -21,13 +23,15 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase
$message2->attachSigner($signer);
$message1_clone = clone $message1;
- $this->_recursiveObjectCloningCheck($message1, $message2, $message1_clone);
+ $this->recursiveObjectCloningCheck($message1, $message2, $message1_clone);
+ // the test above will fail if the two messages are not identical
+ $this->addToAssertionCount(1);
}
public function testBodySwap()
{
$message1 = new Swift_Message('Test');
- $html = Swift_MimePart::newInstance('<html></html>', 'text/html');
+ $html = new Swift_MimePart('<html></html>', 'text/html');
$html->getHeaders()->addTextHeader('X-Test-Remove', 'Test-Value');
$html->getHeaders()->addTextHeader('X-Test-Alter', 'Test-Value');
$message1->attach($html);
@@ -54,7 +58,7 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase
$this->assertNotEquals($id_1, $id_2, 'Message Ids are the same');
}
- protected function _recursiveObjectCloningCheck($obj1, $obj2, $obj1_clone)
+ protected function recursiveObjectCloningCheck($obj1, $obj2, $obj1_clone)
{
$obj1_properties = (array) $obj1;
$obj2_properties = (array) $obj2;
@@ -82,18 +86,18 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase
);
}
// recurse
- $this->_recursiveObjectCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);
+ $this->recursiveObjectCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);
} elseif (is_array($value)) {
$obj1_value = $obj1_properties[$property];
$obj2_value = $obj2_properties[$property];
$obj1_clone_value = $obj1_clone_properties[$property];
- return $this->_recursiveArrayCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);
+ return $this->recursiveArrayCloningCheck($obj1_value, $obj2_value, $obj1_clone_value);
}
}
}
- protected function _recursiveArrayCloningCheck($array1, $array2, $array1_clone)
+ protected function recursiveArrayCloningCheck($array1, $array2, $array1_clone)
{
foreach ($array1 as $key => $value) {
if (is_object($value)) {
@@ -116,13 +120,13 @@ class Swift_MessageTest extends \PHPUnit_Framework_TestCase
);
}
// recurse
- $this->_recursiveObjectCloningCheck($arr1_value, $arr2_value, $arr1_clone_value);
+ $this->recursiveObjectCloningCheck($arr1_value, $arr2_value, $arr1_clone_value);
} elseif (is_array($value)) {
$arr1_value = $array1[$key];
$arr2_value = $array2[$key];
$arr1_clone_value = $array1_clone[$key];
- return $this->_recursiveArrayCloningCheck($arr1_value, $arr2_value, $arr1_clone_value);
+ return $this->recursiveArrayCloningCheck($arr1_value, $arr2_value, $arr1_clone_value);
}
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
index 3efe6ec441..c7c2c03d19 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php
@@ -6,27 +6,27 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
{
public function testGetHeadersReturnsHeaderSet()
{
- $headers = $this->_createHeaderSet();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $headers = $this->createHeaderSet();
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$this->assertSame($headers, $entity->getHeaders());
}
public function testContentTypeIsReturnedFromHeader()
{
- $ctype = $this->_createHeader('Content-Type', 'image/jpeg-test');
- $headers = $this->_createHeaderSet(array('Content-Type' => $ctype));
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $ctype = $this->createHeader('Content-Type', 'image/jpeg-test');
+ $headers = $this->createHeaderSet(['Content-Type' => $ctype]);
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$this->assertEquals('image/jpeg-test', $entity->getContentType());
}
public function testContentTypeIsSetInHeader()
{
- $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);
- $headers = $this->_createHeaderSet(array('Content-Type' => $ctype));
+ $ctype = $this->createHeader('Content-Type', 'text/plain', [], false);
+ $headers = $this->createHeaderSet(['Content-Type' => $ctype]);
$ctype->shouldReceive('setFieldBodyModel')
->once()
@@ -35,57 +35,57 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->zeroOrMoreTimes()
->with(\Mockery::not('image/jpeg'));
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setContentType('image/jpeg');
}
public function testContentTypeHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addParameterizedHeader')
->once()
->with('Content-Type', 'image/jpeg');
$headers->shouldReceive('addParameterizedHeader')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setContentType('image/jpeg');
}
public function testContentTypeCanBeSetViaSetBody()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addParameterizedHeader')
->once()
->with('Content-Type', 'text/html');
$headers->shouldReceive('addParameterizedHeader')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBody('<b>foo</b>', 'text/html');
}
public function testGetEncoderFromConstructor()
{
- $encoder = $this->_createEncoder('base64');
- $entity = $this->_createEntity($this->_createHeaderSet(), $encoder,
- $this->_createCache()
+ $encoder = $this->createEncoder('base64');
+ $entity = $this->createEntity($this->createHeaderSet(), $encoder,
+ $this->createCache()
);
$this->assertSame($encoder, $entity->getEncoder());
}
public function testSetAndGetEncoder()
{
- $encoder = $this->_createEncoder('base64');
- $headers = $this->_createHeaderSet();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $encoder = $this->createEncoder('base64');
+ $headers = $this->createHeaderSet();
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setEncoder($encoder);
$this->assertSame($encoder, $entity->getEncoder());
@@ -93,38 +93,38 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testSettingEncoderUpdatesTransferEncoding()
{
- $encoder = $this->_createEncoder('base64');
- $encoding = $this->_createHeader(
- 'Content-Transfer-Encoding', '8bit', array(), false
+ $encoder = $this->createEncoder('base64');
+ $encoding = $this->createHeader(
+ 'Content-Transfer-Encoding', '8bit', [], false
);
- $headers = $this->_createHeaderSet(array(
+ $headers = $this->createHeaderSet([
'Content-Transfer-Encoding' => $encoding,
- ));
+ ]);
$encoding->shouldReceive('setFieldBodyModel')
->once()
->with('base64');
$encoding->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setEncoder($encoder);
}
public function testSettingEncoderAddsEncodingHeaderIfNonePresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addTextHeader')
->once()
->with('Content-Transfer-Encoding', 'something');
$headers->shouldReceive('addTextHeader')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
- $entity->setEncoder($this->_createEncoder('something'));
+ $entity->setEncoder($this->createEncoder('something'));
}
public function testIdIsReturnedFromHeader()
@@ -136,18 +136,18 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
identical to the "Message-ID" header field
*/
- $cid = $this->_createHeader('Content-ID', 'zip@button');
- $headers = $this->_createHeaderSet(array('Content-ID' => $cid));
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $cid = $this->createHeader('Content-ID', 'zip@button');
+ $headers = $this->createHeaderSet(['Content-ID' => $cid]);
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$this->assertEquals('zip@button', $entity->getId());
}
public function testIdIsSetInHeader()
{
- $cid = $this->_createHeader('Content-ID', 'zip@button', array(), false);
- $headers = $this->_createHeaderSet(array('Content-ID' => $cid));
+ $cid = $this->createHeader('Content-ID', 'zip@button', [], false);
+ $headers = $this->createHeaderSet(['Content-ID' => $cid]);
$cid->shouldReceive('setFieldBodyModel')
->once()
@@ -155,25 +155,25 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
$cid->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setId('foo@bar');
}
public function testIdIsAutoGenerated()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertRegExp('/^.*?@.*?$/D', $entity->getId());
}
public function testGenerateIdCreatesNewId()
{
- $headers = $this->_createHeaderSet();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $headers = $this->createHeaderSet();
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$id1 = $entity->generateId();
$id2 = $entity->generateId();
@@ -182,9 +182,9 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testGenerateIdSetsNewId()
{
- $headers = $this->_createHeaderSet();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $headers = $this->createHeaderSet();
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$id = $entity->generateId();
$this->assertEquals($id, $entity->getId());
@@ -200,46 +200,46 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
field is always optional.
*/
- $desc = $this->_createHeader('Content-Description', 'something');
- $headers = $this->_createHeaderSet(array('Content-Description' => $desc));
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $desc = $this->createHeader('Content-Description', 'something');
+ $headers = $this->createHeaderSet(['Content-Description' => $desc]);
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$this->assertEquals('something', $entity->getDescription());
}
public function testDescriptionIsSetInHeader()
{
- $desc = $this->_createHeader('Content-Description', '', array(), false);
+ $desc = $this->createHeader('Content-Description', '', [], false);
$desc->shouldReceive('setFieldBodyModel')->once()->with('whatever');
- $headers = $this->_createHeaderSet(array('Content-Description' => $desc));
+ $headers = $this->createHeaderSet(['Content-Description' => $desc]);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setDescription('whatever');
}
public function testDescriptionHeaderIsAddedIfNotPresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addTextHeader')
->once()
->with('Content-Description', 'whatever');
$headers->shouldReceive('addTextHeader')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setDescription('whatever');
}
public function testSetAndGetMaxLineLength()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$entity->setMaxLineLength(60);
$this->assertEquals(60, $entity->getMaxLineLength());
@@ -247,13 +247,13 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testEncoderIsUsedForStringGeneration()
{
- $encoder = $this->_createEncoder('base64', false);
+ $encoder = $this->createEncoder('base64', false);
$encoder->expects($this->once())
->method('encodeString')
->with('blah');
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $encoder, $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $encoder, $this->createCache()
);
$entity->setBody('blah');
$entity->toString();
@@ -261,13 +261,13 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testMaxLineLengthIsProvidedWhenEncoding()
{
- $encoder = $this->_createEncoder('base64', false);
+ $encoder = $this->createEncoder('base64', false);
$encoder->expects($this->once())
->method('encodeString')
->with('blah', 0, 65);
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $encoder, $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $encoder, $this->createCache()
);
$entity->setBody('blah');
$entity->setMaxLineLength(65);
@@ -276,7 +276,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testHeadersAppearInString()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->once()
->andReturn(
@@ -284,8 +284,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
"X-MyHeader: foobar\r\n"
);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$this->assertEquals(
"Content-Type: text/plain; charset=utf-8\r\n".
@@ -296,8 +296,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testSetAndGetBody()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$entity->setBody("blah\r\nblah!");
$this->assertEquals("blah\r\nblah!", $entity->getBody());
@@ -305,13 +305,13 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsAppended()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->once()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBody("blah\r\nblah!");
$this->assertEquals(
@@ -324,9 +324,9 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testGetBodyReturnsStringFromByteStream()
{
- $os = $this->_createOutputStream('byte stream string');
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $os = $this->createOutputStream('byte stream string');
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$entity->setBody($os);
$this->assertEquals('byte stream string', $entity->getBody());
@@ -334,14 +334,14 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testByteStreamBodyIsAppended()
{
- $headers = $this->_createHeaderSet(array(), false);
- $os = $this->_createOutputStream('streamed');
+ $headers = $this->createHeaderSet([], false);
+ $os = $this->createOutputStream('streamed');
$headers->shouldReceive('toString')
->once()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBody($os);
$this->assertEquals(
@@ -364,8 +364,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
"/" / ":" / "=" / "?"
*/
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertRegExp(
'/^[a-zA-Z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-zA-Z0-9\'\(\)\+_\-,\.\/:=\?]$/D',
@@ -375,8 +375,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBoundaryNeverChanges()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$firstBoundary = $entity->getBoundary();
for ($i = 0; $i < 10; ++$i) {
@@ -386,8 +386,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBoundaryCanBeSet()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$entity->setBoundary('foobar');
$this->assertEquals('foobar', $entity->getBoundary());
@@ -395,29 +395,29 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testAddingChildrenGeneratesBoundaryInHeaders()
{
- $child = $this->_createChild();
- $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);
+ $child = $this->createChild();
+ $cType = $this->createHeader('Content-Type', 'text/plain', [], false);
$cType->shouldReceive('setParameter')
->once()
->with('boundary', \Mockery::any());
$cType->shouldReceive('setParameter')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($this->_createHeaderSet(array(
+ $entity = $this->createEntity($this->createHeaderSet([
'Content-Type' => $cType,
- )),
- $this->_createEncoder(), $this->_createCache()
+ ]),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
}
public function testChildrenOfLevelAttachmentAndLessCauseMultipartMixed()
{
- for ($level = Swift_Mime_MimeEntity::LEVEL_MIXED;
- $level > Swift_Mime_MimeEntity::LEVEL_TOP; $level /= 2) {
- $child = $this->_createChild($level);
- $cType = $this->_createHeader(
- 'Content-Type', 'text/plain', array(), false
+ for ($level = Swift_Mime_SimpleMimeEntity::LEVEL_MIXED;
+ $level > Swift_Mime_SimpleMimeEntity::LEVEL_TOP; $level /= 2) {
+ $child = $this->createChild($level);
+ $cType = $this->createHeader(
+ 'Content-Type', 'text/plain', [], false
);
$cType->shouldReceive('setFieldBodyModel')
->once()
@@ -425,21 +425,21 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
$cType->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
}
}
public function testChildrenOfLevelAlternativeAndLessCauseMultipartAlternative()
{
- for ($level = Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE;
- $level > Swift_Mime_MimeEntity::LEVEL_MIXED; $level /= 2) {
- $child = $this->_createChild($level);
- $cType = $this->_createHeader(
- 'Content-Type', 'text/plain', array(), false
+ for ($level = Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE;
+ $level > Swift_Mime_SimpleMimeEntity::LEVEL_MIXED; $level /= 2) {
+ $child = $this->createChild($level);
+ $cType = $this->createHeader(
+ 'Content-Type', 'text/plain', [], false
);
$cType->shouldReceive('setFieldBodyModel')
->once()
@@ -447,21 +447,21 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
$cType->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
}
}
public function testChildrenOfLevelRelatedAndLessCauseMultipartRelated()
{
- for ($level = Swift_Mime_MimeEntity::LEVEL_RELATED;
- $level > Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE; $level /= 2) {
- $child = $this->_createChild($level);
- $cType = $this->_createHeader(
- 'Content-Type', 'text/plain', array(), false
+ for ($level = Swift_Mime_SimpleMimeEntity::LEVEL_RELATED;
+ $level > Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE; $level /= 2) {
+ $child = $this->createChild($level);
+ $cType = $this->createHeader(
+ 'Content-Type', 'text/plain', [], false
);
$cType->shouldReceive('setFieldBodyModel')
->once()
@@ -469,61 +469,61 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
$cType->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $entity = $this->_createEntity($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
}
}
public function testHighestLevelChildDeterminesContentType()
{
- $combinations = array(
- array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,
- Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
- Swift_Mime_MimeEntity::LEVEL_RELATED,
- ),
+ $combinations = [
+ ['levels' => [Swift_Mime_SimpleMimeEntity::LEVEL_MIXED,
+ Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
+ Swift_Mime_SimpleMimeEntity::LEVEL_RELATED,
+ ],
'type' => 'multipart/mixed',
- ),
- array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,
- Swift_Mime_MimeEntity::LEVEL_RELATED,
- ),
+ ],
+ ['levels' => [Swift_Mime_SimpleMimeEntity::LEVEL_MIXED,
+ Swift_Mime_SimpleMimeEntity::LEVEL_RELATED,
+ ],
'type' => 'multipart/mixed',
- ),
- array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED,
- Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
- ),
+ ],
+ ['levels' => [Swift_Mime_SimpleMimeEntity::LEVEL_MIXED,
+ Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
+ ],
'type' => 'multipart/mixed',
- ),
- array('levels' => array(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
- Swift_Mime_MimeEntity::LEVEL_RELATED,
- ),
+ ],
+ ['levels' => [Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
+ Swift_Mime_SimpleMimeEntity::LEVEL_RELATED,
+ ],
'type' => 'multipart/alternative',
- ),
- );
+ ],
+ ];
foreach ($combinations as $combination) {
- $children = array();
+ $children = [];
foreach ($combination['levels'] as $level) {
- $children[] = $this->_createChild($level);
+ $children[] = $this->createChild($level);
}
- $cType = $this->_createHeader(
- 'Content-Type', 'text/plain', array(), false
+ $cType = $this->createHeader(
+ 'Content-Type', 'text/plain', [], false
);
$cType->shouldReceive('setFieldBodyModel')
->once()
->with($combination['type']);
- $headerSet = $this->_createHeaderSet(array('Content-Type' => $cType));
+ $headerSet = $this->createHeaderSet(['Content-Type' => $cType]);
$headerSet->shouldReceive('newInstance')
->zeroOrMoreTimes()
->andReturnUsing(function () use ($headerSet) {
return $headerSet;
});
- $entity = $this->_createEntity($headerSet,
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($headerSet,
+ $this->createEncoder(), $this->createCache()
);
$entity->setChildren($children);
}
@@ -535,15 +535,15 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
(excerpt too verbose to paste here)
*/
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
- $child1 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $child1 = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/plain\r\n".
"\r\n".
'foobar', 'text/plain'
);
- $child2 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $child2 = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/html\r\n".
"\r\n".
'<b>foobar</b>', 'text/html'
@@ -553,11 +553,11 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->zeroOrMoreTimes()
->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBoundary('xxx');
- $entity->setChildren(array($child1, $child2));
+ $entity->setChildren([$child1, $child2]);
$this->assertEquals(
"Content-Type: multipart/alternative; boundary=\"xxx\"\r\n".
@@ -577,16 +577,16 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testMixingLevelsIsHierarchical()
{
- $headers = $this->_createHeaderSet(array(), false);
- $newHeaders = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
+ $newHeaders = $this->createHeaderSet([], false);
- $part = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $part = $this->createChild(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/plain\r\n".
"\r\n".
'foobar'
);
- $attachment = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_MIXED,
+ $attachment = $this->createChild(Swift_Mime_SimpleMimeEntity::LEVEL_MIXED,
"Content-Type: application/octet-stream\r\n".
"\r\n".
'data'
@@ -602,11 +602,11 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->zeroOrMoreTimes()
->andReturn("Content-Type: multipart/alternative; boundary=\"yyy\"\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBoundary('xxx');
- $entity->setChildren(array($part, $attachment));
+ $entity->setChildren([$part, $attachment]);
$this->assertRegExp(
'~^'.
@@ -630,56 +630,56 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testSettingEncoderNotifiesChildren()
{
- $child = $this->_createChild(0, '', false);
- $encoder = $this->_createEncoder('base64');
+ $child = $this->createChild(0, '', false);
+ $encoder = $this->createEncoder('base64');
$child->shouldReceive('encoderChanged')
->once()
->with($encoder);
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
$entity->setEncoder($encoder);
}
public function testReceiptOfEncoderChangeNotifiesChildren()
{
- $child = $this->_createChild(0, '', false);
- $encoder = $this->_createEncoder('base64');
+ $child = $this->createChild(0, '', false);
+ $encoder = $this->createEncoder('base64');
$child->shouldReceive('encoderChanged')
->once()
->with($encoder);
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
$entity->encoderChanged($encoder);
}
public function testReceiptOfCharsetChangeNotifiesChildren()
{
- $child = $this->_createChild(0, '', false);
+ $child = $this->createChild(0, '', false);
$child->shouldReceive('charsetChanged')
->once()
->with('windows-874');
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $entity->setChildren(array($child));
+ $entity->setChildren([$child]);
$entity->charsetChanged('windows-874');
}
public function testEntityIsWrittenToByteStream()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $is = $this->_createInputStream(false);
+ $is = $this->createInputStream(false);
$is->expects($this->atLeastOnce())
->method('write');
@@ -688,10 +688,10 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testEntityHeadersAreComittedToByteStream()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $is = $this->_createInputStream(false);
+ $is = $this->createInputStream(false);
$is->expects($this->atLeastOnce())
->method('write');
$is->expects($this->atLeastOnce())
@@ -702,28 +702,28 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testOrderingTextBeforeHtml()
{
- $htmlChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $htmlChild = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/html\r\n".
"\r\n".
'HTML PART',
'text/html'
);
- $textChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $textChild = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/plain\r\n".
"\r\n".
'TEXT PART',
'text/plain'
);
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBoundary('xxx');
- $entity->setChildren(array($htmlChild, $textChild));
+ $entity->setChildren([$htmlChild, $textChild]);
$this->assertEquals(
"Content-Type: multipart/alternative; boundary=\"xxx\"\r\n".
@@ -742,28 +742,28 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testOrderingEqualContentTypesMaintainsOriginalOrdering()
{
- $firstChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $firstChild = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/plain\r\n".
"\r\n".
'PART 1',
'text/plain'
);
- $secondChild = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE,
+ $secondChild = new MimeEntityFixture(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE,
"Content-Type: text/plain\r\n".
"\r\n".
'PART 2',
'text/plain'
);
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: multipart/alternative; boundary=\"xxx\"\r\n");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
- $this->_createCache()
+ $entity = $this->createEntity($headers, $this->createEncoder(),
+ $this->createCache()
);
$entity->setBoundary('xxx');
- $entity->setChildren(array($firstChild, $secondChild));
+ $entity->setChildren([$firstChild, $secondChild]);
$this->assertEquals(
"Content-Type: multipart/alternative; boundary=\"xxx\"\r\n".
@@ -782,8 +782,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testUnsettingChildrenRestoresContentType()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);
- $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE);
+ $cType = $this->createHeader('Content-Type', 'text/plain', [], false);
+ $child = $this->createChild(Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE);
$cType->shouldReceive('setFieldBodyModel')
->twice()
@@ -795,25 +795,25 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->zeroOrMoreTimes()
->with(\Mockery::not('multipart/alternative', 'image/jpeg'));
- $entity = $this->_createEntity($this->_createHeaderSet(array(
+ $entity = $this->createEntity($this->createHeaderSet([
'Content-Type' => $cType,
- )),
- $this->_createEncoder(), $this->_createCache()
+ ]),
+ $this->createEncoder(), $this->createCache()
);
$entity->setContentType('image/jpeg');
- $entity->setChildren(array($child));
- $entity->setChildren(array());
+ $entity->setChildren([$child]);
+ $entity->setChildren([]);
}
public function testBodyIsReadFromCacheWhenUsingToStringIfPresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
+ $cache = $this->createCache(false);
$cache->shouldReceive('hasKey')
->once()
->with(\Mockery::any(), 'body')
@@ -823,7 +823,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->with(\Mockery::any(), 'body')
->andReturn("\r\ncache\r\ncache!");
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -838,12 +838,12 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsAddedToCacheWhenUsingToString()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
+ $cache = $this->createCache(false);
$cache->shouldReceive('hasKey')
->once()
->with(\Mockery::any(), 'body')
@@ -852,7 +852,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->once()
->with(\Mockery::any(), 'body', "\r\nblah\r\nblah!", Swift_KeyCache::MODE_WRITE);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -862,13 +862,13 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsClearedFromCacheIfNewBodySet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $cache = $this->createCache(false);
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -885,13 +885,13 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsNotClearedFromCacheIfSameBodySet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $cache = $this->createCache(false);
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -907,14 +907,14 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsClearedFromCacheIfNewEncoderSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
- $otherEncoder = $this->_createEncoder();
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $cache = $this->createCache(false);
+ $otherEncoder = $this->createEncoder();
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -931,8 +931,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsReadFromCacheWhenUsingToByteStreamIfPresent()
{
- $is = $this->_createInputStream();
- $cache = $this->_createCache(false);
+ $is = $this->createInputStream();
+ $cache = $this->createCache(false);
$cache->shouldReceive('hasKey')
->once()
->with(\Mockery::any(), 'body')
@@ -941,8 +941,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->once()
->with(\Mockery::any(), 'body', $is);
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $cache
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $cache
);
$entity->setBody('foo');
@@ -951,8 +951,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testBodyIsAddedToCacheWhenUsingToByteStream()
{
- $is = $this->_createInputStream();
- $cache = $this->_createCache(false);
+ $is = $this->createInputStream();
+ $cache = $this->createCache(false);
$cache->shouldReceive('hasKey')
->once()
->with(\Mockery::any(), 'body')
@@ -961,8 +961,8 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
->once()
->with(\Mockery::any(), 'body');
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $cache
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $cache
);
$entity->setBody('foo');
@@ -971,28 +971,28 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
public function testFluidInterface()
{
- $entity = $this->_createEntity($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $entity = $this->createEntity($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertSame($entity,
$entity
->setContentType('text/plain')
- ->setEncoder($this->_createEncoder())
+ ->setEncoder($this->createEncoder())
->setId('foo@bar')
->setDescription('my description')
->setMaxLineLength(998)
->setBody('xx')
->setBoundary('xyz')
- ->setChildren(array())
+ ->setChildren([])
);
}
- abstract protected function _createEntity($headers, $encoder, $cache);
+ abstract protected function createEntity($headers, $encoder, $cache);
- protected function _createChild($level = null, $string = '', $stub = true)
+ protected function createChild($level = null, $string = '', $stub = true)
{
- $child = $this->getMockery('Swift_Mime_MimeEntity')->shouldIgnoreMissing();
+ $child = $this->getMockery('Swift_Mime_SimpleMimeEntity')->shouldIgnoreMissing();
if (isset($level)) {
$child->shouldReceive('getNestingLevel')
->zeroOrMoreTimes()
@@ -1005,7 +1005,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
return $child;
}
- protected function _createEncoder($name = 'quoted-printable', $stub = true)
+ protected function createEncoder($name = 'quoted-printable', $stub = true)
{
$encoder = $this->getMockBuilder('Swift_Mime_ContentEncoder')->getMock();
$encoder->expects($this->any())
@@ -1022,14 +1022,14 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
return $encoder;
}
- protected function _createCache($stub = true)
+ protected function createCache($stub = true)
{
return $this->getMockery('Swift_KeyCache')->shouldIgnoreMissing();
}
- protected function _createHeaderSet($headers = array(), $stub = true)
+ protected function createHeaderSet($headers = [], $stub = true)
{
- $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();
+ $set = $this->getMockery('Swift_Mime_SimpleHeaderSet')->shouldIgnoreMissing();
$set->shouldReceive('get')
->zeroOrMoreTimes()
->andReturnUsing(function ($key) use ($headers) {
@@ -1044,9 +1044,9 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
return $set;
}
- protected function _createHeader($name, $model = null, $params = array(), $stub = true)
+ protected function createHeader($name, $model = null, $params = [], $stub = true)
{
- $header = $this->getMockery('Swift_Mime_ParameterizedHeader')->shouldIgnoreMissing();
+ $header = $this->getMockery('Swift_Mime_Headers_ParameterizedHeader')->shouldIgnoreMissing();
$header->shouldReceive('getFieldName')
->zeroOrMoreTimes()
->andReturn($name);
@@ -1062,7 +1062,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
return $header;
}
- protected function _createOutputStream($data = null, $stub = true)
+ protected function createOutputStream($data = null, $stub = true)
{
$os = $this->getMockery('Swift_OutputByteStream');
if (isset($data)) {
@@ -1085,7 +1085,7 @@ abstract class Swift_Mime_AbstractMimeEntityTest extends \SwiftMailerTestCase
return $os;
}
- protected function _createInputStream($stub = true)
+ protected function createInputStream($stub = true)
{
return $this->getMockBuilder('Swift_InputByteStream')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php
index 2c1e581ebb..912d529c72 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php
@@ -1,14 +1,15 @@
<?php
+
class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
{
public function testNestingLevelIsAttachment()
{
- $attachment = $this->_createAttachment($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(
- Swift_Mime_MimeEntity::LEVEL_MIXED, $attachment->getNestingLevel()
+ Swift_Mime_SimpleMimeEntity::LEVEL_MIXED, $attachment->getNestingLevel()
);
}
@@ -17,18 +18,18 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
/* -- RFC 2183, 2.1, 2.2.
*/
- $disposition = $this->_createHeader('Content-Disposition', 'attachment');
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $disposition = $this->createHeader('Content-Disposition', 'attachment');
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('attachment', $attachment->getDisposition());
}
public function testDispositionIsSetInHeader()
{
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array(), false
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ [], false
);
$disposition->shouldReceive('setFieldBodyModel')
->once()
@@ -36,46 +37,46 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
$disposition->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setDisposition('inline');
}
public function testDispositionIsAddedIfNonePresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addParameterizedHeader')
->once()
->with('Content-Disposition', 'inline');
$headers->shouldReceive('addParameterizedHeader')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($headers, $this->_createEncoder(),
- $this->_createCache()
+ $attachment = $this->createAttachment($headers, $this->createEncoder(),
+ $this->createCache()
);
$attachment->setDisposition('inline');
}
public function testDispositionIsAutoDefaultedToAttachment()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addParameterizedHeader')
->once()
->with('Content-Disposition', 'attachment');
$headers->shouldReceive('addParameterizedHeader')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($headers, $this->_createEncoder(),
- $this->_createCache()
+ $attachment = $this->createAttachment($headers, $this->createEncoder(),
+ $this->createCache()
);
}
public function testDefaultContentTypeInitializedToOctetStream()
{
- $cType = $this->_createHeader('Content-Type', '',
- array(), false
+ $cType = $this->createHeader('Content-Type', '',
+ [], false
);
$cType->shouldReceive('setFieldBodyModel')
->once()
@@ -83,9 +84,9 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
$cType->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
}
@@ -94,20 +95,20 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
/* -- RFC 2183, 2.3.
*/
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('filename' => 'foo.txt')
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['filename' => 'foo.txt']
);
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('foo.txt', $attachment->getFilename());
}
public function testFilenameIsSetInHeader()
{
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('filename' => 'foo.txt'), false
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['filename' => 'foo.txt'], false
);
$disposition->shouldReceive('setParameter')
->once()
@@ -115,9 +116,9 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
$disposition->shouldReceive('setParameter')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setFilename('bar.txt');
}
@@ -128,8 +129,8 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
This is a legacy requirement which isn't covered by up-to-date RFCs.
*/
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array(), false
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ [], false
);
$cType->shouldReceive('setParameter')
->once()
@@ -137,9 +138,9 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
$cType->shouldReceive('setParameter')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setFilename('bar.txt');
}
@@ -149,20 +150,20 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
/* -- RFC 2183, 2.7.
*/
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('size' => 1234)
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['size' => 1234]
);
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(1234, $attachment->getSize());
}
public function testSizeIsSetInHeader()
{
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array(), false
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ [], false
);
$disposition->shouldReceive('setParameter')
->once()
@@ -170,91 +171,91 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
$disposition->shouldReceive('setParameter')
->zeroOrMoreTimes();
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setSize(12345);
}
public function testFilnameCanBeReadFromFileStream()
{
- $file = $this->_createFileStream('/bar/file.ext', '');
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('filename' => 'foo.txt'), false
+ $file = $this->createFileStream('/bar/file.ext', '');
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['filename' => 'foo.txt'], false
);
$disposition->shouldReceive('setParameter')
->once()
->with('filename', 'file.ext');
- $attachment = $this->_createAttachment($this->_createHeaderSet(array(
- 'Content-Disposition' => $disposition, )),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet([
+ 'Content-Disposition' => $disposition, ]),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setFile($file);
}
public function testContentTypeCanBeSetViaSetFile()
{
- $file = $this->_createFileStream('/bar/file.ext', '');
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('filename' => 'foo.txt'), false
+ $file = $this->createFileStream('/bar/file.ext', '');
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['filename' => 'foo.txt'], false
);
$disposition->shouldReceive('setParameter')
->once()
->with('filename', 'file.ext');
- $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);
+ $ctype = $this->createHeader('Content-Type', 'text/plain', [], false);
$ctype->shouldReceive('setFieldBodyModel')
->once()
->with('text/html');
$ctype->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $headers = $this->_createHeaderSet(array(
+ $headers = $this->createHeaderSet([
'Content-Disposition' => $disposition,
'Content-Type' => $ctype,
- ));
+ ]);
- $attachment = $this->_createAttachment($headers, $this->_createEncoder(),
- $this->_createCache()
+ $attachment = $this->createAttachment($headers, $this->createEncoder(),
+ $this->createCache()
);
$attachment->setFile($file, 'text/html');
}
public function XtestContentTypeCanBeLookedUpFromCommonListIfNotProvided()
{
- $file = $this->_createFileStream('/bar/file.zip', '');
- $disposition = $this->_createHeader('Content-Disposition', 'attachment',
- array('filename' => 'foo.zip'), false
+ $file = $this->createFileStream('/bar/file.zip', '');
+ $disposition = $this->createHeader('Content-Disposition', 'attachment',
+ ['filename' => 'foo.zip'], false
);
$disposition->shouldReceive('setParameter')
->once()
->with('filename', 'file.zip');
- $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false);
+ $ctype = $this->createHeader('Content-Type', 'text/plain', [], false);
$ctype->shouldReceive('setFieldBodyModel')
->once()
->with('application/zip');
$ctype->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $headers = $this->_createHeaderSet(array(
+ $headers = $this->createHeaderSet([
'Content-Disposition' => $disposition,
'Content-Type' => $ctype,
- ));
+ ]);
- $attachment = $this->_createAttachment($headers, $this->_createEncoder(),
- $this->_createCache(), array('zip' => 'application/zip', 'txt' => 'text/plain')
+ $attachment = $this->createAttachment($headers, $this->createEncoder(),
+ $this->createCache(), ['zip' => 'application/zip', 'txt' => 'text/plain']
);
$attachment->setFile($file);
}
public function testDataCanBeReadFromFile()
{
- $file = $this->_createFileStream('/foo/file.ext', '<some data>');
- $attachment = $this->_createAttachment($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $file = $this->createFileStream('/foo/file.ext', '<some data>');
+ $attachment = $this->createAttachment($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$attachment->setFile($file);
$this->assertEquals('<some data>', $attachment->getBody());
@@ -262,37 +263,39 @@ class Swift_Mime_AttachmentTest extends Swift_Mime_AbstractMimeEntityTest
public function testFluidInterface()
{
- $attachment = $this->_createAttachment($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $attachment = $this->createAttachment($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertSame($attachment,
$attachment
->setContentType('application/pdf')
- ->setEncoder($this->_createEncoder())
+ ->setEncoder($this->createEncoder())
->setId('foo@bar')
->setDescription('my pdf')
->setMaxLineLength(998)
->setBody('xx')
->setBoundary('xyz')
- ->setChildren(array())
+ ->setChildren([])
->setDisposition('inline')
->setFilename('afile.txt')
->setSize(123)
- ->setFile($this->_createFileStream('foo.txt', ''))
+ ->setFile($this->createFileStream('foo.txt', ''))
);
}
- protected function _createEntity($headers, $encoder, $cache)
+ protected function createEntity($headers, $encoder, $cache)
{
- return $this->_createAttachment($headers, $encoder, $cache);
+ return $this->createAttachment($headers, $encoder, $cache);
}
- protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array())
+ protected function createAttachment($headers, $encoder, $cache, $mimeTypes = [])
{
- return new Swift_Mime_Attachment($headers, $encoder, $cache, new Swift_Mime_Grammar(), $mimeTypes);
+ $idGenerator = new Swift_Mime_IdGenerator('example.com');
+
+ return new Swift_Mime_Attachment($headers, $encoder, $cache, $idGenerator, $mimeTypes);
}
- protected function _createFileStream($path, $data, $stub = true)
+ protected function createFileStream($path, $data, $stub = true)
{
$file = $this->getMockery('Swift_FileStream');
$file->shouldReceive('getPath')
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 1571fce36c..a05c68a469 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php
@@ -2,16 +2,16 @@
class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTestCase
{
- private $_encoder;
+ private $encoder;
protected function setUp()
{
- $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
+ $this->encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
}
public function testNameIsBase64()
{
- $this->assertEquals('base64', $this->_encoder->getName());
+ $this->assertEquals('base64', $this->encoder->getName());
}
/*
@@ -32,8 +32,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
of which is translated into a single digit in the base64 alphabet.
*/
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -46,7 +46,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$this->assertEquals('MTIz', $collection->content);
}
@@ -73,8 +73,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
*/
for ($i = 0; $i < 30; ++$i) {
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -82,20 +82,20 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->andReturnUsing($collection);
$os->shouldReceive('read')
->once()
- ->andReturn(pack('C', rand(0, 255)));
+ ->andReturn(pack('C', random_int(0, 255)));
$os->shouldReceive('read')
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$this->assertRegExp('~^[a-zA-Z0-9/\+]{2}==$~', $collection->content,
'%s: A single byte should have 2 bytes of padding'
);
}
for ($i = 0; $i < 30; ++$i) {
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -103,20 +103,20 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->andReturnUsing($collection);
$os->shouldReceive('read')
->once()
- ->andReturn(pack('C*', rand(0, 255), rand(0, 255)));
+ ->andReturn(pack('C*', random_int(0, 255), random_int(0, 255)));
$os->shouldReceive('read')
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$this->assertRegExp('~^[a-zA-Z0-9/\+]{3}=$~', $collection->content,
'%s: Two bytes should have 1 byte of padding'
);
}
for ($i = 0; $i < 30; ++$i) {
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -124,12 +124,12 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->andReturnUsing($collection);
$os->shouldReceive('read')
->once()
- ->andReturn(pack('C*', rand(0, 255), rand(0, 255), rand(0, 255)));
+ ->andReturn(pack('C*', random_int(0, 255), random_int(0, 255), random_int(0, 255)));
$os->shouldReceive('read')
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$this->assertRegExp('~^[a-zA-Z0-9/\+]{4}$~', $collection->content,
'%s: Three bytes should have no padding'
);
@@ -144,8 +144,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
found in Table 1 must be ignored by decoding software.
*/
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -176,7 +176,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is);
+ $this->encoder->encodeByteStream($os, $is);
$this->assertEquals(
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\r\n".
'U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',
@@ -186,8 +186,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
public function testMaximumLineLengthCanBeDifferent()
{
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -218,7 +218,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is, 0, 50);
+ $this->encoder->encodeByteStream($os, $is, 0, 50);
$this->assertEquals(
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3OD\r\n".
"kwQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJj\r\n".
@@ -229,8 +229,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
public function testMaximumLineLengthIsNeverMoreThan76Chars()
{
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -261,7 +261,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is, 0, 100);
+ $this->encoder->encodeByteStream($os, $is, 0, 100);
$this->assertEquals(
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\r\n".
'U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',
@@ -271,8 +271,8 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
public function testFirstLineLengthCanBeDifferent()
{
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -303,7 +303,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
->zeroOrMoreTimes()
->andReturn(false);
- $this->_encoder->encodeByteStream($os, $is, 19);
+ $this->encoder->encodeByteStream($os, $is, 19);
$this->assertEquals(
"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDR\r\n".
'EVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts',
@@ -311,12 +311,12 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderTest extends \SwiftMailerTes
);
}
- private function _createOutputByteStream($stub = false)
+ private function createOutputByteStream($stub = false)
{
return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();
}
- private function _createInputByteStream($stub = false)
+ private function createInputByteStream($stub = false)
{
return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();
}
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 ca44e11ab8..270d02c3c5 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php
@@ -4,16 +4,16 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
{
public function testNameCanBeSpecifiedInConstructor()
{
- $encoder = $this->_getEncoder('7bit');
+ $encoder = $this->getEncoder('7bit');
$this->assertEquals('7bit', $encoder->getName());
- $encoder = $this->_getEncoder('8bit');
+ $encoder = $this->getEncoder('8bit');
$this->assertEquals('8bit', $encoder->getName());
}
public function testNoOctetsAreModifiedInString()
{
- $encoder = $this->_getEncoder('7bit');
+ $encoder = $this->getEncoder('7bit');
foreach (range(0x00, 0xFF) as $octet) {
$byte = pack('C', $octet);
$this->assertIdenticalBinary($byte, $encoder->encodeString($byte));
@@ -22,12 +22,12 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
public function testNoOctetsAreModifiedInByteStream()
{
- $encoder = $this->_getEncoder('7bit');
+ $encoder = $this->getEncoder('7bit');
foreach (range(0x00, 0xFF) as $octet) {
$byte = pack('C', $octet);
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -47,9 +47,9 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
public function testLineLengthCanBeSpecified()
{
- $encoder = $this->_getEncoder('7bit');
+ $encoder = $this->getEncoder('7bit');
- $chars = array();
+ $chars = [];
for ($i = 0; $i < 50; ++$i) {
$chars[] = 'a';
}
@@ -65,10 +65,10 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
public function testLineLengthCanBeSpecifiedInByteStream()
{
- $encoder = $this->_getEncoder('7bit');
+ $encoder = $this->getEncoder('7bit');
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -94,7 +94,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
public function testencodeStringGeneratesCorrectCrlf()
{
- $encoder = $this->_getEncoder('7bit', true);
+ $encoder = $this->getEncoder('7bit', true);
$this->assertEquals("a\r\nb", $encoder->encodeString("a\rb"),
'%s: Line endings should be standardized'
);
@@ -114,13 +114,13 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
public function crlfProvider()
{
- return array(
- array("\r", "a\r\nb"),
- array("\n", "a\r\nb"),
- array("\n\r", "a\r\n\r\nb"),
- array("\n\n", "a\r\n\r\nb"),
- array("\r\r", "a\r\n\r\nb"),
- );
+ return [
+ ["\r", "a\r\nb"],
+ ["\n", "a\r\nb"],
+ ["\n\r", "a\r\n\r\nb"],
+ ["\n\n", "a\r\n\r\nb"],
+ ["\r\r", "a\r\n\r\nb"],
+ ];
}
/**
@@ -128,10 +128,10 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
*/
public function testCanonicEncodeByteStreamGeneratesCorrectCrlf($test, $expected)
{
- $encoder = $this->_getEncoder('7bit', true);
+ $encoder = $this->getEncoder('7bit', true);
- $os = $this->_createOutputByteStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -154,17 +154,17 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderTest extends \SwiftMailerTest
$this->assertEquals($expected, $collection->content);
}
- private function _getEncoder($name, $canonical = false)
+ private function getEncoder($name, $canonical = false)
{
return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical);
}
- private function _createOutputByteStream($stub = false)
+ private function createOutputByteStream($stub = false)
{
return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();
}
- private function _createInputByteStream($stub = false)
+ private function createInputByteStream($stub = false)
{
return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();
}
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 7762bbe909..4e050a158b 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php
@@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
public function testNameIsQuotedPrintable()
{
$encoder = new Swift_Mime_ContentEncoder_QpContentEncoder(
- $this->_createCharacterStream(true)
+ $this->createCharacterStream(true)
);
$this->assertEquals('quoted-printable', $encoder->getName());
}
@@ -40,9 +40,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
foreach (array_merge(range(33, 60), range(62, 126)) as $ordinal) {
$char = chr($ordinal);
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -55,7 +55,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -95,9 +95,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
$SPACE = chr(0x20); //32
//HT
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -110,22 +110,22 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x09));
+ ->andReturn([0x09]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x09));
+ ->andReturn([0x09]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0D));
+ ->andReturn([0x0D]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0A));
+ ->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('b')));
+ ->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -136,9 +136,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
$this->assertEquals("a\t=09\r\nb", $collection->content);
//SPACE
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -151,22 +151,22 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x20));
+ ->andReturn([0x20]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x20));
+ ->andReturn([0x20]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0D));
+ ->andReturn([0x0D]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0A));
+ ->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('b')));
+ ->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -206,9 +206,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
equivalent to performing the three steps separately.
*/
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -221,31 +221,31 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0D));
+ ->andReturn([0x0D]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0A));
+ ->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('b')));
+ ->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0D));
+ ->andReturn([0x0D]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0A));
+ ->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('c')));
+ ->andReturn([ord('c')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0D));
+ ->andReturn([0x0D]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x0A));
+ ->andReturn([0x0A]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -267,9 +267,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
line break in the encoded text.
*/
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -284,7 +284,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
for ($seq = 0; $seq <= 140; ++$seq) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
}
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
@@ -297,9 +297,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
public function testMaxLineLengthCanBeSpecified()
{
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -314,7 +314,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
for ($seq = 0; $seq <= 100; ++$seq) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
}
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
@@ -334,9 +334,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
foreach (range(0, 32) as $ordinal) {
$char = chr($ordinal);
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -349,7 +349,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -368,9 +368,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
$char = chr(61);
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -383,7 +383,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(61));
+ ->andReturn([61]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -402,9 +402,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
foreach (range(127, 255) as $ordinal) {
$char = chr($ordinal);
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -417,7 +417,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
->with($os);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($ordinal));
+ ->andReturn([$ordinal]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
@@ -430,9 +430,9 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
public function testFirstLineLengthCanBeDifferent()
{
- $os = $this->_createOutputByteStream(true);
- $charStream = $this->_createCharacterStream();
- $is = $this->_createInputByteStream();
+ $os = $this->createOutputByteStream(true);
+ $charStream = $this->createCharacterStream();
+ $is = $this->createInputByteStream();
$collection = new Swift_StreamCollector();
$is->shouldReceive('write')
@@ -447,7 +447,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
for ($seq = 0; $seq <= 140; ++$seq) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
}
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
@@ -463,7 +463,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
public function testObserverInterfaceCanChangeCharset()
{
- $stream = $this->_createCharacterStream();
+ $stream = $this->createCharacterStream();
$stream->shouldReceive('setCharacterSet')
->once()
->with('windows-1252');
@@ -491,7 +491,7 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
);
}
- private function _createCharacterStream($stub = false)
+ private function createCharacterStream($stub = false)
{
return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();
}
@@ -504,12 +504,12 @@ class Swift_Mime_ContentEncoder_QpContentEncoderTest extends \SwiftMailerTestCas
return new Swift_Mime_ContentEncoder_QpContentEncoder($charStream);
}
- private function _createOutputByteStream($stub = false)
+ private function createOutputByteStream($stub = false)
{
return $this->getMockery('Swift_OutputByteStream')->shouldIgnoreMissing();
}
- private function _createInputByteStream($stub = false)
+ private function createInputByteStream($stub = false)
{
return $this->getMockery('Swift_InputByteStream')->shouldIgnoreMissing();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php
index 3a1fc512f3..74f2accd36 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php
@@ -1,55 +1,59 @@
<?php
+
class Swift_Mime_EmbeddedFileTest extends Swift_Mime_AttachmentTest
{
public function testNestingLevelIsAttachment()
{
- //Overridden
+ // previous loop would fail if there is an issue
+ $this->addToAssertionCount(1);
}
public function testNestingLevelIsEmbedded()
{
- $file = $this->_createEmbeddedFile($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $file = $this->createEmbeddedFile($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(
- Swift_Mime_MimeEntity::LEVEL_RELATED, $file->getNestingLevel()
+ Swift_Mime_SimpleMimeEntity::LEVEL_RELATED, $file->getNestingLevel()
);
}
public function testIdIsAutoGenerated()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addIdHeader')
->once()
->with('Content-ID', '/^.*?@.*?$/D');
- $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(),
- $this->_createCache()
+ $file = $this->createEmbeddedFile($headers, $this->createEncoder(),
+ $this->createCache()
);
}
public function testDefaultDispositionIsInline()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addParameterizedHeader')
->once()
->with('Content-Disposition', 'inline');
$headers->shouldReceive('addParameterizedHeader')
->zeroOrMoreTimes();
- $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(),
- $this->_createCache()
+ $file = $this->createEmbeddedFile($headers, $this->createEncoder(),
+ $this->createCache()
);
}
- protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array())
+ protected function createAttachment($headers, $encoder, $cache, $mimeTypes = [])
{
- return $this->_createEmbeddedFile($headers, $encoder, $cache, $mimeTypes);
+ return $this->createEmbeddedFile($headers, $encoder, $cache, $mimeTypes);
}
- private function _createEmbeddedFile($headers, $encoder, $cache)
+ private function createEmbeddedFile($headers, $encoder, $cache)
{
- return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, new Swift_Mime_Grammar());
+ $idGenerator = new Swift_Mime_IdGenerator('example.com');
+
+ return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, $idGenerator);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php
index 35801556e6..0db540732c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Mime_HeaderEncoder_Base64HeaderEncoderTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_HeaderEncoder_Base64HeaderEncoderTest extends \PHPUnit\Framework\TestCase
{
//Most tests are already covered in Base64EncoderTest since this subclass only
// adds a getName() method
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 b5a10fe478..1b42300c16 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php
@@ -7,8 +7,8 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
public function testNameIsQ()
{
- $encoder = $this->_createEncoder(
- $this->_createCharacterStream(true)
+ $encoder = $this->createEncoder(
+ $this->createCharacterStream(true)
);
$this->assertEquals('Q', $encoder->getName());
}
@@ -21,12 +21,12 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
the beginning and end of an 'encoded-word' are obvious.
*/
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$charStream->shouldReceive('readBytes')
->atLeast()->times(6)
- ->andReturn(array(ord('a')), array(0x20), array(0x09), array(0x20), array(ord('b')), false);
+ ->andReturn([ord('a')], [0x20], [0x09], [0x20], [ord('b')], false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$this->assertNotRegExp('~[ \t]~', $encoder->encodeString("a \t b"),
'%s: encoded-words in headers cannot contain LWSP as per RFC 2047.'
);
@@ -43,21 +43,21 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
always represents hexadecimal 20, even if the SPACE character
occupies a different code position in the character set in use.
*/
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(0x20));
+ ->andReturn([0x20]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('b')));
+ ->andReturn([ord('b')]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$this->assertEquals('a_b', $encoder->encodeString('a b'),
'%s: Spaces can be represented by more readable underscores as per RFC 2047.'
);
@@ -72,21 +72,21 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
particular, SPACE and TAB MUST NOT be represented as themselves
within encoded words.
*/
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('=')));
+ ->andReturn([ord('=')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('?')));
+ ->andReturn([ord('?')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('_')));
+ ->andReturn([ord('_')]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$this->assertEquals('=3D=3F=5F', $encoder->encodeString('=?_'),
'%s: Chars =, ? and _ (underscore) may not appear as per RFC 2047.'
);
@@ -99,21 +99,21 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
contain the characters "(", ")" or "
*/
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('(')));
+ ->andReturn([ord('(')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('"')));
+ ->andReturn([ord('"')]);
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord(')')));
+ ->andReturn([ord(')')]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$this->assertEquals('=28=22=29', $encoder->encodeString('(")'),
'%s: Chars (, " (DQUOTE) and ) may not appear as per RFC 2047.'
);
@@ -139,21 +139,21 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
$allowedBytes = array_merge(
range(ord('a'), ord('z')), range(ord('A'), ord('Z')),
range(ord('0'), ord('9')),
- array(ord('!'), ord('*'), ord('+'), ord('-'), ord('/'))
+ [ord('!'), ord('*'), ord('+'), ord('-'), ord('/')]
);
foreach (range(0x00, 0xFF) as $byte) {
$char = pack('C', $byte);
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array($byte));
+ ->andReturn([$byte]);
$charStream->shouldReceive('readBytes')
->zeroOrMoreTimes()
->andReturn(false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$encodedChar = $encoder->encodeString($char);
if (in_array($byte, $allowedBytes)) {
@@ -186,14 +186,14 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
$input = str_repeat('a', 140);
- $charStream = $this->_createCharacterStream();
+ $charStream = $this->createCharacterStream();
$output = '';
$seq = 0;
for (; $seq < 140; ++$seq) {
$charStream->shouldReceive('readBytes')
->once()
- ->andReturn(array(ord('a')));
+ ->andReturn([ord('a')]);
if (75 == $seq) {
$output .= "\r\n"; // =\r\n
@@ -205,16 +205,16 @@ class Swift_Mime_HeaderEncoder_QpHeaderEncoderTest extends \SwiftMailerTestCase
->zeroOrMoreTimes()
->andReturn(false);
- $encoder = $this->_createEncoder($charStream);
+ $encoder = $this->createEncoder($charStream);
$this->assertEquals($output, $encoder->encodeString($input));
}
- private function _createEncoder($charStream)
+ private function createEncoder($charStream)
{
return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream);
}
- private function _createCharacterStream($stub = false)
+ private function createCharacterStream($stub = false)
{
return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php
index 1822ea688b..e419306182 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Mime_Headers_DateHeaderTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_Headers_DateHeaderTest extends \PHPUnit\Framework\TestCase
{
/* --
The following tests refer to RFC 2822, section 3.6.1 and 3.3.
@@ -8,62 +8,83 @@ class Swift_Mime_Headers_DateHeaderTest extends \PHPUnit_Framework_TestCase
public function testTypeIsDateHeader()
{
- $header = $this->_getHeader('Date');
+ $header = $this->getHeader('Date');
$this->assertEquals(Swift_Mime_Header::TYPE_DATE, $header->getFieldType());
}
- public function testGetTimestamp()
+ public function testGetDateTime()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setTimestamp($timestamp);
- $this->assertSame($timestamp, $header->getTimestamp());
+ $dateTime = new DateTimeImmutable();
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertSame($dateTime, $header->getDateTime());
}
- public function testTimestampCanBeSetBySetter()
+ public function testDateTimeCanBeSetBySetter()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setTimestamp($timestamp);
- $this->assertSame($timestamp, $header->getTimestamp());
+ $dateTime = new DateTimeImmutable();
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertSame($dateTime, $header->getDateTime());
}
- public function testIntegerTimestampIsConvertedToRfc2822Date()
+ public function testDateTimeIsConvertedToImmutable()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setTimestamp($timestamp);
- $this->assertEquals(date('r', $timestamp), $header->getFieldBody());
+ $dateTime = new DateTime();
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertInstanceOf('DateTimeImmutable', $header->getDateTime());
+ $this->assertEquals($dateTime->getTimestamp(), $header->getDateTime()->getTimestamp());
+ $this->assertEquals($dateTime->getTimezone(), $header->getDateTime()->getTimezone());
+ }
+
+ public function testDateTimeIsImmutable()
+ {
+ $dateTime = new DateTime('2000-01-01 12:00:00 Europe/Berlin');
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+
+ $dateTime->setDate(2002, 2, 2);
+ $this->assertEquals('Sat, 01 Jan 2000 12:00:00 +0100', $header->getDateTime()->format('r'));
+ $this->assertEquals('Sat, 01 Jan 2000 12:00:00 +0100', $header->getFieldBody());
+ }
+
+ public function testDateTimeIsConvertedToRfc2822Date()
+ {
+ $dateTime = new DateTimeImmutable('2000-01-01 12:00:00 Europe/Berlin');
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertEquals('Sat, 01 Jan 2000 12:00:00 +0100', $header->getFieldBody());
}
public function testSetBodyModel()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setFieldBodyModel($timestamp);
- $this->assertEquals(date('r', $timestamp), $header->getFieldBody());
+ $dateTime = new DateTimeImmutable();
+ $header = $this->getHeader('Date');
+ $header->setFieldBodyModel($dateTime);
+ $this->assertEquals($dateTime->format('r'), $header->getFieldBody());
}
public function testGetBodyModel()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setTimestamp($timestamp);
- $this->assertEquals($timestamp, $header->getFieldBodyModel());
+ $dateTime = new DateTimeImmutable();
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertEquals($dateTime, $header->getFieldBodyModel());
}
public function testToString()
{
- $timestamp = time();
- $header = $this->_getHeader('Date');
- $header->setTimestamp($timestamp);
- $this->assertEquals('Date: '.date('r', $timestamp)."\r\n",
+ $dateTime = new DateTimeImmutable('2000-01-01 12:00:00 Europe/Berlin');
+ $header = $this->getHeader('Date');
+ $header->setDateTime($dateTime);
+ $this->assertEquals("Date: Sat, 01 Jan 2000 12:00:00 +0100\r\n",
$header->toString()
);
}
- private function _getHeader($name)
+ private function getHeader($name)
{
- return new Swift_Mime_Headers_DateHeader($name, new Swift_Mime_Grammar());
+ return new Swift_Mime_Headers_DateHeader($name);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php
index 93b3f60921..0d2edb7ea0 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php
@@ -1,10 +1,12 @@
<?php
-class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit\Framework\TestCase
{
public function testTypeIsIdHeader()
{
- $header = $this->_getHeader('Message-ID');
+ $header = $this->getHeader('Message-ID');
$this->assertEquals(Swift_Mime_Header::TYPE_ID, $header->getFieldType());
}
@@ -28,23 +30,23 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
no-fold-literal = "[" *(dtext / quoted-pair) "]"
*/
- $header = $this->_getHeader('Message-ID');
+ $header = $this->getHeader('Message-ID');
$header->setId('id-left@id-right');
$this->assertEquals('<id-left@id-right>', $header->getFieldBody());
}
public function testIdCanBeRetrievedVerbatim()
{
- $header = $this->_getHeader('Message-ID');
+ $header = $this->getHeader('Message-ID');
$header->setId('id-left@id-right');
$this->assertEquals('id-left@id-right', $header->getId());
}
public function testMultipleIdsCanBeSet()
{
- $header = $this->_getHeader('References');
- $header->setIds(array('a@b', 'x@y'));
- $this->assertEquals(array('a@b', 'x@y'), $header->getIds());
+ $header = $this->getHeader('References');
+ $header->setIds(['a@b', 'x@y']);
+ $this->assertEquals(['a@b', 'x@y'], $header->getIds());
}
public function testSettingMultipleIdsProducesAListValue()
@@ -60,8 +62,8 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
references = "References:" 1*msg-id CRLF
*/
- $header = $this->_getHeader('References');
- $header->setIds(array('a@b', 'x@y'));
+ $header = $this->getHeader('References');
+ $header->setIds(['a@b', 'x@y']);
$this->assertEquals('<a@b> <x@y>', $header->getFieldBody());
}
@@ -71,7 +73,7 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
id-left = dot-atom-text / no-fold-quote / obs-id-left
*/
- $header = $this->_getHeader('References');
+ $header = $this->getHeader('References');
$header->setId('"ab"@c');
$this->assertEquals('"ab"@c', $header->getId());
$this->assertEquals('<"ab"@c>', $header->getFieldBody());
@@ -83,7 +85,7 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
no-fold-quote = DQUOTE *(qtext / quoted-pair) DQUOTE
*/
- $header = $this->_getHeader('References');
+ $header = $this->getHeader('References');
$header->setId('"a\\<\\>b"@c');
$this->assertEquals('"a\\<\\>b"@c', $header->getId());
$this->assertEquals('<"a\\<\\>b"@c>', $header->getFieldBody());
@@ -91,22 +93,20 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
public function testIdLeftCanBeDotAtom()
{
- $header = $this->_getHeader('References');
+ $header = $this->getHeader('References');
$header->setId('a.b+&%$.c@d');
$this->assertEquals('a.b+&%$.c@d', $header->getId());
$this->assertEquals('<a.b+&%$.c@d>', $header->getFieldBody());
}
+ /**
+ * @expectedException \Exception
+ * @expectedMessageException "a b c" is not valid id-left
+ */
public function testInvalidIdLeftThrowsException()
{
- try {
- $header = $this->_getHeader('References');
- $header->setId('a b c@d');
- $this->fail(
- 'Exception should be thrown since "a b c" is not valid id-left.'
- );
- } catch (Exception $e) {
- }
+ $header = $this->getHeader('References');
+ $header->setId('a b c@d');
}
public function testIdRightCanBeDotAtom()
@@ -115,7 +115,7 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
id-right = dot-atom-text / no-fold-literal / obs-id-right
*/
- $header = $this->_getHeader('References');
+ $header = $this->getHeader('References');
$header->setId('a@b.c+&%$.d');
$this->assertEquals('a@b.c+&%$.d', $header->getId());
$this->assertEquals('<a@b.c+&%$.d>', $header->getFieldBody());
@@ -127,63 +127,66 @@ class Swift_Mime_Headers_IdentificationHeaderTest extends \PHPUnit_Framework_Tes
no-fold-literal = "[" *(dtext / quoted-pair) "]"
*/
- $header = $this->_getHeader('References');
+ $header = $this->getHeader('References');
$header->setId('a@[1.2.3.4]');
$this->assertEquals('a@[1.2.3.4]', $header->getId());
$this->assertEquals('<a@[1.2.3.4]>', $header->getFieldBody());
}
+ public function testIdRigthIsIdnEncoded()
+ {
+ $header = $this->getHeader('References');
+ $header->setId('a@ä');
+ $this->assertEquals('a@ä', $header->getId());
+ $this->assertEquals('<a@xn--4ca>', $header->getFieldBody());
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedMessageException "b c d" is not valid id-right
+ */
public function testInvalidIdRightThrowsException()
{
- try {
- $header = $this->_getHeader('References');
- $header->setId('a@b c d');
- $this->fail(
- 'Exception should be thrown since "b c d" is not valid id-right.'
- );
- } catch (Exception $e) {
- }
+ $header = $this->getHeader('References');
+ $header->setId('a@b c d');
}
+ /**
+ * @expectedException \Exception
+ * @expectedMessageException "abc" is does not contain @
+ */
public function testMissingAtSignThrowsException()
{
/* -- RFC 2822, 3.6.4.
msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS]
*/
-
- try {
- $header = $this->_getHeader('References');
- $header->setId('abc');
- $this->fail(
- 'Exception should be thrown since "abc" is does not contain @.'
- );
- } catch (Exception $e) {
- }
+ $header = $this->getHeader('References');
+ $header->setId('abc');
}
public function testSetBodyModel()
{
- $header = $this->_getHeader('Message-ID');
+ $header = $this->getHeader('Message-ID');
$header->setFieldBodyModel('a@b');
- $this->assertEquals(array('a@b'), $header->getIds());
+ $this->assertEquals(['a@b'], $header->getIds());
}
public function testGetBodyModel()
{
- $header = $this->_getHeader('Message-ID');
+ $header = $this->getHeader('Message-ID');
$header->setId('a@b');
- $this->assertEquals(array('a@b'), $header->getFieldBodyModel());
+ $this->assertEquals(['a@b'], $header->getFieldBodyModel());
}
public function testStringValue()
{
- $header = $this->_getHeader('References');
- $header->setIds(array('a@b', 'x@y'));
+ $header = $this->getHeader('References');
+ $header->setIds(['a@b', 'x@y']);
$this->assertEquals('References: <a@b> <x@y>'."\r\n", $header->toString());
}
- private function _getHeader($name)
+ private function getHeader($name)
{
- return new Swift_Mime_Headers_IdentificationHeader($name, new Swift_Mime_Grammar());
+ return new Swift_Mime_Headers_IdentificationHeader($name, new EmailValidator(), new Swift_AddressEncoder_IdnAddressEncoder());
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php
index 0713ff4e78..f64f5db59c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php
@@ -1,189 +1,227 @@
<?php
+use Egulias\EmailValidator\EmailValidator;
+
class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
{
/* -- RFC 2822, 3.6.2 for all tests.
*/
- private $_charset = 'utf-8';
+ private $charset = 'utf-8';
public function testTypeIsMailboxHeader()
{
- $header = $this->_getHeader('To', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('To');
$this->assertEquals(Swift_Mime_Header::TYPE_MAILBOX, $header->getFieldType());
}
public function testMailboxIsSetForAddress()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('From');
$header->setAddresses('chris@swiftmailer.org');
- $this->assertEquals(array('chris@swiftmailer.org'),
+ $this->assertEquals(['chris@swiftmailer.org'],
$header->getNameAddressStrings()
);
}
public function testMailboxIsRenderedForNameAddress()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn'));
+ $header = $this->getHeader('From');
+ $header->setNameAddresses(['chris@swiftmailer.org' => 'Chris Corbyn']);
$this->assertEquals(
- array('Chris Corbyn <chris@swiftmailer.org>'), $header->getNameAddressStrings()
+ ['Chris Corbyn <chris@swiftmailer.org>'], $header->getNameAddressStrings()
);
}
public function testAddressCanBeReturnedForAddress()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('From');
$header->setAddresses('chris@swiftmailer.org');
- $this->assertEquals(array('chris@swiftmailer.org'), $header->getAddresses());
+ $this->assertEquals(['chris@swiftmailer.org'], $header->getAddresses());
}
public function testAddressCanBeReturnedForNameAddress()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn'));
- $this->assertEquals(array('chris@swiftmailer.org'), $header->getAddresses());
+ $header = $this->getHeader('From');
+ $header->setNameAddresses(['chris@swiftmailer.org' => 'Chris Corbyn']);
+ $this->assertEquals(['chris@swiftmailer.org'], $header->getAddresses());
}
public function testQuotesInNameAreQuoted()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn, "DHE"',
- ));
+ ]);
$this->assertEquals(
- array('"Chris Corbyn, \"DHE\"" <chris@swiftmailer.org>'),
+ ['"Chris Corbyn, \"DHE\"" <chris@swiftmailer.org>'],
$header->getNameAddressStrings()
);
}
public function testEscapeCharsInNameAreQuoted()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn, \\escaped\\',
- ));
+ ]);
+ $this->assertEquals(
+ ['"Chris Corbyn, \\\\escaped\\\\" <chris@swiftmailer.org>'],
+ $header->getNameAddressStrings()
+ );
+ }
+
+ public function testUtf8CharsInDomainAreIdnEncoded()
+ {
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
+ 'chris@swïftmailer.org' => 'Chris Corbyn',
+ ]);
+ $this->assertEquals(
+ ['Chris Corbyn <chris@xn--swftmailer-78a.org>'],
+ $header->getNameAddressStrings()
+ );
+ }
+
+ /**
+ * @expectedException \Swift_AddressEncoderException
+ */
+ public function testUtf8CharsInLocalPartThrows()
+ {
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
+ 'chrïs@swiftmailer.org' => 'Chris Corbyn',
+ ]);
+ $header->getNameAddressStrings();
+ }
+
+ public function testUtf8CharsInEmail()
+ {
+ $header = $this->getHeader('From', null, new Swift_AddressEncoder_Utf8AddressEncoder());
+ $header->setNameAddresses([
+ 'chrïs@swïftmailer.org' => 'Chris Corbyn',
+ ]);
$this->assertEquals(
- array('"Chris Corbyn, \\\\escaped\\\\" <chris@swiftmailer.org>'),
+ ['Chris Corbyn <chrïs@swïftmailer.org>'],
$header->getNameAddressStrings()
);
}
public function testGetMailboxesReturnsNameValuePairs()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn, DHE',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org' => 'Chris Corbyn, DHE'), $header->getNameAddresses()
+ ['chris@swiftmailer.org' => 'Chris Corbyn, DHE'], $header->getNameAddresses()
);
}
public function testMultipleAddressesCanBeSetAndFetched()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setAddresses([
'chris@swiftmailer.org', 'mark@swiftmailer.org',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org'),
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org'],
$header->getAddresses()
);
}
public function testMultipleAddressesAsMailboxes()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setAddresses([
'chris@swiftmailer.org', 'mark@swiftmailer.org',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null),
+ ['chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null],
$header->getNameAddresses()
);
}
public function testMultipleAddressesAsMailboxStrings()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setAddresses([
'chris@swiftmailer.org', 'mark@swiftmailer.org',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org'),
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org'],
$header->getNameAddressStrings()
);
}
public function testMultipleNamedMailboxesReturnsMultipleAddresses()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org'),
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org'],
$header->getAddresses()
);
}
public function testMultipleNamedMailboxesReturnsMultipleMailboxes()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
- $this->assertEquals(array(
+ ]);
+ $this->assertEquals([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ),
+ ],
$header->getNameAddresses()
);
}
public function testMultipleMailboxesProducesMultipleMailboxStrings()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
- $this->assertEquals(array(
+ ]);
+ $this->assertEquals([
'Chris Corbyn <chris@swiftmailer.org>',
'Mark Corbyn <mark@swiftmailer.org>',
- ),
+ ],
$header->getNameAddressStrings()
);
}
public function testSetAddressesOverwritesAnyMailboxes()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$this->assertEquals(
- array('chris@swiftmailer.org' => 'Chris Corbyn',
- 'mark@swiftmailer.org' => 'Mark Corbyn', ),
+ ['chris@swiftmailer.org' => 'Chris Corbyn',
+ 'mark@swiftmailer.org' => 'Mark Corbyn', ],
$header->getNameAddresses()
);
$this->assertEquals(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org'),
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org'],
$header->getAddresses()
);
- $header->setAddresses(array('chris@swiftmailer.org', 'mark@swiftmailer.org'));
+ $header->setAddresses(['chris@swiftmailer.org', 'mark@swiftmailer.org']);
$this->assertEquals(
- array('chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null),
+ ['chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null],
$header->getNameAddresses()
);
$this->assertEquals(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org'),
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org'],
$header->getAddresses()
);
}
@@ -192,18 +230,18 @@ class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
{
$name = 'C'.pack('C', 0x8F).'rbyn';
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($name, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('C=8Frbyn');
- $header = $this->_getHeader('From', $encoder);
- $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris '.$name));
+ $header = $this->getHeader('From', $encoder);
+ $header->setNameAddresses(['chris@swiftmailer.org' => 'Chris '.$name]);
$addresses = $header->getNameAddressStrings();
$this->assertEquals(
- 'Chris =?'.$this->_charset.'?Q?C=8Frbyn?= <chris@swiftmailer.org>',
+ 'Chris =?'.$this->charset.'?Q?C=8Frbyn?= <chris@swiftmailer.org>',
array_shift($addresses)
);
}
@@ -217,24 +255,24 @@ class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
$name = 'C'.pack('C', 0x8F).'rbyn';
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($name, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('C=8Frbyn');
- $header = $this->_getHeader('From', $encoder);
- $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris '.$name));
+ $header = $this->getHeader('From', $encoder);
+ $header->setNameAddresses(['chris@swiftmailer.org' => 'Chris '.$name]);
$header->getNameAddressStrings();
}
public function testGetValueReturnsMailboxStringValue()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
- ));
+ ]);
$this->assertEquals(
'Chris Corbyn <chris@swiftmailer.org>', $header->getFieldBody()
);
@@ -242,11 +280,11 @@ class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
public function testGetValueReturnsMailboxStringValueForMultipleMailboxes()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$this->assertEquals(
'Chris Corbyn <chris@swiftmailer.org>, Mark Corbyn <mark@swiftmailer.org>',
$header->getFieldBody()
@@ -255,51 +293,51 @@ class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
public function testRemoveAddressesWithSingleValue()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$header->removeAddresses('chris@swiftmailer.org');
- $this->assertEquals(array('mark@swiftmailer.org'),
+ $this->assertEquals(['mark@swiftmailer.org'],
$header->getAddresses()
);
}
public function testRemoveAddressesWithList()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$header->removeAddresses(
- array('chris@swiftmailer.org', 'mark@swiftmailer.org')
+ ['chris@swiftmailer.org', 'mark@swiftmailer.org']
);
- $this->assertEquals(array(), $header->getAddresses());
+ $this->assertEquals([], $header->getAddresses());
}
public function testSetBodyModel()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('From');
$header->setFieldBodyModel('chris@swiftmailer.org');
- $this->assertEquals(array('chris@swiftmailer.org' => null), $header->getNameAddresses());
+ $this->assertEquals(['chris@swiftmailer.org' => null], $header->getNameAddresses());
}
public function testGetBodyModel()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setAddresses(array('chris@swiftmailer.org'));
- $this->assertEquals(array('chris@swiftmailer.org' => null), $header->getFieldBodyModel());
+ $header = $this->getHeader('From');
+ $header->setAddresses(['chris@swiftmailer.org']);
+ $this->assertEquals(['chris@swiftmailer.org' => null], $header->getFieldBodyModel());
}
public function testToString()
{
- $header = $this->_getHeader('From', $this->_getEncoder('Q', true));
- $header->setNameAddresses(array(
+ $header = $this->getHeader('From');
+ $header->setNameAddresses([
'chris@swiftmailer.org' => 'Chris Corbyn',
'mark@swiftmailer.org' => 'Mark Corbyn',
- ));
+ ]);
$this->assertEquals(
'From: Chris Corbyn <chris@swiftmailer.org>, '.
'Mark Corbyn <mark@swiftmailer.org>'."\r\n",
@@ -307,15 +345,17 @@ class Swift_Mime_Headers_MailboxHeaderTest extends \SwiftMailerTestCase
);
}
- private function _getHeader($name, $encoder)
+ private function getHeader($name, $encoder = null, $addressEncoder = null)
{
- $header = new Swift_Mime_Headers_MailboxHeader($name, $encoder, new Swift_Mime_Grammar());
- $header->setCharset($this->_charset);
+ $encoder = $encoder ?? $this->getEncoder('Q', true);
+ $addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
+ $header = new Swift_Mime_Headers_MailboxHeader($name, $encoder, new EmailValidator(), $addressEncoder);
+ $header->setCharset($this->charset);
return $header;
}
- private function _getEncoder($type, $stub = false)
+ private function getEncoder($type)
{
$encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();
$encoder->shouldReceive('getName')
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 cd027cc8dc..c90b05b420 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php
@@ -2,21 +2,21 @@
class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
{
- private $_charset = 'utf-8';
- private $_lang = 'en-us';
+ private $charset = 'utf-8';
+ private $lang = 'en-us';
public function testTypeIsParameterizedHeader()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$this->assertEquals(Swift_Mime_Header::TYPE_PARAMETERIZED, $header->getFieldType());
}
public function testValueIsReturnedVerbatim()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setValue('text/plain');
$this->assertEquals('text/plain', $header->getValue());
@@ -43,21 +43,21 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
; to use within parameter values
*/
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setValue('text/plain');
- $header->setParameters(array('charset' => 'utf-8'));
+ $header->setParameters(['charset' => 'utf-8']);
$this->assertEquals('text/plain; charset=utf-8', $header->getFieldBody());
}
public function testSpaceInParamResultsInQuotedString()
{
- $header = $this->_getHeader('Content-Disposition',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Disposition',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setValue('attachment');
- $header->setParameters(array('filename' => 'my file.txt'));
+ $header->setParameters(['filename' => 'my file.txt']);
$this->assertEquals('attachment; filename="my file.txt"',
$header->getFieldBody()
);
@@ -94,18 +94,18 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
$value = str_repeat('a', 180);
- $encoder = $this->_getParameterEncoder();
+ $encoder = $this->getParameterEncoder();
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), 63, \Mockery::any())
->andReturn(str_repeat('a', 63)."\r\n".
str_repeat('a', 63)."\r\n".str_repeat('a', 54));
- $header = $this->_getHeader('Content-Disposition',
- $this->_getHeaderEncoder('Q', true), $encoder
+ $header = $this->getHeader('Content-Disposition',
+ $this->getHeaderEncoder('Q', true), $encoder
);
$header->setValue('attachment');
- $header->setParameters(array('filename' => $value));
+ $header->setParameters(['filename' => $value]);
$header->setMaxLineLength(78);
$this->assertEquals(
'attachment; '.
@@ -143,21 +143,21 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
$value = str_repeat('a', 20).pack('C', 0x8F).str_repeat('a', 10);
- $encoder = $this->_getParameterEncoder();
+ $encoder = $this->getParameterEncoder();
$encoder->shouldReceive('encodeString')
->once()
->with($value, 12, 62, \Mockery::any())
->andReturn(str_repeat('a', 20).'%8F'.str_repeat('a', 10));
- $header = $this->_getHeader('Content-Disposition',
- $this->_getHeaderEncoder('Q', true), $encoder
+ $header = $this->getHeader('Content-Disposition',
+ $this->getHeaderEncoder('Q', true), $encoder
);
$header->setValue('attachment');
- $header->setParameters(array('filename' => $value));
+ $header->setParameters(['filename' => $value]);
$header->setMaxLineLength(78);
- $header->setLanguage($this->_lang);
+ $header->setLanguage($this->lang);
$this->assertEquals(
- 'attachment; filename*='.$this->_charset."'".$this->_lang."'".
+ 'attachment; filename*='.$this->charset."'".$this->lang."'".
str_repeat('a', 20).'%8F'.str_repeat('a', 10),
$header->getFieldBody()
);
@@ -196,22 +196,22 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
$value = str_repeat('a', 20).pack('C', 0x8F).str_repeat('a', 60);
- $encoder = $this->_getParameterEncoder();
+ $encoder = $this->getParameterEncoder();
$encoder->shouldReceive('encodeString')
->once()
->with($value, 12, 62, \Mockery::any())
->andReturn(str_repeat('a', 20).'%8F'.str_repeat('a', 28)."\r\n".
str_repeat('a', 32));
- $header = $this->_getHeader('Content-Disposition',
- $this->_getHeaderEncoder('Q', true), $encoder
+ $header = $this->getHeader('Content-Disposition',
+ $this->getHeaderEncoder('Q', true), $encoder
);
$header->setValue('attachment');
- $header->setParameters(array('filename' => $value));
+ $header->setParameters(['filename' => $value]);
$header->setMaxLineLength(78);
- $header->setLanguage($this->_lang);
+ $header->setLanguage($this->lang);
$this->assertEquals(
- 'attachment; filename*0*='.$this->_charset."'".$this->_lang."'".
+ 'attachment; filename*0*='.$this->charset."'".$this->lang."'".
str_repeat('a', 20).'%8F'.str_repeat('a', 28).";\r\n ".
'filename*1*='.str_repeat('a', 32),
$header->getFieldBody()
@@ -220,11 +220,11 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
public function testToString()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setValue('text/html');
- $header->setParameters(array('charset' => 'utf-8'));
+ $header->setParameters(['charset' => 'utf-8']);
$this->assertEquals('Content-Type: text/html; charset=utf-8'."\r\n",
$header->toString()
);
@@ -234,15 +234,15 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
{
$value = 'fo'.pack('C', 0x8F).'bar';
- $encoder = $this->_getHeaderEncoder('Q');
+ $encoder = $this->getHeaderEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo=8Fbar');
- $header = $this->_getHeader('X-Foo', $encoder, $this->_getParameterEncoder(true));
+ $header = $this->getHeader('X-Foo', $encoder, $this->getParameterEncoder(true));
$header->setValue($value);
- $header->setParameters(array('lookslike' => 'foobar'));
+ $header->setParameters(['lookslike' => 'foobar']);
$this->assertEquals('X-Foo: =?utf-8?Q?fo=8Fbar?=; lookslike=foobar'."\r\n",
$header->toString()
);
@@ -252,21 +252,21 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
{
$value = 'fo'.pack('C', 0x8F).'bar';
- $encoder = $this->_getHeaderEncoder('Q');
+ $encoder = $this->getHeaderEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo=8Fbar');
- $paramEncoder = $this->_getParameterEncoder();
+ $paramEncoder = $this->getParameterEncoder();
$paramEncoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo%8Fbar');
- $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder);
+ $header = $this->getHeader('X-Foo', $encoder, $paramEncoder);
$header->setValue($value);
- $header->setParameters(array('says' => $value));
+ $header->setParameters(['says' => $value]);
$this->assertEquals("X-Foo: =?utf-8?Q?fo=8Fbar?=; says*=utf-8''fo%8Fbar\r\n",
$header->toString()
);
@@ -276,15 +276,15 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
{
$value = 'fo'.pack('C', 0x8F).'bar';
- $encoder = $this->_getHeaderEncoder('Q');
+ $encoder = $this->getHeaderEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo=8Fbar');
- $header = $this->_getHeader('X-Foo', $encoder, null);
+ $header = $this->getHeader('X-Foo', $encoder, null);
$header->setValue('bar');
- $header->setParameters(array('says' => $value));
+ $header->setParameters(['says' => $value]);
$this->assertEquals("X-Foo: bar; says=\"=?utf-8?Q?fo=8Fbar?=\"\r\n",
$header->toString()
);
@@ -311,22 +311,22 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
$value = 'fo'.pack('C', 0x8F).'bar';
- $encoder = $this->_getHeaderEncoder('Q');
+ $encoder = $this->getHeaderEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo=8Fbar');
- $paramEncoder = $this->_getParameterEncoder();
+ $paramEncoder = $this->getParameterEncoder();
$paramEncoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo%8Fbar');
- $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder);
+ $header = $this->getHeader('X-Foo', $encoder, $paramEncoder);
$header->setLanguage('en');
$header->setValue($value);
- $header->setParameters(array('says' => $value));
+ $header->setParameters(['says' => $value]);
$this->assertEquals("X-Foo: =?utf-8*en?Q?fo=8Fbar?=; says*=utf-8'en'fo%8Fbar\r\n",
$header->toString()
);
@@ -334,8 +334,8 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
public function testSetBodyModel()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setFieldBodyModel('text/html');
$this->assertEquals('text/html', $header->getValue());
@@ -343,8 +343,8 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
public function testGetBodyModel()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
$header->setValue('text/plain');
$this->assertEquals('text/plain', $header->getFieldBodyModel());
@@ -352,36 +352,34 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
public function testSetParameter()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
- $header->setParameters(array('charset' => 'utf-8', 'delsp' => 'yes'));
+ $header->setParameters(['charset' => 'utf-8', 'delsp' => 'yes']);
$header->setParameter('delsp', 'no');
- $this->assertEquals(array('charset' => 'utf-8', 'delsp' => 'no'),
+ $this->assertEquals(['charset' => 'utf-8', 'delsp' => 'no'],
$header->getParameters()
);
}
public function testGetParameter()
{
- $header = $this->_getHeader('Content-Type',
- $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true)
+ $header = $this->getHeader('Content-Type',
+ $this->getHeaderEncoder('Q', true), $this->getParameterEncoder(true)
);
- $header->setParameters(array('charset' => 'utf-8', 'delsp' => 'yes'));
+ $header->setParameters(['charset' => 'utf-8', 'delsp' => 'yes']);
$this->assertEquals('utf-8', $header->getParameter('charset'));
}
- private function _getHeader($name, $encoder, $paramEncoder)
+ private function getHeader($name, $encoder, $paramEncoder)
{
- $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder,
- $paramEncoder, new Swift_Mime_Grammar()
- );
- $header->setCharset($this->_charset);
+ $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder, $paramEncoder);
+ $header->setCharset($this->charset);
return $header;
}
- private function _getHeaderEncoder($type, $stub = false)
+ private function getHeaderEncoder($type, $stub = false)
{
$encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();
$encoder->shouldReceive('getName')
@@ -391,7 +389,7 @@ class Swift_Mime_Headers_ParameterizedHeaderTest extends \SwiftMailerTestCase
return $encoder;
}
- private function _getParameterEncoder($stub = false)
+ private function getParameterEncoder($stub = false)
{
return $this->getMockery('Swift_Encoder')->shouldIgnoreMissing();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php
index a9f35e9de7..045107e59b 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php
@@ -1,28 +1,29 @@
<?php
-class Swift_Mime_Headers_PathHeaderTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_Headers_PathHeaderTest extends \PHPUnit\Framework\TestCase
{
public function testTypeIsPathHeader()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$this->assertEquals(Swift_Mime_Header::TYPE_PATH, $header->getFieldType());
}
public function testSingleAddressCanBeSetAndFetched()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setAddress('chris@swiftmailer.org');
$this->assertEquals('chris@swiftmailer.org', $header->getAddress());
}
+ /**
+ * @expectedException \Exception
+ */
public function testAddressMustComplyWithRfc2822()
{
- try {
- $header = $this->_getHeader('Return-Path');
- $header->setAddress('chr is@swiftmailer.org');
- $this->fail('Addresses not valid according to RFC 2822 addr-spec grammar must be rejected.');
- } catch (Exception $e) {
- }
+ $header = $this->getHeader('Return-Path');
+ $header->setAddress('chr is@swiftmailer.org');
}
public function testValueIsAngleAddrWithValidAddress()
@@ -35,43 +36,60 @@ class Swift_Mime_Headers_PathHeaderTest extends \PHPUnit_Framework_TestCase
obs-path
*/
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setAddress('chris@swiftmailer.org');
$this->assertEquals('<chris@swiftmailer.org>', $header->getFieldBody());
}
+ public function testAddressIsIdnEncoded()
+ {
+ $header = $this->getHeader('Return-Path');
+ $header->setAddress('chris@swïftmailer.org');
+ $this->assertEquals('<chris@xn--swftmailer-78a.org>', $header->getFieldBody());
+ }
+
+ /**
+ * @expectedException \Swift_AddressEncoderException
+ */
+ public function testAddressMustBeEncodable()
+ {
+ $header = $this->getHeader('Return-Path');
+ $header->setAddress('chrïs@swiftmailer.org');
+ $header->getFieldBody();
+ }
+
public function testValueIsEmptyAngleBracketsIfEmptyAddressSet()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setAddress('');
$this->assertEquals('<>', $header->getFieldBody());
}
public function testSetBodyModel()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setFieldBodyModel('foo@bar.tld');
$this->assertEquals('foo@bar.tld', $header->getAddress());
}
public function testGetBodyModel()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setAddress('foo@bar.tld');
$this->assertEquals('foo@bar.tld', $header->getFieldBodyModel());
}
public function testToString()
{
- $header = $this->_getHeader('Return-Path');
+ $header = $this->getHeader('Return-Path');
$header->setAddress('chris@swiftmailer.org');
$this->assertEquals('Return-Path: <chris@swiftmailer.org>'."\r\n",
$header->toString()
);
}
- private function _getHeader($name)
+ private function getHeader($name)
{
- return new Swift_Mime_Headers_PathHeader($name, new Swift_Mime_Grammar());
+ return new Swift_Mime_Headers_PathHeader($name, new EmailValidator(), new Swift_AddressEncoder_IdnAddressEncoder());
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php
index 2e1dc8cabc..30ccb00c15 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php
@@ -2,23 +2,23 @@
class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
{
- private $_charset = 'utf-8';
+ private $charset = 'utf-8';
public function testTypeIsTextHeader()
{
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$this->assertEquals(Swift_Mime_Header::TYPE_TEXT, $header->getFieldType());
}
public function testGetNameReturnsNameVerbatim()
{
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$this->assertEquals('Subject', $header->getFieldName());
}
public function testGetValueReturnsValueVerbatim()
{
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$header->setValue('Test');
$this->assertEquals('Test', $header->getValue());
}
@@ -29,7 +29,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
Header fields are lines composed of a field name, followed by a colon
(":"), followed by a field body, and terminated by CRLF.
*/
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$header->setValue('Test');
$this->assertEquals('Subject: Test'."\r\n", $header->toString());
}
@@ -48,8 +48,8 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
$value = 'The quick brown fox jumped over the fence, he was a very very '.
'scary brown fox with a bushy tail';
- $header = $this->_getHeader('X-Custom-Header',
- $this->_getEncoder('Q', true)
+ $header = $this->getHeader('X-Custom-Header',
+ $this->getEncoder('Q', true)
);
$header->setValue($value);
$header->setMaxLineLength(78); //A safe [RFC 2822, 2.2.3] default
@@ -75,7 +75,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
*/
$nonAsciiChar = pack('C', 0x8F);
- $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('X-Test', $this->getEncoder('Q', true));
$header->setValue($nonAsciiChar);
$this->assertRegExp(
'~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+\r\n$~s',
@@ -92,7 +92,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
*/
$nonAsciiChar = pack('C', 0x8F);
- $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('X-Test', $this->getEncoder('Q', true));
$header->setValue($nonAsciiChar);
$this->assertRegExp(
'~^X-Test: \=?.*?\?.*?\?.*?\?=\r\n$~s',
@@ -112,16 +112,16 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
$nonAsciiChar = pack('C', 0x8F);
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($nonAsciiChar, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('=8F');
- $header = $this->_getHeader('X-Test', $encoder);
+ $header = $this->getHeader('X-Test', $encoder);
$header->setValue($nonAsciiChar);
$this->assertEquals(
- 'X-Test: =?'.$this->_charset.'?Q?=8F?='."\r\n",
+ 'X-Test: =?'.$this->charset.'?Q?=8F?='."\r\n",
$header->toString()
);
}
@@ -130,24 +130,24 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
{
//SPACE and TAB permitted
$nonPrintableBytes = array_merge(
- range(0x00, 0x08), range(0x10, 0x19), array(0x7F)
+ range(0x00, 0x08), range(0x10, 0x19), [0x7F]
);
foreach ($nonPrintableBytes as $byte) {
$char = pack('C', $byte);
$encodedChar = sprintf('=%02X', $byte);
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($char, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn($encodedChar);
- $header = $this->_getHeader('X-A', $encoder);
+ $header = $this->getHeader('X-A', $encoder);
$header->setValue($char);
$this->assertEquals(
- 'X-A: =?'.$this->_charset.'?Q?'.$encodedChar.'?='."\r\n",
+ 'X-A: =?'.$this->charset.'?Q?'.$encodedChar.'?='."\r\n",
$header->toString(), '%s: Non-printable ascii should be encoded'
);
}
@@ -155,23 +155,21 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
public function testEncodedWordsAreUsedToEncode8BitOctets()
{
- $_8BitBytes = range(0x80, 0xFF);
-
- foreach ($_8BitBytes as $byte) {
+ foreach (range(0x80, 0xFF) as $byte) {
$char = pack('C', $byte);
$encodedChar = sprintf('=%02X', $byte);
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($char, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn($encodedChar);
- $header = $this->_getHeader('X-A', $encoder);
+ $header = $this->getHeader('X-A', $encoder);
$header->setValue($char);
$this->assertEquals(
- 'X-A: =?'.$this->_charset.'?Q?'.$encodedChar.'?='."\r\n",
+ 'X-A: =?'.$this->charset.'?Q?'.$encodedChar.'?='."\r\n",
$header->toString(), '%s: 8-bit octets should be encoded'
);
}
@@ -192,7 +190,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
$nonAsciiChar = pack('C', 0x8F);
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($nonAsciiChar, \Mockery::any(), \Mockery::any(), \Mockery::any())
@@ -201,11 +199,11 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
//Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63
//* X-Test: is 8 chars
- $header = $this->_getHeader('X-Test', $encoder);
+ $header = $this->getHeader('X-Test', $encoder);
$header->setValue($nonAsciiChar);
$this->assertEquals(
- 'X-Test: =?'.$this->_charset.'?Q?=8F?='."\r\n",
+ 'X-Test: =?'.$this->charset.'?Q?=8F?='."\r\n",
$header->toString()
);
}
@@ -222,7 +220,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
// encoding for the sake of testing
$nonAsciiChar = pack('C', 0x8F);
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($nonAsciiChar, 8, 63, \Mockery::any())
@@ -232,12 +230,12 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
//Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63
//* X-Test: is 8 chars
- $header = $this->_getHeader('X-Test', $encoder);
+ $header = $this->getHeader('X-Test', $encoder);
$header->setValue($nonAsciiChar);
$this->assertEquals(
- 'X-Test: =?'.$this->_charset.'?Q?line_one_here?='."\r\n".
- ' =?'.$this->_charset.'?Q?line_two_here?='."\r\n",
+ 'X-Test: =?'.$this->charset.'?Q?line_one_here?='."\r\n".
+ ' =?'.$this->charset.'?Q?line_two_here?='."\r\n",
$header->toString()
);
}
@@ -264,7 +262,7 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
$text = 'start '.$word.' '.$word.' then end '.$word;
// 'start', ' word word', ' and end', ' word'
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($word.' '.$word, \Mockery::any(), \Mockery::any(), \Mockery::any())
@@ -274,13 +272,13 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
->with($word, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('w=8Frd');
- $header = $this->_getHeader('X-Test', $encoder);
+ $header = $this->getHeader('X-Test', $encoder);
$header->setValue($text);
$headerString = $header->toString();
- $this->assertEquals('X-Test: start =?'.$this->_charset.'?Q?'.
- 'w=8Frd_w=8Frd?= then end =?'.$this->_charset.'?Q?'.
+ $this->assertEquals('X-Test: start =?'.$this->charset.'?Q?'.
+ 'w=8Frd_w=8Frd?= then end =?'.$this->charset.'?Q?'.
'w=8Frd?='."\r\n", $headerString,
'%s: Adjacent encoded words should appear grouped with WSP encoded'
);
@@ -307,13 +305,13 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
$value = 'fo'.pack('C', 0x8F).'bar';
- $encoder = $this->_getEncoder('Q');
+ $encoder = $this->getEncoder('Q');
$encoder->shouldReceive('encodeString')
->once()
->with($value, \Mockery::any(), \Mockery::any(), \Mockery::any())
->andReturn('fo=8Fbar');
- $header = $this->_getHeader('Subject', $encoder);
+ $header = $this->getHeader('Subject', $encoder);
$header->setLanguage('en');
$header->setValue($value);
$this->assertEquals("Subject: =?utf-8*en?Q?fo=8Fbar?=\r\n",
@@ -323,27 +321,27 @@ class Swift_Mime_Headers_UnstructuredHeaderTest extends \SwiftMailerTestCase
public function testSetBodyModel()
{
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$header->setFieldBodyModel('test');
$this->assertEquals('test', $header->getValue());
}
public function testGetBodyModel()
{
- $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true));
+ $header = $this->getHeader('Subject', $this->getEncoder('Q', true));
$header->setValue('test');
$this->assertEquals('test', $header->getFieldBodyModel());
}
- private function _getHeader($name, $encoder)
+ private function getHeader($name, $encoder)
{
- $header = new Swift_Mime_Headers_UnstructuredHeader($name, $encoder, new Swift_Mime_Grammar());
- $header->setCharset($this->_charset);
+ $header = new Swift_Mime_Headers_UnstructuredHeader($name, $encoder);
+ $header->setCharset($this->charset);
return $header;
}
- private function _getEncoder($type, $stub = false)
+ private function getEncoder($type, $stub = false)
{
$encoder = $this->getMockery('Swift_Mime_HeaderEncoder')->shouldIgnoreMissing();
$encoder->shouldReceive('getName')
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/IdGeneratorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/IdGeneratorTest.php
new file mode 100644
index 0000000000..e0571a3024
--- /dev/null
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/IdGeneratorTest.php
@@ -0,0 +1,32 @@
+<?php
+
+use Egulias\EmailValidator\EmailValidator;
+use Egulias\EmailValidator\Validation\RFCValidation;
+
+class Swift_Mime_IdGeneratorTest extends \PHPUnit\Framework\TestCase
+{
+ protected $emailValidator;
+ protected $originalServerName;
+
+ public function testIdGeneratorSetRightId()
+ {
+ $idGenerator = new Swift_Mime_IdGenerator('example.net');
+ $this->assertEquals('example.net', $idGenerator->getIdRight());
+
+ $idGenerator->setIdRight('example.com');
+ $this->assertEquals('example.com', $idGenerator->getIdRight());
+ }
+
+ public function testIdGenerateId()
+ {
+ $idGenerator = new Swift_Mime_IdGenerator('example.net');
+ $emailValidator = new EmailValidator();
+
+ $id = $idGenerator->generateId();
+ $this->assertTrue($emailValidator->isValid($id, new RFCValidation()));
+ $this->assertEquals(1, preg_match('/^.{32}@example.net$/', $id));
+
+ $anotherId = $idGenerator->generateId();
+ $this->assertNotEquals($id, $anotherId);
+ }
+}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php
index 738ac68562..4575505fac 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php
@@ -1,14 +1,15 @@
<?php
+
class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest
{
public function testNestingLevelIsSubpart()
{
- $part = $this->_createMimePart($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(
- Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, $part->getNestingLevel()
+ Swift_Mime_SimpleMimeEntity::LEVEL_ALTERNATIVE, $part->getNestingLevel()
);
}
@@ -26,108 +27,108 @@ class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest
must be assumed in the absence of a charset parameter, is US-ASCII.
*/
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('charset' => 'iso-8859-1')
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['charset' => 'iso-8859-1']
);
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('iso-8859-1', $part->getCharset());
}
public function testCharsetIsSetInHeader()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('charset' => 'iso-8859-1'), false
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['charset' => 'iso-8859-1'], false
);
$cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$part->setCharset('utf-8');
}
public function testCharsetIsSetInHeaderIfPassedToSetBody()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('charset' => 'iso-8859-1'), false
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['charset' => 'iso-8859-1'], false
);
$cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$part->setBody('', 'text/plian', 'utf-8');
}
public function testSettingCharsetNotifiesEncoder()
{
- $encoder = $this->_createEncoder('quoted-printable', false);
+ $encoder = $this->createEncoder('quoted-printable', false);
$encoder->expects($this->once())
->method('charsetChanged')
->with('utf-8');
- $part = $this->_createMimePart($this->_createHeaderSet(),
- $encoder, $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet(),
+ $encoder, $this->createCache()
);
$part->setCharset('utf-8');
}
public function testSettingCharsetNotifiesHeaders()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('charsetChanged')
->zeroOrMoreTimes()
->with('utf-8');
- $part = $this->_createMimePart($headers, $this->_createEncoder(),
- $this->_createCache()
+ $part = $this->createMimePart($headers, $this->createEncoder(),
+ $this->createCache()
);
$part->setCharset('utf-8');
}
public function testSettingCharsetNotifiesChildren()
{
- $child = $this->_createChild(0, '', false);
+ $child = $this->createChild(0, '', false);
$child->shouldReceive('charsetChanged')
->once()
->with('windows-874');
- $part = $this->_createMimePart($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
- $part->setChildren(array($child));
+ $part->setChildren([$child]);
$part->setCharset('windows-874');
}
public function testCharsetChangeUpdatesCharset()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('charset' => 'iso-8859-1'), false
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['charset' => 'iso-8859-1'], false
);
$cType->shouldReceive('setParameter')->once()->with('charset', 'utf-8');
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$part->charsetChanged('utf-8');
}
public function testSettingCharsetClearsCache()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('toString')
->zeroOrMoreTimes()
->andReturn("Content-Type: text/plain; charset=utf-8\r\n");
- $cache = $this->_createCache(false);
+ $cache = $this->createCache(false);
- $entity = $this->_createEntity($headers, $this->_createEncoder(),
+ $entity = $this->createEntity($headers, $this->createEncoder(),
$cache
);
@@ -147,24 +148,24 @@ class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest
/* -- RFC 3676.
*/
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('format' => 'flowed')
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['format' => 'flowed']
);
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('flowed', $part->getFormat());
}
public function testFormatIsSetInHeader()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);
+ $cType = $this->createHeader('Content-Type', 'text/plain', [], false);
$cType->shouldReceive('setParameter')->once()->with('format', 'fixed');
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$part->setFormat('fixed');
}
@@ -174,44 +175,44 @@ class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest
/* -- RFC 3676.
*/
- $cType = $this->_createHeader('Content-Type', 'text/plain',
- array('delsp' => 'no')
+ $cType = $this->createHeader('Content-Type', 'text/plain',
+ ['delsp' => 'no']
);
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertFalse($part->getDelSp());
}
public function testDelSpIsSetInHeader()
{
- $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false);
+ $cType = $this->createHeader('Content-Type', 'text/plain', [], false);
$cType->shouldReceive('setParameter')->once()->with('delsp', 'yes');
- $part = $this->_createMimePart($this->_createHeaderSet(array(
- 'Content-Type' => $cType, )),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet([
+ 'Content-Type' => $cType, ]),
+ $this->createEncoder(), $this->createCache()
);
$part->setDelSp(true);
}
public function testFluidInterface()
{
- $part = $this->_createMimePart($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $part = $this->createMimePart($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertSame($part,
$part
->setContentType('text/plain')
- ->setEncoder($this->_createEncoder())
+ ->setEncoder($this->createEncoder())
->setId('foo@bar')
->setDescription('my description')
->setMaxLineLength(998)
->setBody('xx')
->setBoundary('xyz')
- ->setChildren(array())
+ ->setChildren([])
->setCharset('utf-8')
->setFormat('flowed')
->setDelSp(true)
@@ -219,13 +220,15 @@ class Swift_Mime_MimePartTest extends Swift_Mime_AbstractMimeEntityTest
}
//abstract
- protected function _createEntity($headers, $encoder, $cache)
+ protected function createEntity($headers, $encoder, $cache)
{
- return $this->_createMimePart($headers, $encoder, $cache);
+ return $this->createMimePart($headers, $encoder, $cache);
}
- protected function _createMimePart($headers, $encoder, $cache)
+ protected function createMimePart($headers, $encoder, $cache)
{
- return new Swift_Mime_MimePart($headers, $encoder, $cache, new Swift_Mime_Grammar());
+ $idGenerator = new Swift_Mime_IdGenerator('example.com');
+
+ return new Swift_Mime_MimePart($headers, $encoder, $cache, $idGenerator);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
index 6a87abfa2c..6bc825efa9 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
@@ -1,165 +1,168 @@
<?php
-class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit_Framework_TestCase
+use Egulias\EmailValidator\EmailValidator;
+
+class Swift_Mime_SimpleHeaderFactoryTest extends \PHPUnit\Framework\TestCase
{
- private $_factory;
+ private $factory;
protected function setUp()
{
- $this->_factory = $this->_createFactory();
+ $this->factory = $this->createFactory();
}
public function testMailboxHeaderIsCorrectType()
{
- $header = $this->_factory->createMailboxHeader('X-Foo');
+ $header = $this->factory->createMailboxHeader('X-Foo');
$this->assertInstanceOf('Swift_Mime_Headers_MailboxHeader', $header);
}
public function testMailboxHeaderHasCorrectName()
{
- $header = $this->_factory->createMailboxHeader('X-Foo');
+ $header = $this->factory->createMailboxHeader('X-Foo');
$this->assertEquals('X-Foo', $header->getFieldName());
}
public function testMailboxHeaderHasCorrectModel()
{
- $header = $this->_factory->createMailboxHeader('X-Foo',
- array('foo@bar' => 'FooBar')
+ $header = $this->factory->createMailboxHeader('X-Foo',
+ ['foo@bar' => 'FooBar']
);
- $this->assertEquals(array('foo@bar' => 'FooBar'), $header->getFieldBodyModel());
+ $this->assertEquals(['foo@bar' => 'FooBar'], $header->getFieldBodyModel());
}
public function testDateHeaderHasCorrectType()
{
- $header = $this->_factory->createDateHeader('X-Date');
+ $header = $this->factory->createDateHeader('X-Date');
$this->assertInstanceOf('Swift_Mime_Headers_DateHeader', $header);
}
public function testDateHeaderHasCorrectName()
{
- $header = $this->_factory->createDateHeader('X-Date');
+ $header = $this->factory->createDateHeader('X-Date');
$this->assertEquals('X-Date', $header->getFieldName());
}
public function testDateHeaderHasCorrectModel()
{
- $header = $this->_factory->createDateHeader('X-Date', 123);
- $this->assertEquals(123, $header->getFieldBodyModel());
+ $dateTime = new \DateTimeImmutable();
+ $header = $this->factory->createDateHeader('X-Date', $dateTime);
+ $this->assertEquals($dateTime, $header->getFieldBodyModel());
}
public function testTextHeaderHasCorrectType()
{
- $header = $this->_factory->createTextHeader('X-Foo');
+ $header = $this->factory->createTextHeader('X-Foo');
$this->assertInstanceOf('Swift_Mime_Headers_UnstructuredHeader', $header);
}
public function testTextHeaderHasCorrectName()
{
- $header = $this->_factory->createTextHeader('X-Foo');
+ $header = $this->factory->createTextHeader('X-Foo');
$this->assertEquals('X-Foo', $header->getFieldName());
}
public function testTextHeaderHasCorrectModel()
{
- $header = $this->_factory->createTextHeader('X-Foo', 'bar');
+ $header = $this->factory->createTextHeader('X-Foo', 'bar');
$this->assertEquals('bar', $header->getFieldBodyModel());
}
public function testParameterizedHeaderHasCorrectType()
{
- $header = $this->_factory->createParameterizedHeader('X-Foo');
+ $header = $this->factory->createParameterizedHeader('X-Foo');
$this->assertInstanceOf('Swift_Mime_Headers_ParameterizedHeader', $header);
}
public function testParameterizedHeaderHasCorrectName()
{
- $header = $this->_factory->createParameterizedHeader('X-Foo');
+ $header = $this->factory->createParameterizedHeader('X-Foo');
$this->assertEquals('X-Foo', $header->getFieldName());
}
public function testParameterizedHeaderHasCorrectModel()
{
- $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar');
+ $header = $this->factory->createParameterizedHeader('X-Foo', 'bar');
$this->assertEquals('bar', $header->getFieldBodyModel());
}
public function testParameterizedHeaderHasCorrectParams()
{
- $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar',
- array('zip' => 'button')
+ $header = $this->factory->createParameterizedHeader('X-Foo', 'bar',
+ ['zip' => 'button']
);
- $this->assertEquals(array('zip' => 'button'), $header->getParameters());
+ $this->assertEquals(['zip' => 'button'], $header->getParameters());
}
public function testIdHeaderHasCorrectType()
{
- $header = $this->_factory->createIdHeader('X-ID');
+ $header = $this->factory->createIdHeader('X-ID');
$this->assertInstanceOf('Swift_Mime_Headers_IdentificationHeader', $header);
}
public function testIdHeaderHasCorrectName()
{
- $header = $this->_factory->createIdHeader('X-ID');
+ $header = $this->factory->createIdHeader('X-ID');
$this->assertEquals('X-ID', $header->getFieldName());
}
public function testIdHeaderHasCorrectModel()
{
- $header = $this->_factory->createIdHeader('X-ID', 'xyz@abc');
- $this->assertEquals(array('xyz@abc'), $header->getFieldBodyModel());
+ $header = $this->factory->createIdHeader('X-ID', 'xyz@abc');
+ $this->assertEquals(['xyz@abc'], $header->getFieldBodyModel());
}
public function testPathHeaderHasCorrectType()
{
- $header = $this->_factory->createPathHeader('X-Path');
+ $header = $this->factory->createPathHeader('X-Path');
$this->assertInstanceOf('Swift_Mime_Headers_PathHeader', $header);
}
public function testPathHeaderHasCorrectName()
{
- $header = $this->_factory->createPathHeader('X-Path');
+ $header = $this->factory->createPathHeader('X-Path');
$this->assertEquals('X-Path', $header->getFieldName());
}
public function testPathHeaderHasCorrectModel()
{
- $header = $this->_factory->createPathHeader('X-Path', 'foo@bar');
+ $header = $this->factory->createPathHeader('X-Path', 'foo@bar');
$this->assertEquals('foo@bar', $header->getFieldBodyModel());
}
public function testCharsetChangeNotificationNotifiesEncoders()
{
- $encoder = $this->_createHeaderEncoder();
+ $encoder = $this->createHeaderEncoder();
$encoder->expects($this->once())
->method('charsetChanged')
->with('utf-8');
- $paramEncoder = $this->_createParamEncoder();
+ $paramEncoder = $this->createParamEncoder();
$paramEncoder->expects($this->once())
->method('charsetChanged')
->with('utf-8');
- $factory = $this->_createFactory($encoder, $paramEncoder);
+ $factory = $this->createFactory($encoder, $paramEncoder);
$factory->charsetChanged('utf-8');
}
- private function _createFactory($encoder = null, $paramEncoder = null)
+ private function createFactory($encoder = null, $paramEncoder = null)
{
return new Swift_Mime_SimpleHeaderFactory(
$encoder
- ? $encoder : $this->_createHeaderEncoder(),
+ ? $encoder : $this->createHeaderEncoder(),
$paramEncoder
- ? $paramEncoder : $this->_createParamEncoder(),
- new Swift_Mime_Grammar()
+ ? $paramEncoder : $this->createParamEncoder(),
+ new EmailValidator()
);
}
- private function _createHeaderEncoder()
+ private function createHeaderEncoder()
{
return $this->getMockBuilder('Swift_Mime_HeaderEncoder')->getMock();
}
- private function _createParamEncoder()
+ private function createParamEncoder()
{
return $this->getMockBuilder('Swift_Encoder')->getMock();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
index bed1c13743..4ddbff74c4 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php
@@ -1,215 +1,219 @@
<?php
-class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
+class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit\Framework\TestCase
{
public function testAddMailboxHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createMailboxHeader')
- ->with('From', array('person@domain' => 'Person'))
- ->will($this->returnValue($this->_createHeader('From')));
+ ->with('From', ['person@domain' => 'Person'])
+ ->will($this->returnValue($this->createHeader('From')));
- $set = $this->_createSet($factory);
- $set->addMailboxHeader('From', array('person@domain' => 'Person'));
+ $set = $this->createSet($factory);
+ $set->addMailboxHeader('From', ['person@domain' => 'Person']);
}
public function testAddDateHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $dateTime = new DateTimeImmutable();
+
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createDateHeader')
- ->with('Date', 1234)
- ->will($this->returnValue($this->_createHeader('Date')));
+ ->with('Date', $dateTime)
+ ->will($this->returnValue($this->createHeader('Date')));
- $set = $this->_createSet($factory);
- $set->addDateHeader('Date', 1234);
+ $set = $this->createSet($factory);
+ $set->addDateHeader('Date', $dateTime);
}
public function testAddTextHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createTextHeader')
->with('Subject', 'some text')
- ->will($this->returnValue($this->_createHeader('Subject')));
+ ->will($this->returnValue($this->createHeader('Subject')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Subject', 'some text');
}
public function testAddParameterizedHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createParameterizedHeader')
- ->with('Content-Type', 'text/plain', array('charset' => 'utf-8'))
- ->will($this->returnValue($this->_createHeader('Content-Type')));
+ ->with('Content-Type', 'text/plain', ['charset' => 'utf-8'])
+ ->will($this->returnValue($this->createHeader('Content-Type')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addParameterizedHeader('Content-Type', 'text/plain',
- array('charset' => 'utf-8')
+ ['charset' => 'utf-8']
);
}
public function testAddIdHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createIdHeader')
->with('Message-ID', 'some@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
}
public function testAddPathHeaderDelegatesToFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createPathHeader')
->with('Return-Path', 'some@path')
- ->will($this->returnValue($this->_createHeader('Return-Path')));
+ ->will($this->returnValue($this->createHeader('Return-Path')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addPathHeader('Return-Path', 'some@path');
}
public function testHasReturnsFalseWhenNoHeaders()
{
- $set = $this->_createSet($this->_createFactory());
+ $set = $this->createSet($this->createFactory());
$this->assertFalse($set->has('Some-Header'));
}
public function testAddedMailboxHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createMailboxHeader')
- ->with('From', array('person@domain' => 'Person'))
- ->will($this->returnValue($this->_createHeader('From')));
+ ->with('From', ['person@domain' => 'Person'])
+ ->will($this->returnValue($this->createHeader('From')));
- $set = $this->_createSet($factory);
- $set->addMailboxHeader('From', array('person@domain' => 'Person'));
+ $set = $this->createSet($factory);
+ $set->addMailboxHeader('From', ['person@domain' => 'Person']);
$this->assertTrue($set->has('From'));
}
public function testAddedDateHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $dateTime = new DateTimeImmutable();
+
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createDateHeader')
- ->with('Date', 1234)
- ->will($this->returnValue($this->_createHeader('Date')));
+ ->with('Date', $dateTime)
+ ->will($this->returnValue($this->createHeader('Date')));
- $set = $this->_createSet($factory);
- $set->addDateHeader('Date', 1234);
+ $set = $this->createSet($factory);
+ $set->addDateHeader('Date', $dateTime);
$this->assertTrue($set->has('Date'));
}
public function testAddedTextHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createTextHeader')
->with('Subject', 'some text')
- ->will($this->returnValue($this->_createHeader('Subject')));
+ ->will($this->returnValue($this->createHeader('Subject')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Subject', 'some text');
$this->assertTrue($set->has('Subject'));
}
public function testAddedParameterizedHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createParameterizedHeader')
- ->with('Content-Type', 'text/plain', array('charset' => 'utf-8'))
- ->will($this->returnValue($this->_createHeader('Content-Type')));
+ ->with('Content-Type', 'text/plain', ['charset' => 'utf-8'])
+ ->will($this->returnValue($this->createHeader('Content-Type')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addParameterizedHeader('Content-Type', 'text/plain',
- array('charset' => 'utf-8')
+ ['charset' => 'utf-8']
);
$this->assertTrue($set->has('Content-Type'));
}
public function testAddedIdHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createIdHeader')
->with('Message-ID', 'some@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertTrue($set->has('Message-ID'));
}
public function testAddedPathHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createPathHeader')
->with('Return-Path', 'some@path')
- ->will($this->returnValue($this->_createHeader('Return-Path')));
+ ->will($this->returnValue($this->createHeader('Return-Path')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addPathHeader('Return-Path', 'some@path');
$this->assertTrue($set->has('Return-Path'));
}
public function testNewlySetHeaderIsSeenByHas()
{
- $factory = $this->_createFactory();
- $header = $this->_createHeader('X-Foo', 'bar');
- $set = $this->_createSet($factory);
+ $factory = $this->createFactory();
+ $header = $this->createHeader('X-Foo', 'bar');
+ $set = $this->createSet($factory);
$set->set($header);
$this->assertTrue($set->has('X-Foo'));
}
public function testHasCanAcceptOffset()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createIdHeader')
->with('Message-ID', 'some@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertTrue($set->has('Message-ID', 0));
}
public function testHasWithIllegalOffsetReturnsFalse()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createIdHeader')
->with('Message-ID', 'some@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertFalse($set->has('Message-ID', 1));
}
public function testHasCanDistinguishMultipleHeaders()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
$factory->expects($this->at(1))
->method('createIdHeader')
->with('Message-ID', 'other@id')
- ->will($this->returnValue($this->_createHeader('Message-ID')));
+ ->will($this->returnValue($this->createHeader('Message-ID')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$this->assertTrue($set->has('Message-ID', 1));
@@ -217,24 +221,24 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testGetWithUnspecifiedOffset()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertSame($header, $set->get('Message-ID'));
}
public function testGetWithSpeiciedOffset()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Message-ID');
- $header2 = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Message-ID');
+ $header2 = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -248,7 +252,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('Message-ID', 'more@id')
->will($this->returnValue($header2));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$set->addIdHeader('Message-ID', 'more@id');
@@ -257,16 +261,16 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testGetReturnsNullIfHeaderNotSet()
{
- $set = $this->_createSet($this->_createFactory());
+ $set = $this->createSet($this->createFactory());
$this->assertNull($set->get('Message-ID', 99));
}
public function testGetAllReturnsAllHeadersMatchingName()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Message-ID');
- $header2 = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Message-ID');
+ $header2 = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -280,22 +284,22 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('Message-ID', 'more@id')
->will($this->returnValue($header2));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$set->addIdHeader('Message-ID', 'more@id');
- $this->assertEquals(array($header0, $header1, $header2),
+ $this->assertEquals([$header0, $header1, $header2],
$set->getAll('Message-ID')
);
}
public function testGetAllReturnsAllHeadersIfNoArguments()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Subject');
- $header2 = $this->_createHeader('To');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Subject');
+ $header2 = $this->createHeader('To');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -309,32 +313,32 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('To', 'person@example.org')
->will($this->returnValue($header2));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Subject', 'thing');
$set->addIdHeader('To', 'person@example.org');
- $this->assertEquals(array($header0, $header1, $header2),
+ $this->assertEquals([$header0, $header1, $header2],
$set->getAll()
);
}
public function testGetAllReturnsEmptyArrayIfNoneSet()
{
- $set = $this->_createSet($this->_createFactory());
- $this->assertEquals(array(), $set->getAll('Received'));
+ $set = $this->createSet($this->createFactory());
+ $this->assertEquals([], $set->getAll('Received'));
}
public function testRemoveWithUnspecifiedOffset()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->remove('Message-ID');
$this->assertFalse($set->has('Message-ID'));
@@ -342,9 +346,9 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testRemoveWithSpecifiedIndexRemovesHeader()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -354,7 +358,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('Message-ID', 'other@id')
->will($this->returnValue($header1));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$set->remove('Message-ID', 0);
@@ -368,9 +372,9 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testRemoveWithSpecifiedIndexLeavesOtherHeaders()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -380,7 +384,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('Message-ID', 'other@id')
->will($this->returnValue($header1));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$set->remove('Message-ID', 1);
@@ -389,14 +393,14 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testRemoveWithInvalidOffsetDoesNothing()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->remove('Message-ID', 50);
$this->assertTrue($set->has('Message-ID'));
@@ -404,9 +408,9 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testRemoveAllRemovesAllHeadersWithName()
{
- $header0 = $this->_createHeader('Message-ID');
- $header1 = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header0 = $this->createHeader('Message-ID');
+ $header1 = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
@@ -416,7 +420,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->with('Message-ID', 'other@id')
->will($this->returnValue($header1));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->addIdHeader('Message-ID', 'other@id');
$set->removeAll('Message-ID');
@@ -426,56 +430,56 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testHasIsNotCaseSensitive()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertTrue($set->has('message-id'));
}
public function testGetIsNotCaseSensitive()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$this->assertSame($header, $set->get('message-id'));
}
public function testGetAllIsNotCaseSensitive()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
- $this->assertEquals(array($header), $set->getAll('message-id'));
+ $this->assertEquals([$header], $set->getAll('message-id'));
}
public function testRemoveIsNotCaseSensitive()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->remove('message-id');
$this->assertFalse($set->has('Message-ID'));
@@ -483,39 +487,32 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testRemoveAllIsNotCaseSensitive()
{
- $header = $this->_createHeader('Message-ID');
- $factory = $this->_createFactory();
+ $header = $this->createHeader('Message-ID');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createIdHeader')
->with('Message-ID', 'some@id')
->will($this->returnValue($header));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addIdHeader('Message-ID', 'some@id');
$set->removeAll('message-id');
$this->assertFalse($set->has('Message-ID'));
}
- public function testNewInstance()
- {
- $set = $this->_createSet($this->_createFactory());
- $instance = $set->newInstance();
- $this->assertInstanceOf('Swift_Mime_HeaderSet', $instance);
- }
-
public function testToStringJoinsHeadersTogether()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Foo', 'bar')
- ->will($this->returnValue($this->_createHeader('Foo', 'bar')));
+ ->will($this->returnValue($this->createHeader('Foo', 'bar')));
$factory->expects($this->at(1))
->method('createTextHeader')
->with('Zip', 'buttons')
- ->will($this->returnValue($this->_createHeader('Zip', 'buttons')));
+ ->will($this->returnValue($this->createHeader('Zip', 'buttons')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Foo', 'bar');
$set->addTextHeader('Zip', 'buttons');
$this->assertEquals(
@@ -527,17 +524,17 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testHeadersWithoutBodiesAreNotDisplayed()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Foo', 'bar')
- ->will($this->returnValue($this->_createHeader('Foo', 'bar')));
+ ->will($this->returnValue($this->createHeader('Foo', 'bar')));
$factory->expects($this->at(1))
->method('createTextHeader')
->with('Zip', '')
- ->will($this->returnValue($this->_createHeader('Zip', '')));
+ ->will($this->returnValue($this->createHeader('Zip', '')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Foo', 'bar');
$set->addTextHeader('Zip', '');
$this->assertEquals(
@@ -548,20 +545,20 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testHeadersWithoutBodiesCanBeForcedToDisplay()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Foo', '')
- ->will($this->returnValue($this->_createHeader('Foo', '')));
+ ->will($this->returnValue($this->createHeader('Foo', '')));
$factory->expects($this->at(1))
->method('createTextHeader')
->with('Zip', '')
- ->will($this->returnValue($this->_createHeader('Zip', '')));
+ ->will($this->returnValue($this->createHeader('Zip', '')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Foo', '');
$set->addTextHeader('Zip', '');
- $set->setAlwaysDisplayed(array('Foo', 'Zip'));
+ $set->setAlwaysDisplayed(['Foo', 'Zip']);
$this->assertEquals(
"Foo: \r\n".
"Zip: \r\n",
@@ -571,26 +568,26 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testHeaderSequencesCanBeSpecified()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Third', 'three')
- ->will($this->returnValue($this->_createHeader('Third', 'three')));
+ ->will($this->returnValue($this->createHeader('Third', 'three')));
$factory->expects($this->at(1))
->method('createTextHeader')
->with('First', 'one')
- ->will($this->returnValue($this->_createHeader('First', 'one')));
+ ->will($this->returnValue($this->createHeader('First', 'one')));
$factory->expects($this->at(2))
->method('createTextHeader')
->with('Second', 'two')
- ->will($this->returnValue($this->_createHeader('Second', 'two')));
+ ->will($this->returnValue($this->createHeader('Second', 'two')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Third', 'three');
$set->addTextHeader('First', 'one');
$set->addTextHeader('Second', 'two');
- $set->defineOrdering(array('First', 'Second', 'Third'));
+ $set->defineOrdering(['First', 'Second', 'Third']);
$this->assertEquals(
"First: one\r\n".
@@ -602,36 +599,36 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testUnsortedHeadersAppearAtEnd()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Fourth', 'four')
- ->will($this->returnValue($this->_createHeader('Fourth', 'four')));
+ ->will($this->returnValue($this->createHeader('Fourth', 'four')));
$factory->expects($this->at(1))
->method('createTextHeader')
->with('Fifth', 'five')
- ->will($this->returnValue($this->_createHeader('Fifth', 'five')));
+ ->will($this->returnValue($this->createHeader('Fifth', 'five')));
$factory->expects($this->at(2))
->method('createTextHeader')
->with('Third', 'three')
- ->will($this->returnValue($this->_createHeader('Third', 'three')));
+ ->will($this->returnValue($this->createHeader('Third', 'three')));
$factory->expects($this->at(3))
->method('createTextHeader')
->with('First', 'one')
- ->will($this->returnValue($this->_createHeader('First', 'one')));
+ ->will($this->returnValue($this->createHeader('First', 'one')));
$factory->expects($this->at(4))
->method('createTextHeader')
->with('Second', 'two')
- ->will($this->returnValue($this->_createHeader('Second', 'two')));
+ ->will($this->returnValue($this->createHeader('Second', 'two')));
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Fourth', 'four');
$set->addTextHeader('Fifth', 'five');
$set->addTextHeader('Third', 'three');
$set->addTextHeader('First', 'one');
$set->addTextHeader('Second', 'two');
- $set->defineOrdering(array('First', 'Second', 'Third'));
+ $set->defineOrdering(['First', 'Second', 'Third']);
$this->assertEquals(
"First: one\r\n".
@@ -645,9 +642,9 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testSettingCharsetNotifiesAlreadyExistingHeaders()
{
- $subject = $this->_createHeader('Subject', 'some text');
- $xHeader = $this->_createHeader('X-Header', 'some text');
- $factory = $this->_createFactory();
+ $subject = $this->createHeader('Subject', 'some text');
+ $xHeader = $this->createHeader('X-Header', 'some text');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Subject', 'some text')
@@ -663,7 +660,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->method('setCharset')
->with('utf-8');
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Subject', 'some text');
$set->addTextHeader('X-Header', 'some text');
@@ -672,9 +669,9 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testCharsetChangeNotifiesAlreadyExistingHeaders()
{
- $subject = $this->_createHeader('Subject', 'some text');
- $xHeader = $this->_createHeader('X-Header', 'some text');
- $factory = $this->_createFactory();
+ $subject = $this->createHeader('Subject', 'some text');
+ $xHeader = $this->createHeader('X-Header', 'some text');
+ $factory = $this->createFactory();
$factory->expects($this->at(0))
->method('createTextHeader')
->with('Subject', 'some text')
@@ -690,7 +687,7 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
->method('setCharset')
->with('utf-8');
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->addTextHeader('Subject', 'some text');
$set->addTextHeader('X-Header', 'some text');
@@ -699,27 +696,27 @@ class Swift_Mime_SimpleHeaderSetTest extends \PHPUnit_Framework_TestCase
public function testCharsetChangeNotifiesFactory()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('charsetChanged')
->with('utf-8');
- $set = $this->_createSet($factory);
+ $set = $this->createSet($factory);
$set->setCharset('utf-8');
}
- private function _createSet($factory)
+ private function createSet($factory)
{
return new Swift_Mime_SimpleHeaderSet($factory);
}
- private function _createFactory()
+ private function createFactory()
{
- return $this->getMockBuilder('Swift_Mime_HeaderFactory')->getMock();
+ return $this->getMockBuilder('Swift_Mime_SimpleHeaderFactory')->disableOriginalConstructor()->getMock();
}
- private function _createHeader($name, $body = '')
+ private function createHeader($name, $body = '')
{
$header = $this->getMockBuilder('Swift_Mime_Header')->getMock();
$header->expects($this->any())
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php
index e5d225cbb6..c5662cbe39 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php
@@ -1,72 +1,80 @@
<?php
+
class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
{
public function testNestingLevelIsSubpart()
{
- //Overridden
+ // not relevant
+ $this->addToAssertionCount(1);
}
public function testNestingLevelIsTop()
{
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(
- Swift_Mime_MimeEntity::LEVEL_TOP, $message->getNestingLevel()
+ Swift_Mime_SimpleMimeEntity::LEVEL_TOP, $message->getNestingLevel()
);
}
public function testDateIsReturnedFromHeader()
{
- $date = $this->_createHeader('Date', 123);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Date' => $date)),
- $this->_createEncoder(), $this->_createCache()
+ $dateTime = new DateTimeImmutable();
+
+ $date = $this->createHeader('Date', $dateTime);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Date' => $date]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(123, $message->getDate());
+ $this->assertEquals($dateTime, $message->getDate());
}
public function testDateIsSetInHeader()
{
- $date = $this->_createHeader('Date', 123, array(), false);
+ $dateTime = new DateTimeImmutable();
+
+ $date = $this->createHeader('Date', new DateTimeImmutable(), [], false);
$date->shouldReceive('setFieldBodyModel')
->once()
- ->with(1234);
+ ->with($dateTime);
$date->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Date' => $date)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Date' => $date]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setDate(1234);
+ $message->setDate($dateTime);
}
public function testDateHeaderIsCreatedIfNonePresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $dateTime = new DateTimeImmutable();
+
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addDateHeader')
->once()
- ->with('Date', 1234);
+ ->with('Date', $dateTime);
$headers->shouldReceive('addDateHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
- $message->setDate(1234);
+ $message->setDate($dateTime);
}
public function testDateHeaderIsAddedDuringConstruction()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addDateHeader')
->once()
- ->with('Date', '/^[0-9]+$/D');
+ ->with('Date', Mockery::type('DateTimeImmutable'));
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
}
@@ -79,39 +87,39 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
identical to the "Message-ID" header field
*/
- $messageId = $this->_createHeader('Message-ID', 'a@b');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Message-ID' => $messageId)),
- $this->_createEncoder(), $this->_createCache()
+ $messageId = $this->createHeader('Message-ID', 'a@b');
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Message-ID' => $messageId]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('a@b', $message->getId());
}
public function testIdIsSetInHeader()
{
- $messageId = $this->_createHeader('Message-ID', 'a@b', array(), false);
+ $messageId = $this->createHeader('Message-ID', 'a@b', [], false);
$messageId->shouldReceive('setFieldBodyModel')
->once()
->with('x@y');
$messageId->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Message-ID' => $messageId)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Message-ID' => $messageId]),
+ $this->createEncoder(), $this->createCache()
);
$message->setId('x@y');
}
public function testIdIsAutoGenerated()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addIdHeader')
->once()
->with('Message-ID', '/^.*?@.*?$/D');
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
}
@@ -120,39 +128,39 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.5.
*/
- $subject = $this->_createHeader('Subject', 'example subject');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Subject' => $subject)),
- $this->_createEncoder(), $this->_createCache()
+ $subject = $this->createHeader('Subject', 'example subject');
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Subject' => $subject]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('example subject', $message->getSubject());
}
public function testSubjectIsSetInHeader()
{
- $subject = $this->_createHeader('Subject', '', array(), false);
+ $subject = $this->createHeader('Subject', '', [], false);
$subject->shouldReceive('setFieldBodyModel')
->once()
->with('foo');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Subject' => $subject)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Subject' => $subject]),
+ $this->createEncoder(), $this->createCache()
);
$message->setSubject('foo');
}
public function testSubjectHeaderIsCreatedIfNotPresent()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addTextHeader')
->once()
->with('Subject', 'example subject');
$headers->shouldReceive('addTextHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setSubject('example subject');
}
@@ -162,37 +170,37 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.7.
*/
- $path = $this->_createHeader('Return-Path', 'bounces@domain');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Return-Path' => $path)),
- $this->_createEncoder(), $this->_createCache()
+ $path = $this->createHeader('Return-Path', 'bounces@domain');
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Return-Path' => $path]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('bounces@domain', $message->getReturnPath());
}
public function testReturnPathIsSetInHeader()
{
- $path = $this->_createHeader('Return-Path', '', array(), false);
+ $path = $this->createHeader('Return-Path', '', [], false);
$path->shouldReceive('setFieldBodyModel')
->once()
->with('bounces@domain');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Return-Path' => $path)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Return-Path' => $path]),
+ $this->createEncoder(), $this->createCache()
);
$message->setReturnPath('bounces@domain');
}
public function testReturnPathHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addPathHeader')
->once()
->with('Return-Path', 'bounces@domain');
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setReturnPath('bounces@domain');
}
@@ -202,56 +210,56 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.2.
*/
- $sender = $this->_createHeader('Sender', array('sender@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Sender' => $sender)),
- $this->_createEncoder(), $this->_createCache()
+ $sender = $this->createHeader('Sender', ['sender@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Sender' => $sender]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('sender@domain' => 'Name'), $message->getSender());
+ $this->assertEquals(['sender@domain' => 'Name'], $message->getSender());
}
public function testSenderIsSetInHeader()
{
- $sender = $this->_createHeader('Sender', array('sender@domain' => 'Name'),
- array(), false
+ $sender = $this->createHeader('Sender', ['sender@domain' => 'Name'],
+ [], false
);
$sender->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Sender' => $sender)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Sender' => $sender]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setSender(array('other@domain' => 'Other'));
+ $message->setSender(['other@domain' => 'Other']);
}
public function testSenderHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('Sender', (array) 'sender@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setSender('sender@domain');
}
public function testNameCanBeUsedInSenderHeader()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('Sender', array('sender@domain' => 'Name'));
+ ->with('Sender', ['sender@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setSender('sender@domain', 'Name');
}
@@ -261,72 +269,72 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.2.
*/
- $from = $this->_createHeader('From', array('from@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('From' => $from)),
- $this->_createEncoder(), $this->_createCache()
+ $from = $this->createHeader('From', ['from@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['From' => $from]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('from@domain' => 'Name'), $message->getFrom());
+ $this->assertEquals(['from@domain' => 'Name'], $message->getFrom());
}
public function testFromIsSetInHeader()
{
- $from = $this->_createHeader('From', array('from@domain' => 'Name'),
- array(), false
+ $from = $this->createHeader('From', ['from@domain' => 'Name'],
+ [], false
);
$from->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('From' => $from)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['From' => $from]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setFrom(array('other@domain' => 'Other'));
+ $message->setFrom(['other@domain' => 'Other']);
}
public function testFromIsAddedToHeadersDuringAddFrom()
{
- $from = $this->_createHeader('From', array('from@domain' => 'Name'),
- array(), false
+ $from = $this->createHeader('From', ['from@domain' => 'Name'],
+ [], false
);
$from->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));
+ ->with(['from@domain' => 'Name', 'other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('From' => $from)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['From' => $from]),
+ $this->createEncoder(), $this->createCache()
);
$message->addFrom('other@domain', 'Other');
}
public function testFromHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('From', (array) 'from@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setFrom('from@domain');
}
public function testPersonalNameCanBeUsedInFromAddress()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('From', array('from@domain' => 'Name'));
+ ->with('From', ['from@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setFrom('from@domain', 'Name');
}
@@ -336,72 +344,72 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.2.
*/
- $reply = $this->_createHeader('Reply-To', array('reply@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Reply-To' => $reply)),
- $this->_createEncoder(), $this->_createCache()
+ $reply = $this->createHeader('Reply-To', ['reply@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Reply-To' => $reply]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('reply@domain' => 'Name'), $message->getReplyTo());
+ $this->assertEquals(['reply@domain' => 'Name'], $message->getReplyTo());
}
public function testReplyToIsSetInHeader()
{
- $reply = $this->_createHeader('Reply-To', array('reply@domain' => 'Name'),
- array(), false
+ $reply = $this->createHeader('Reply-To', ['reply@domain' => 'Name'],
+ [], false
);
$reply->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Reply-To' => $reply)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Reply-To' => $reply]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setReplyTo(array('other@domain' => 'Other'));
+ $message->setReplyTo(['other@domain' => 'Other']);
}
public function testReplyToIsAddedToHeadersDuringAddReplyTo()
{
- $replyTo = $this->_createHeader('Reply-To', array('from@domain' => 'Name'),
- array(), false
+ $replyTo = $this->createHeader('Reply-To', ['from@domain' => 'Name'],
+ [], false
);
$replyTo->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));
+ ->with(['from@domain' => 'Name', 'other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Reply-To' => $replyTo)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Reply-To' => $replyTo]),
+ $this->createEncoder(), $this->createCache()
);
$message->addReplyTo('other@domain', 'Other');
}
public function testReplyToHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('Reply-To', (array) 'reply@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setReplyTo('reply@domain');
}
public function testNameCanBeUsedInReplyTo()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('Reply-To', array('reply@domain' => 'Name'));
+ ->with('Reply-To', ['reply@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setReplyTo('reply@domain', 'Name');
}
@@ -411,72 +419,72 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.3.
*/
- $to = $this->_createHeader('To', array('to@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('To' => $to)),
- $this->_createEncoder(), $this->_createCache()
+ $to = $this->createHeader('To', ['to@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['To' => $to]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('to@domain' => 'Name'), $message->getTo());
+ $this->assertEquals(['to@domain' => 'Name'], $message->getTo());
}
public function testToIsSetInHeader()
{
- $to = $this->_createHeader('To', array('to@domain' => 'Name'),
- array(), false
+ $to = $this->createHeader('To', ['to@domain' => 'Name'],
+ [], false
);
$to->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('To' => $to)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['To' => $to]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setTo(array('other@domain' => 'Other'));
+ $message->setTo(['other@domain' => 'Other']);
}
public function testToIsAddedToHeadersDuringAddTo()
{
- $to = $this->_createHeader('To', array('from@domain' => 'Name'),
- array(), false
+ $to = $this->createHeader('To', ['from@domain' => 'Name'],
+ [], false
);
$to->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));
+ ->with(['from@domain' => 'Name', 'other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('To' => $to)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['To' => $to]),
+ $this->createEncoder(), $this->createCache()
);
$message->addTo('other@domain', 'Other');
}
public function testToHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('To', (array) 'to@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setTo('to@domain');
}
public function testNameCanBeUsedInToHeader()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('To', array('to@domain' => 'Name'));
+ ->with('To', ['to@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setTo('to@domain', 'Name');
}
@@ -486,72 +494,72 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.3.
*/
- $cc = $this->_createHeader('Cc', array('cc@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Cc' => $cc)),
- $this->_createEncoder(), $this->_createCache()
+ $cc = $this->createHeader('Cc', ['cc@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Cc' => $cc]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('cc@domain' => 'Name'), $message->getCc());
+ $this->assertEquals(['cc@domain' => 'Name'], $message->getCc());
}
public function testCcIsSetInHeader()
{
- $cc = $this->_createHeader('Cc', array('cc@domain' => 'Name'),
- array(), false
+ $cc = $this->createHeader('Cc', ['cc@domain' => 'Name'],
+ [], false
);
$cc->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Cc' => $cc)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Cc' => $cc]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setCc(array('other@domain' => 'Other'));
+ $message->setCc(['other@domain' => 'Other']);
}
public function testCcIsAddedToHeadersDuringAddCc()
{
- $cc = $this->_createHeader('Cc', array('from@domain' => 'Name'),
- array(), false
+ $cc = $this->createHeader('Cc', ['from@domain' => 'Name'],
+ [], false
);
$cc->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));
+ ->with(['from@domain' => 'Name', 'other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Cc' => $cc)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Cc' => $cc]),
+ $this->createEncoder(), $this->createCache()
);
$message->addCc('other@domain', 'Other');
}
public function testCcHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('Cc', (array) 'cc@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setCc('cc@domain');
}
public function testNameCanBeUsedInCcHeader()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('Cc', array('cc@domain' => 'Name'));
+ ->with('Cc', ['cc@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setCc('cc@domain', 'Name');
}
@@ -561,180 +569,180 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
/* -- RFC 2822, 3.6.3.
*/
- $bcc = $this->_createHeader('Bcc', array('bcc@domain' => 'Name'));
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Bcc' => $bcc)),
- $this->_createEncoder(), $this->_createCache()
+ $bcc = $this->createHeader('Bcc', ['bcc@domain' => 'Name']);
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Bcc' => $bcc]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('bcc@domain' => 'Name'), $message->getBcc());
+ $this->assertEquals(['bcc@domain' => 'Name'], $message->getBcc());
}
public function testBccIsSetInHeader()
{
- $bcc = $this->_createHeader('Bcc', array('bcc@domain' => 'Name'),
- array(), false
+ $bcc = $this->createHeader('Bcc', ['bcc@domain' => 'Name'],
+ [], false
);
$bcc->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('other@domain' => 'Other'));
+ ->with(['other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Bcc' => $bcc)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Bcc' => $bcc]),
+ $this->createEncoder(), $this->createCache()
);
- $message->setBcc(array('other@domain' => 'Other'));
+ $message->setBcc(['other@domain' => 'Other']);
}
public function testBccIsAddedToHeadersDuringAddBcc()
{
- $bcc = $this->_createHeader('Bcc', array('from@domain' => 'Name'),
- array(), false
+ $bcc = $this->createHeader('Bcc', ['from@domain' => 'Name'],
+ [], false
);
$bcc->shouldReceive('setFieldBodyModel')
->once()
- ->with(array('from@domain' => 'Name', 'other@domain' => 'Other'));
+ ->with(['from@domain' => 'Name', 'other@domain' => 'Other']);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Bcc' => $bcc)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Bcc' => $bcc]),
+ $this->createEncoder(), $this->createCache()
);
$message->addBcc('other@domain', 'Other');
}
public function testBccHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('Bcc', (array) 'bcc@domain');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setBcc('bcc@domain');
}
public function testNameCanBeUsedInBcc()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
- ->with('Bcc', array('bcc@domain' => 'Name'));
+ ->with('Bcc', ['bcc@domain' => 'Name']);
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setBcc('bcc@domain', 'Name');
}
public function testPriorityIsReadFromHeader()
{
- $prio = $this->_createHeader('X-Priority', '2 (High)');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('X-Priority' => $prio)),
- $this->_createEncoder(), $this->_createCache()
+ $prio = $this->createHeader('X-Priority', '2 (High)');
+ $message = $this->createMessage(
+ $this->createHeaderSet(['X-Priority' => $prio]),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals(2, $message->getPriority());
}
public function testPriorityIsSetInHeader()
{
- $prio = $this->_createHeader('X-Priority', '2 (High)', array(), false);
+ $prio = $this->createHeader('X-Priority', '2 (High)', [], false);
$prio->shouldReceive('setFieldBodyModel')
->once()
->with('5 (Lowest)');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('X-Priority' => $prio)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['X-Priority' => $prio]),
+ $this->createEncoder(), $this->createCache()
);
$message->setPriority($message::PRIORITY_LOWEST);
}
public function testPriorityHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addTextHeader')
->once()
->with('X-Priority', '4 (Low)');
$headers->shouldReceive('addTextHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setPriority($message::PRIORITY_LOW);
}
public function testReadReceiptAddressReadFromHeader()
{
- $rcpt = $this->_createHeader('Disposition-Notification-To',
- array('chris@swiftmailer.org' => 'Chris')
+ $rcpt = $this->createHeader('Disposition-Notification-To',
+ ['chris@swiftmailer.org' => 'Chris']
);
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Disposition-Notification-To' => $rcpt]),
+ $this->createEncoder(), $this->createCache()
);
- $this->assertEquals(array('chris@swiftmailer.org' => 'Chris'),
+ $this->assertEquals(['chris@swiftmailer.org' => 'Chris'],
$message->getReadReceiptTo()
);
}
public function testReadReceiptIsSetInHeader()
{
- $rcpt = $this->_createHeader('Disposition-Notification-To', array(), array(), false);
+ $rcpt = $this->createHeader('Disposition-Notification-To', [], [], false);
$rcpt->shouldReceive('setFieldBodyModel')
->once()
->with('mark@swiftmailer.org');
- $message = $this->_createMessage(
- $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage(
+ $this->createHeaderSet(['Disposition-Notification-To' => $rcpt]),
+ $this->createEncoder(), $this->createCache()
);
$message->setReadReceiptTo('mark@swiftmailer.org');
}
public function testReadReceiptHeaderIsAddedIfNoneSet()
{
- $headers = $this->_createHeaderSet(array(), false);
+ $headers = $this->createHeaderSet([], false);
$headers->shouldReceive('addMailboxHeader')
->once()
->with('Disposition-Notification-To', 'mark@swiftmailer.org');
$headers->shouldReceive('addMailboxHeader')
->zeroOrMoreTimes();
- $message = $this->_createMessage($headers, $this->_createEncoder(),
- $this->_createCache()
+ $message = $this->createMessage($headers, $this->createEncoder(),
+ $this->createCache()
);
$message->setReadReceiptTo('mark@swiftmailer.org');
}
public function testChildrenCanBeAttached()
{
- $child1 = $this->_createChild();
- $child2 = $this->_createChild();
+ $child1 = $this->createChild();
+ $child2 = $this->createChild();
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$message->attach($child1);
$message->attach($child2);
- $this->assertEquals(array($child1, $child2), $message->getChildren());
+ $this->assertEquals([$child1, $child2], $message->getChildren());
}
public function testChildrenCanBeDetached()
{
- $child1 = $this->_createChild();
- $child2 = $this->_createChild();
+ $child1 = $this->createChild();
+ $child2 = $this->createChild();
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$message->attach($child1);
@@ -742,33 +750,33 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
$message->detach($child1);
- $this->assertEquals(array($child2), $message->getChildren());
+ $this->assertEquals([$child2], $message->getChildren());
}
public function testEmbedAttachesChild()
{
- $child = $this->_createChild();
+ $child = $this->createChild();
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$message->embed($child);
- $this->assertEquals(array($child), $message->getChildren());
+ $this->assertEquals([$child], $message->getChildren());
}
public function testEmbedReturnsValidCid()
{
- $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_RELATED, '',
+ $child = $this->createChild(Swift_Mime_SimpleMimeEntity::LEVEL_RELATED, '',
false
);
$child->shouldReceive('getId')
->zeroOrMoreTimes()
->andReturn('foo@bar');
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertEquals('cid:foo@bar', $message->embed($child));
@@ -776,32 +784,32 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
public function testFluidInterface()
{
- $child = $this->_createChild();
- $message = $this->_createMessage($this->_createHeaderSet(),
- $this->_createEncoder(), $this->_createCache()
+ $child = $this->createChild();
+ $message = $this->createMessage($this->createHeaderSet(),
+ $this->createEncoder(), $this->createCache()
);
$this->assertSame($message,
$message
->setContentType('text/plain')
- ->setEncoder($this->_createEncoder())
+ ->setEncoder($this->createEncoder())
->setId('foo@bar')
->setDescription('my description')
->setMaxLineLength(998)
->setBody('xx')
->setBoundary('xyz')
- ->setChildren(array())
+ ->setChildren([])
->setCharset('iso-8859-1')
->setFormat('flowed')
->setDelSp(false)
->setSubject('subj')
- ->setDate(123)
+ ->setDate(new DateTimeImmutable())
->setReturnPath('foo@bar')
->setSender('foo@bar')
- ->setFrom(array('x@y' => 'XY'))
- ->setReplyTo(array('ab@cd' => 'ABCD'))
- ->setTo(array('chris@site.tld', 'mark@site.tld'))
+ ->setFrom(['x@y' => 'XY'])
+ ->setReplyTo(['ab@cd' => 'ABCD'])
+ ->setTo(['chris@site.tld', 'mark@site.tld'])
->setCc('john@somewhere.tld')
- ->setBcc(array('one@site', 'two@site' => 'Two'))
+ ->setBcc(['one@site', 'two@site' => 'Two'])
->setPriority($message::PRIORITY_LOW)
->setReadReceiptTo('a@b')
->attach($child)
@@ -810,18 +818,20 @@ class Swift_Mime_SimpleMessageTest extends Swift_Mime_MimePartTest
}
//abstract
- protected function _createEntity($headers, $encoder, $cache)
+ protected function createEntity($headers, $encoder, $cache)
{
- return $this->_createMessage($headers, $encoder, $cache);
+ return $this->createMessage($headers, $encoder, $cache);
}
- protected function _createMimePart($headers, $encoder, $cache)
+ protected function createMimePart($headers, $encoder, $cache)
{
- return $this->_createMessage($headers, $encoder, $cache);
+ return $this->createMessage($headers, $encoder, $cache);
}
- private function _createMessage($headers, $encoder, $cache)
+ private function createMessage($headers, $encoder, $cache)
{
- return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, new Swift_Mime_Grammar());
+ $idGenerator = new Swift_Mime_IdGenerator('example.com');
+
+ return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, $idGenerator);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php
index fa2a8d48c3..24578ed8e9 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php
@@ -1,9 +1,12 @@
<?php
+
class Swift_Mime_SimpleMimeEntityTest extends Swift_Mime_AbstractMimeEntityTest
{
- protected function _createEntity($headerFactory, $encoder, $cache)
+ protected function createEntity($headerFactory, $encoder, $cache)
{
- return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, new Swift_Mime_Grammar());
+ $idGenerator = new Swift_Mime_IdGenerator('example.com');
+
+ return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, $idGenerator);
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
index 463e4ebbae..036800ab46 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit\Framework\TestCase
{
public function testThresholdCanBeSetAndFetched()
{
@@ -20,13 +20,13 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase
public function testPluginStopsConnectionAfterThreshold()
{
- $transport = $this->_createTransport();
+ $transport = $this->createTransport();
$transport->expects($this->once())
->method('start');
$transport->expects($this->once())
->method('stop');
- $evt = $this->_createSendEvent($transport);
+ $evt = $this->createSendEvent($transport);
$plugin = new Swift_Plugins_AntiFloodPlugin(10);
for ($i = 0; $i < 12; ++$i) {
@@ -36,13 +36,13 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase
public function testPluginCanStopAndStartMultipleTimes()
{
- $transport = $this->_createTransport();
+ $transport = $this->createTransport();
$transport->expects($this->exactly(5))
->method('start');
$transport->expects($this->exactly(5))
->method('stop');
- $evt = $this->_createSendEvent($transport);
+ $evt = $this->createSendEvent($transport);
$plugin = new Swift_Plugins_AntiFloodPlugin(2);
for ($i = 0; $i < 11; ++$i) {
@@ -57,13 +57,13 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase
->method('sleep')
->with(10);
- $transport = $this->_createTransport();
+ $transport = $this->createTransport();
$transport->expects($this->once())
->method('start');
$transport->expects($this->once())
->method('stop');
- $evt = $this->_createSendEvent($transport);
+ $evt = $this->createSendEvent($transport);
$plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper);
for ($i = 0; $i < 101; ++$i) {
@@ -71,12 +71,12 @@ class Swift_Plugins_AntiFloodPluginTest extends \PHPUnit_Framework_TestCase
}
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
- private function _createSendEvent($transport)
+ private function createSendEvent($transport)
{
$evt = $this->getMockBuilder('Swift_Events_SendEvent')
->disableOriginalConstructor()
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
index 869cfc8021..cbacfe276a 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit\Framework\TestCase
{
private $_monitor;
@@ -8,68 +8,68 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa
protected function setUp()
{
- $this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin();
+ $this->monitor = new Swift_Plugins_BandwidthMonitorPlugin();
}
public function testBytesOutIncreasesWhenCommandsSent()
{
- $evt = $this->_createCommandEvent("RCPT TO:<foo@bar.com>\r\n");
+ $evt = $this->createCommandEvent("RCPT TO:<foo@bar.com>\r\n");
- $this->assertEquals(0, $this->_monitor->getBytesOut());
- $this->_monitor->commandSent($evt);
- $this->assertEquals(23, $this->_monitor->getBytesOut());
- $this->_monitor->commandSent($evt);
- $this->assertEquals(46, $this->_monitor->getBytesOut());
+ $this->assertEquals(0, $this->monitor->getBytesOut());
+ $this->monitor->commandSent($evt);
+ $this->assertEquals(23, $this->monitor->getBytesOut());
+ $this->monitor->commandSent($evt);
+ $this->assertEquals(46, $this->monitor->getBytesOut());
}
public function testBytesInIncreasesWhenResponsesReceived()
{
- $evt = $this->_createResponseEvent("250 Ok\r\n");
+ $evt = $this->createResponseEvent("250 Ok\r\n");
- $this->assertEquals(0, $this->_monitor->getBytesIn());
- $this->_monitor->responseReceived($evt);
- $this->assertEquals(8, $this->_monitor->getBytesIn());
- $this->_monitor->responseReceived($evt);
- $this->assertEquals(16, $this->_monitor->getBytesIn());
+ $this->assertEquals(0, $this->monitor->getBytesIn());
+ $this->monitor->responseReceived($evt);
+ $this->assertEquals(8, $this->monitor->getBytesIn());
+ $this->monitor->responseReceived($evt);
+ $this->assertEquals(16, $this->monitor->getBytesIn());
}
public function testCountersCanBeReset()
{
- $evt = $this->_createResponseEvent("250 Ok\r\n");
+ $evt = $this->createResponseEvent("250 Ok\r\n");
- $this->assertEquals(0, $this->_monitor->getBytesIn());
- $this->_monitor->responseReceived($evt);
- $this->assertEquals(8, $this->_monitor->getBytesIn());
- $this->_monitor->responseReceived($evt);
- $this->assertEquals(16, $this->_monitor->getBytesIn());
+ $this->assertEquals(0, $this->monitor->getBytesIn());
+ $this->monitor->responseReceived($evt);
+ $this->assertEquals(8, $this->monitor->getBytesIn());
+ $this->monitor->responseReceived($evt);
+ $this->assertEquals(16, $this->monitor->getBytesIn());
- $evt = $this->_createCommandEvent("RCPT TO:<foo@bar.com>\r\n");
+ $evt = $this->createCommandEvent("RCPT TO:<foo@bar.com>\r\n");
- $this->assertEquals(0, $this->_monitor->getBytesOut());
- $this->_monitor->commandSent($evt);
- $this->assertEquals(23, $this->_monitor->getBytesOut());
- $this->_monitor->commandSent($evt);
- $this->assertEquals(46, $this->_monitor->getBytesOut());
+ $this->assertEquals(0, $this->monitor->getBytesOut());
+ $this->monitor->commandSent($evt);
+ $this->assertEquals(23, $this->monitor->getBytesOut());
+ $this->monitor->commandSent($evt);
+ $this->assertEquals(46, $this->monitor->getBytesOut());
- $this->_monitor->reset();
+ $this->monitor->reset();
- $this->assertEquals(0, $this->_monitor->getBytesOut());
- $this->assertEquals(0, $this->_monitor->getBytesIn());
+ $this->assertEquals(0, $this->monitor->getBytesOut());
+ $this->assertEquals(0, $this->monitor->getBytesIn());
}
public function testBytesOutIncreasesAccordingToMessageLength()
{
- $message = $this->_createMessageWithByteCount(6);
- $evt = $this->_createSendEvent($message);
+ $message = $this->createMessageWithByteCount(6);
+ $evt = $this->createSendEvent($message);
- $this->assertEquals(0, $this->_monitor->getBytesOut());
- $this->_monitor->sendPerformed($evt);
- $this->assertEquals(6, $this->_monitor->getBytesOut());
- $this->_monitor->sendPerformed($evt);
- $this->assertEquals(12, $this->_monitor->getBytesOut());
+ $this->assertEquals(0, $this->monitor->getBytesOut());
+ $this->monitor->sendPerformed($evt);
+ $this->assertEquals(6, $this->monitor->getBytesOut());
+ $this->monitor->sendPerformed($evt);
+ $this->assertEquals(12, $this->monitor->getBytesOut());
}
- private function _createSendEvent($message)
+ private function createSendEvent($message)
{
$evt = $this->getMockBuilder('Swift_Events_SendEvent')
->disableOriginalConstructor()
@@ -81,7 +81,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa
return $evt;
}
- private function _createCommandEvent($command)
+ private function createCommandEvent($command)
{
$evt = $this->getMockBuilder('Swift_Events_CommandEvent')
->disableOriginalConstructor()
@@ -93,7 +93,7 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa
return $evt;
}
- private function _createResponseEvent($response)
+ private function createResponseEvent($response)
{
$evt = $this->getMockBuilder('Swift_Events_ResponseEvent')
->disableOriginalConstructor()
@@ -105,23 +105,23 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCa
return $evt;
}
- private function _createMessageWithByteCount($bytes)
+ private function createMessageWithByteCount($bytes)
{
- $this->_bytes = $bytes;
- $msg = $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ $this->bytes = $bytes;
+ $msg = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
$msg->expects($this->any())
->method('toByteStream')
- ->will($this->returnCallback(array($this, '_write')));
- /* $this->_checking(Expectations::create()
- -> ignoring($msg)->toByteStream(any()) -> calls(array($this, '_write'))
- ); */
+ ->will($this->returnCallback([$this, 'write']));
+ /* $this->checking(Expectations::create()
+ -> ignoring($msg)->toByteStream(any()) -> calls(array($this, 'write'))
+ ); */
return $msg;
}
- public function _write($is)
+ public function write($is)
{
- for ($i = 0; $i < $this->_bytes; ++$i) {
+ for ($i = 0; $i < $this->bytes; ++$i) {
$is->write('x');
}
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php
index 8019dfbd06..97b1d9586c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php
@@ -4,10 +4,10 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
{
public function testMessageBodyReceivesReplacements()
{
- $message = $this->_createMessage(
- $this->_createHeaders(),
- array('zip@button.tld' => 'Zipathon'),
- array('chris.corbyn@swiftmailer.org' => 'Chris'),
+ $message = $this->createMessage(
+ $this->createHeaders(),
+ ['zip@button.tld' => 'Zipathon'],
+ ['chris.corbyn@swiftmailer.org' => 'Chris'],
'Subject',
'Hello {name}, you are customer #{id}'
);
@@ -17,11 +17,11 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$message->shouldReceive('setBody')
->zeroOrMoreTimes();
- $plugin = $this->_createPlugin(
- array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))
+ $plugin = $this->createPlugin(
+ ['zip@button.tld' => ['{name}' => 'Zip', '{id}' => '456']]
);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$plugin->sendPerformed($evt);
@@ -29,10 +29,10 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
public function testReplacementsCanBeAppliedToSameMessageMultipleTimes()
{
- $message = $this->_createMessage(
- $this->_createHeaders(),
- array('zip@button.tld' => 'Zipathon', 'foo@bar.tld' => 'Foo'),
- array('chris.corbyn@swiftmailer.org' => 'Chris'),
+ $message = $this->createMessage(
+ $this->createHeaders(),
+ ['zip@button.tld' => 'Zipathon', 'foo@bar.tld' => 'Foo'],
+ ['chris.corbyn@swiftmailer.org' => 'Chris'],
'Subject',
'Hello {name}, you are customer #{id}'
);
@@ -48,14 +48,14 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$message->shouldReceive('setBody')
->zeroOrMoreTimes();
- $plugin = $this->_createPlugin(
- array(
- 'foo@bar.tld' => array('{name}' => 'Foo', '{id}' => '123'),
- 'zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'),
- )
+ $plugin = $this->createPlugin(
+ [
+ 'foo@bar.tld' => ['{name}' => 'Foo', '{id}' => '123'],
+ 'zip@button.tld' => ['{name}' => 'Zip', '{id}' => '456'],
+ ]
);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$plugin->sendPerformed($evt);
@@ -65,15 +65,15 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
public function testReplacementsCanBeMadeInHeaders()
{
- $headers = $this->_createHeaders(array(
- $returnPathHeader = $this->_createHeader('Return-Path', 'foo-{id}@swiftmailer.org'),
- $toHeader = $this->_createHeader('Subject', 'A message for {name}!'),
- ));
+ $headers = $this->createHeaders([
+ $returnPathHeader = $this->createHeader('Return-Path', 'foo-{id}@swiftmailer.org'),
+ $toHeader = $this->createHeader('Subject', 'A message for {name}!'),
+ ]);
- $message = $this->_createMessage(
+ $message = $this->createMessage(
$headers,
- array('zip@button.tld' => 'Zipathon'),
- array('chris.corbyn@swiftmailer.org' => 'Chris'),
+ ['zip@button.tld' => 'Zipathon'],
+ ['chris.corbyn@swiftmailer.org' => 'Chris'],
'A message for {name}!',
'Hello {name}, you are customer #{id}'
);
@@ -94,10 +94,10 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$returnPathHeader->shouldReceive('setFieldBodyModel')
->zeroOrMoreTimes();
- $plugin = $this->_createPlugin(
- array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))
+ $plugin = $this->createPlugin(
+ ['zip@button.tld' => ['{name}' => 'Zip', '{id}' => '456']]
);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$plugin->sendPerformed($evt);
@@ -105,18 +105,18 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
public function testReplacementsAreMadeOnSubparts()
{
- $part1 = $this->_createPart('text/plain', 'Your name is {name}?', '1@x');
- $part2 = $this->_createPart('text/html', 'Your <em>name</em> is {name}?', '2@x');
- $message = $this->_createMessage(
- $this->_createHeaders(),
- array('zip@button.tld' => 'Zipathon'),
- array('chris.corbyn@swiftmailer.org' => 'Chris'),
+ $part1 = $this->createPart('text/plain', 'Your name is {name}?', '1@x');
+ $part2 = $this->createPart('text/html', 'Your <em>name</em> is {name}?', '2@x');
+ $message = $this->createMessage(
+ $this->createHeaders(),
+ ['zip@button.tld' => 'Zipathon'],
+ ['chris.corbyn@swiftmailer.org' => 'Chris'],
'A message for {name}!',
'Subject'
);
$message->shouldReceive('getChildren')
->zeroOrMoreTimes()
- ->andReturn(array($part1, $part2));
+ ->andReturn([$part1, $part2]);
$part1->shouldReceive('setBody')
->once()
->with('Your name is Zip?');
@@ -128,11 +128,11 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$part2->shouldReceive('setBody')
->zeroOrMoreTimes();
- $plugin = $this->_createPlugin(
- array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456'))
+ $plugin = $this->createPlugin(
+ ['zip@button.tld' => ['{name}' => 'Zip', '{id}' => '456']]
);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$plugin->sendPerformed($evt);
@@ -140,15 +140,15 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
public function testReplacementsCanBeTakenFromCustomReplacementsObject()
{
- $message = $this->_createMessage(
- $this->_createHeaders(),
- array('foo@bar' => 'Foobar', 'zip@zap' => 'Zip zap'),
- array('chris.corbyn@swiftmailer.org' => 'Chris'),
+ $message = $this->createMessage(
+ $this->createHeaders(),
+ ['foo@bar' => 'Foobar', 'zip@zap' => 'Zip zap'],
+ ['chris.corbyn@swiftmailer.org' => 'Chris'],
'Subject',
'Something {a}'
);
- $replacements = $this->_createReplacements();
+ $replacements = $this->createReplacements();
$message->shouldReceive('setBody')
->once()
@@ -161,15 +161,15 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$replacements->shouldReceive('getReplacementsFor')
->once()
->with('foo@bar')
- ->andReturn(array('{a}' => 'b'));
+ ->andReturn(['{a}' => 'b']);
$replacements->shouldReceive('getReplacementsFor')
->once()
->with('zip@zap')
- ->andReturn(array('{a}' => 'c'));
+ ->andReturn(['{a}' => 'c']);
- $plugin = $this->_createPlugin($replacements);
+ $plugin = $this->createPlugin($replacements);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$plugin->sendPerformed($evt);
@@ -177,14 +177,31 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
$plugin->sendPerformed($evt);
}
- private function _createMessage($headers, $to = array(), $from = null, $subject = null,
+ public function testReplacementsWithAMessageWithImmutableDate()
+ {
+ $message = (new Swift_Message('subject foo'))
+ ->setBody('body foo')
+ ->addTo('somebody@hostname.tld')
+ ->addFrom('somebody@hostname.tld');
+
+ $evt = $this->createSendEvent($message);
+
+ $plugin = $this->createPlugin(['somebody@hostname.tld' => ['foo' => 'bar']]);
+
+ $plugin->beforeSendPerformed($evt);
+
+ $this->assertEquals('subject bar', $message->getSubject());
+ $this->assertEquals('body bar', $message->getBody());
+ }
+
+ private function createMessage($headers, $to = [], $from = null, $subject = null,
$body = null)
{
- $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
+ $message = $this->getMockery('Swift_Mime_SimpleMessage')->shouldIgnoreMissing();
foreach ($to as $addr => $name) {
$message->shouldReceive('getTo')
->once()
- ->andReturn(array($addr => $name));
+ ->andReturn([$addr => $name]);
}
$message->shouldReceive('getHeaders')
->zeroOrMoreTimes()
@@ -202,17 +219,17 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
return $message;
}
- private function _createPlugin($replacements)
+ private function createPlugin($replacements)
{
return new Swift_Plugins_DecoratorPlugin($replacements);
}
- private function _createReplacements()
+ private function createReplacements()
{
return $this->getMockery('Swift_Plugins_Decorator_Replacements')->shouldIgnoreMissing();
}
- private function _createSendEvent(Swift_Mime_Message $message)
+ private function createSendEvent(Swift_Mime_SimpleMessage $message)
{
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
$evt->shouldReceive('getMessage')
@@ -222,9 +239,9 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
return $evt;
}
- private function _createPart($type, $body, $id)
+ private function createPart($type, $body, $id)
{
- $part = $this->getMockery('Swift_Mime_MimeEntity')->shouldIgnoreMissing();
+ $part = $this->getMockery('Swift_Mime_SimpleMimeEntity')->shouldIgnoreMissing();
$part->shouldReceive('getContentType')
->zeroOrMoreTimes()
->andReturn($type);
@@ -238,9 +255,9 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
return $part;
}
- private function _createHeaders($headers = array())
+ private function createHeaders($headers = [])
{
- $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();
+ $set = $this->getMockery('Swift_Mime_SimpleHeaderSet')->shouldIgnoreMissing();
$set->shouldReceive('getAll')
->zeroOrMoreTimes()
->andReturn($headers);
@@ -252,7 +269,7 @@ class Swift_Plugins_DecoratorPluginTest extends \SwiftMailerTestCase
return $set;
}
- private function _createHeader($name, $body = '')
+ private function createHeader($name, $body = '')
{
$header = $this->getMockery('Swift_Mime_Header')->shouldIgnoreMissing();
$header->shouldReceive('getFieldName')
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php
index bfe4cb7074..d66021cb53 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php
@@ -4,118 +4,118 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
{
public function testLoggerDelegatesAddingEntries()
{
- $logger = $this->_createLogger();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with('foo');
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->add('foo');
}
public function testLoggerDelegatesDumpingEntries()
{
- $logger = $this->_createLogger();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('dump')
->will($this->returnValue('foobar'));
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$this->assertEquals('foobar', $plugin->dump());
}
public function testLoggerDelegatesClearingEntries()
{
- $logger = $this->_createLogger();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('clear');
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->clear();
}
public function testCommandIsSentToLogger()
{
- $evt = $this->_createCommandEvent("foo\r\n");
- $logger = $this->_createLogger();
+ $evt = $this->createCommandEvent("foo\r\n");
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
- ->with($this->regExp('~foo\r\n~'));
+ ->with(static::regExp('~foo\r\n~'));
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->commandSent($evt);
}
public function testResponseIsSentToLogger()
{
- $evt = $this->_createResponseEvent("354 Go ahead\r\n");
- $logger = $this->_createLogger();
+ $evt = $this->createResponseEvent("354 Go ahead\r\n");
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
- ->with($this->regExp('~354 Go ahead\r\n~'));
+ ->with(static::regExp('~354 Go ahead\r\n~'));
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->responseReceived($evt);
}
public function testTransportBeforeStartChangeIsSentToLogger()
{
- $evt = $this->_createTransportChangeEvent();
- $logger = $this->_createLogger();
+ $evt = $this->createTransportChangeEvent();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with($this->anything());
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->beforeTransportStarted($evt);
}
public function testTransportStartChangeIsSentToLogger()
{
- $evt = $this->_createTransportChangeEvent();
- $logger = $this->_createLogger();
+ $evt = $this->createTransportChangeEvent();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with($this->anything());
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->transportStarted($evt);
}
public function testTransportStopChangeIsSentToLogger()
{
- $evt = $this->_createTransportChangeEvent();
- $logger = $this->_createLogger();
+ $evt = $this->createTransportChangeEvent();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with($this->anything());
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->transportStopped($evt);
}
public function testTransportBeforeStopChangeIsSentToLogger()
{
- $evt = $this->_createTransportChangeEvent();
- $logger = $this->_createLogger();
+ $evt = $this->createTransportChangeEvent();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with($this->anything());
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
$plugin->beforeTransportStopped($evt);
}
public function testExceptionsArePassedToDelegateAndLeftToBubbleUp()
{
- $transport = $this->_createTransport();
- $evt = $this->_createTransportExceptionEvent();
- $logger = $this->_createLogger();
+ $transport = $this->createTransport();
+ $evt = $this->createTransportExceptionEvent();
+ $logger = $this->createLogger();
$logger->expects($this->once())
->method('add')
->with($this->anything());
- $plugin = $this->_createPlugin($logger);
+ $plugin = $this->createPlugin($logger);
try {
$plugin->exceptionThrown($evt);
$this->fail('Exception should bubble up.');
@@ -123,17 +123,17 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
}
}
- private function _createLogger()
+ private function createLogger()
{
return $this->getMockBuilder('Swift_Plugins_Logger')->getMock();
}
- private function _createPlugin($logger)
+ private function createPlugin($logger)
{
return new Swift_Plugins_LoggerPlugin($logger);
}
- private function _createCommandEvent($command)
+ private function createCommandEvent($command)
{
$evt = $this->getMockBuilder('Swift_Events_CommandEvent')
->disableOriginalConstructor()
@@ -145,7 +145,7 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
return $evt;
}
- private function _createResponseEvent($response)
+ private function createResponseEvent($response)
{
$evt = $this->getMockBuilder('Swift_Events_ResponseEvent')
->disableOriginalConstructor()
@@ -157,24 +157,24 @@ class Swift_Plugins_LoggerPluginTest extends \SwiftMailerTestCase
return $evt;
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
- private function _createTransportChangeEvent()
+ private function createTransportChangeEvent()
{
$evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')
->disableOriginalConstructor()
->getMock();
$evt->expects($this->any())
->method('getSource')
- ->will($this->returnValue($this->_createTransport()));
+ ->will($this->returnValue($this->createTransport()));
return $evt;
}
- public function _createTransportExceptionEvent()
+ public function createTransportExceptionEvent()
{
$evt = $this->getMockBuilder('Swift_Events_TransportExceptionEvent')
->disableOriginalConstructor()
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php
index 880bb32c9b..48c1b075a3 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Plugins_Loggers_ArrayLoggerTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_Loggers_ArrayLoggerTest extends \PHPUnit\Framework\TestCase
{
public function testAddingSingleEntryDumpsSingleLine()
{
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php
index 6134fe64e5..c43660da1f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Plugins_Loggers_EchoLoggerTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_Loggers_EchoLoggerTest extends \PHPUnit\Framework\TestCase
{
public function testAddingEntryDumpsSingleLineWithoutHtml()
{
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
index cbd368f36c..cf88a4e7f4 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
@@ -1,80 +1,80 @@
<?php
-class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit\Framework\TestCase
{
public function testPluginConnectsToPop3HostBeforeTransportStarts()
{
- $connection = $this->_createConnection();
+ $connection = $this->createConnection();
$connection->expects($this->once())
->method('connect');
- $plugin = $this->_createPlugin('pop.host.tld', 110);
+ $plugin = $this->createPlugin('pop.host.tld', 110);
$plugin->setConnection($connection);
- $transport = $this->_createTransport();
- $evt = $this->_createTransportChangeEvent($transport);
+ $transport = $this->createTransport();
+ $evt = $this->createTransportChangeEvent($transport);
$plugin->beforeTransportStarted($evt);
}
public function testPluginDisconnectsFromPop3HostBeforeTransportStarts()
{
- $connection = $this->_createConnection();
+ $connection = $this->createConnection();
$connection->expects($this->once())
->method('disconnect');
- $plugin = $this->_createPlugin('pop.host.tld', 110);
+ $plugin = $this->createPlugin('pop.host.tld', 110);
$plugin->setConnection($connection);
- $transport = $this->_createTransport();
- $evt = $this->_createTransportChangeEvent($transport);
+ $transport = $this->createTransport();
+ $evt = $this->createTransportChangeEvent($transport);
$plugin->beforeTransportStarted($evt);
}
public function testPluginDoesNotConnectToSmtpIfBoundToDifferentTransport()
{
- $connection = $this->_createConnection();
+ $connection = $this->createConnection();
$connection->expects($this->never())
->method('disconnect');
$connection->expects($this->never())
->method('connect');
- $smtp = $this->_createTransport();
+ $smtp = $this->createTransport();
- $plugin = $this->_createPlugin('pop.host.tld', 110);
+ $plugin = $this->createPlugin('pop.host.tld', 110);
$plugin->setConnection($connection);
$plugin->bindSmtp($smtp);
- $transport = $this->_createTransport();
- $evt = $this->_createTransportChangeEvent($transport);
+ $transport = $this->createTransport();
+ $evt = $this->createTransportChangeEvent($transport);
$plugin->beforeTransportStarted($evt);
}
public function testPluginCanBindToSpecificTransport()
{
- $connection = $this->_createConnection();
+ $connection = $this->createConnection();
$connection->expects($this->once())
->method('connect');
- $smtp = $this->_createTransport();
+ $smtp = $this->createTransport();
- $plugin = $this->_createPlugin('pop.host.tld', 110);
+ $plugin = $this->createPlugin('pop.host.tld', 110);
$plugin->setConnection($connection);
$plugin->bindSmtp($smtp);
- $evt = $this->_createTransportChangeEvent($smtp);
+ $evt = $this->createTransportChangeEvent($smtp);
$plugin->beforeTransportStarted($evt);
}
- private function _createTransport()
+ private function createTransport()
{
return $this->getMockBuilder('Swift_Transport')->getMock();
}
- private function _createTransportChangeEvent($transport)
+ private function createTransportChangeEvent($transport)
{
$evt = $this->getMockBuilder('Swift_Events_TransportChangeEvent')
->disableOriginalConstructor()
@@ -89,12 +89,12 @@ class Swift_Plugins_PopBeforeSmtpPluginTest extends \PHPUnit_Framework_TestCase
return $evt;
}
- public function _createConnection()
+ public function createConnection()
{
return $this->getMockBuilder('Swift_Plugins_Pop_Pop3Connection')->getMock();
}
- public function _createPlugin($host, $port, $crypto = null)
+ public function createPlugin($host, $port, $crypto = null)
{
return new Swift_Plugins_PopBeforeSmtpPlugin($host, $port, $crypto);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php
index bfd5669c83..0ad638670c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Plugins_RedirectingPluginTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_RedirectingPluginTest extends \PHPUnit\Framework\TestCase
{
public function testRecipientCanBeSetAndFetched()
{
@@ -12,33 +12,33 @@ class Swift_Plugins_RedirectingPluginTest extends \PHPUnit_Framework_TestCase
public function testPluginChangesRecipients()
{
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('...')
- ->setFrom(array('john@example.com' => 'John Doe'))
- ->setTo($to = array(
+ ->setFrom(['john@example.com' => 'John Doe'])
+ ->setTo($to = [
'fabien-to@example.com' => 'Fabien (To)',
'chris-to@example.com' => 'Chris (To)',
- ))
- ->setCc($cc = array(
+ ])
+ ->setCc($cc = [
'fabien-cc@example.com' => 'Fabien (Cc)',
'chris-cc@example.com' => 'Chris (Cc)',
- ))
- ->setBcc($bcc = array(
+ ])
+ ->setBcc($bcc = [
'fabien-bcc@example.com' => 'Fabien (Bcc)',
'chris-bcc@example.com' => 'Chris (Bcc)',
- ))
+ ])
->setBody('...')
;
$plugin = new Swift_Plugins_RedirectingPlugin('god@example.com');
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
- $this->assertEquals($message->getTo(), array('god@example.com' => ''));
- $this->assertEquals($message->getCc(), array());
- $this->assertEquals($message->getBcc(), array());
+ $this->assertEquals($message->getTo(), ['god@example.com' => '']);
+ $this->assertEquals($message->getCc(), []);
+ $this->assertEquals($message->getBcc(), []);
$plugin->sendPerformed($evt);
@@ -49,75 +49,75 @@ class Swift_Plugins_RedirectingPluginTest extends \PHPUnit_Framework_TestCase
public function testPluginRespectsUnsetToList()
{
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('...')
- ->setFrom(array('john@example.com' => 'John Doe'))
- ->setCc($cc = array(
+ ->setFrom(['john@example.com' => 'John Doe'])
+ ->setCc($cc = [
'fabien-cc@example.com' => 'Fabien (Cc)',
'chris-cc@example.com' => 'Chris (Cc)',
- ))
- ->setBcc($bcc = array(
+ ])
+ ->setBcc($bcc = [
'fabien-bcc@example.com' => 'Fabien (Bcc)',
'chris-bcc@example.com' => 'Chris (Bcc)',
- ))
+ ])
->setBody('...')
;
$plugin = new Swift_Plugins_RedirectingPlugin('god@example.com');
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
- $this->assertEquals($message->getTo(), array('god@example.com' => ''));
- $this->assertEquals($message->getCc(), array());
- $this->assertEquals($message->getBcc(), array());
+ $this->assertEquals($message->getTo(), ['god@example.com' => '']);
+ $this->assertEquals($message->getCc(), []);
+ $this->assertEquals($message->getBcc(), []);
$plugin->sendPerformed($evt);
- $this->assertEquals($message->getTo(), array());
+ $this->assertEquals($message->getTo(), []);
$this->assertEquals($message->getCc(), $cc);
$this->assertEquals($message->getBcc(), $bcc);
}
public function testPluginRespectsAWhitelistOfPatterns()
{
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('...')
- ->setFrom(array('john@example.com' => 'John Doe'))
- ->setTo($to = array(
+ ->setFrom(['john@example.com' => 'John Doe'])
+ ->setTo($to = [
'fabien-to@example.com' => 'Fabien (To)',
'chris-to@example.com' => 'Chris (To)',
'lars-to@internal.com' => 'Lars (To)',
- ))
- ->setCc($cc = array(
+ ])
+ ->setCc($cc = [
'fabien-cc@example.com' => 'Fabien (Cc)',
'chris-cc@example.com' => 'Chris (Cc)',
'lars-cc@internal.org' => 'Lars (Cc)',
- ))
- ->setBcc($bcc = array(
+ ])
+ ->setBcc($bcc = [
'fabien-bcc@example.com' => 'Fabien (Bcc)',
'chris-bcc@example.com' => 'Chris (Bcc)',
'john-bcc@example.org' => 'John (Bcc)',
- ))
+ ])
->setBody('...')
;
$recipient = 'god@example.com';
- $patterns = array('/^.*@internal.[a-z]+$/', '/^john-.*$/');
+ $patterns = ['/^.*@internal.[a-z]+$/', '/^john-.*$/'];
$plugin = new Swift_Plugins_RedirectingPlugin($recipient, $patterns);
$this->assertEquals($recipient, $plugin->getRecipient());
$this->assertEquals($plugin->getWhitelist(), $patterns);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
- $this->assertEquals($message->getTo(), array('lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null));
- $this->assertEquals($message->getCc(), array('lars-cc@internal.org' => 'Lars (Cc)'));
- $this->assertEquals($message->getBcc(), array('john-bcc@example.org' => 'John (Bcc)'));
+ $this->assertEquals($message->getTo(), ['lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null]);
+ $this->assertEquals($message->getCc(), ['lars-cc@internal.org' => 'Lars (Cc)']);
+ $this->assertEquals($message->getBcc(), ['john-bcc@example.org' => 'John (Bcc)']);
$plugin->sendPerformed($evt);
@@ -128,48 +128,48 @@ class Swift_Plugins_RedirectingPluginTest extends \PHPUnit_Framework_TestCase
public function testArrayOfRecipientsCanBeExplicitlyDefined()
{
- $message = Swift_Message::newInstance()
+ $message = (new Swift_Message())
->setSubject('...')
- ->setFrom(array('john@example.com' => 'John Doe'))
- ->setTo(array(
+ ->setFrom(['john@example.com' => 'John Doe'])
+ ->setTo([
'fabien@example.com' => 'Fabien',
'chris@example.com' => 'Chris (To)',
'lars-to@internal.com' => 'Lars (To)',
- ))
- ->setCc(array(
+ ])
+ ->setCc([
'fabien@example.com' => 'Fabien',
'chris-cc@example.com' => 'Chris (Cc)',
'lars-cc@internal.org' => 'Lars (Cc)',
- ))
- ->setBcc(array(
+ ])
+ ->setBcc([
'fabien@example.com' => 'Fabien',
'chris-bcc@example.com' => 'Chris (Bcc)',
'john-bcc@example.org' => 'John (Bcc)',
- ))
+ ])
->setBody('...')
;
- $recipients = array('god@example.com', 'fabien@example.com');
- $patterns = array('/^.*@internal.[a-z]+$/');
+ $recipients = ['god@example.com', 'fabien@example.com'];
+ $patterns = ['/^.*@internal.[a-z]+$/'];
$plugin = new Swift_Plugins_RedirectingPlugin($recipients, $patterns);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
$plugin->beforeSendPerformed($evt);
$this->assertEquals(
$message->getTo(),
- array('fabien@example.com' => 'Fabien', 'lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null)
+ ['fabien@example.com' => 'Fabien', 'lars-to@internal.com' => 'Lars (To)', 'god@example.com' => null]
);
$this->assertEquals(
$message->getCc(),
- array('fabien@example.com' => 'Fabien', 'lars-cc@internal.org' => 'Lars (Cc)')
+ ['fabien@example.com' => 'Fabien', 'lars-cc@internal.org' => 'Lars (Cc)']
);
- $this->assertEquals($message->getBcc(), array('fabien@example.com' => 'Fabien'));
+ $this->assertEquals($message->getBcc(), ['fabien@example.com' => 'Fabien']);
}
- private function _createSendEvent(Swift_Mime_Message $message)
+ private function createSendEvent(Swift_Mime_SimpleMessage $message)
{
$evt = $this->getMockBuilder('Swift_Events_SendEvent')
->disableOriginalConstructor()
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php
index 5ba5d5cc1e..19238f837f 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php
@@ -4,13 +4,13 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase
{
public function testReportingPasses()
{
- $message = $this->_createMessage();
- $evt = $this->_createSendEvent();
- $reporter = $this->_createReporter();
+ $message = $this->createMessage();
+ $evt = $this->createSendEvent();
+ $reporter = $this->createReporter();
- $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));
+ $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(['foo@bar.tld' => 'Foo']);
$evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);
- $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array());
+ $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn([]);
$reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);
$plugin = new Swift_Plugins_ReporterPlugin($reporter);
@@ -19,13 +19,13 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase
public function testReportingFailedTo()
{
- $message = $this->_createMessage();
- $evt = $this->_createSendEvent();
- $reporter = $this->_createReporter();
+ $message = $this->createMessage();
+ $evt = $this->createSendEvent();
+ $reporter = $this->createReporter();
- $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo', 'zip@button' => 'Zip'));
+ $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(['foo@bar.tld' => 'Foo', 'zip@button' => 'Zip']);
$evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);
- $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));
+ $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(['zip@button']);
$reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);
$reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);
@@ -35,14 +35,14 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase
public function testReportingFailedCc()
{
- $message = $this->_createMessage();
- $evt = $this->_createSendEvent();
- $reporter = $this->_createReporter();
+ $message = $this->createMessage();
+ $evt = $this->createSendEvent();
+ $reporter = $this->createReporter();
- $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));
- $message->shouldReceive('getCc')->zeroOrMoreTimes()->andReturn(array('zip@button' => 'Zip', 'test@test.com' => 'Test'));
+ $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(['foo@bar.tld' => 'Foo']);
+ $message->shouldReceive('getCc')->zeroOrMoreTimes()->andReturn(['zip@button' => 'Zip', 'test@test.com' => 'Test']);
$evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);
- $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));
+ $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(['zip@button']);
$reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);
$reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);
$reporter->shouldReceive('notify')->once()->with($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS);
@@ -53,14 +53,14 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase
public function testReportingFailedBcc()
{
- $message = $this->_createMessage();
- $evt = $this->_createSendEvent();
- $reporter = $this->_createReporter();
+ $message = $this->createMessage();
+ $evt = $this->createSendEvent();
+ $reporter = $this->createReporter();
- $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar.tld' => 'Foo'));
- $message->shouldReceive('getBcc')->zeroOrMoreTimes()->andReturn(array('zip@button' => 'Zip', 'test@test.com' => 'Test'));
+ $message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(['foo@bar.tld' => 'Foo']);
+ $message->shouldReceive('getBcc')->zeroOrMoreTimes()->andReturn(['zip@button' => 'Zip', 'test@test.com' => 'Test']);
$evt->shouldReceive('getMessage')->zeroOrMoreTimes()->andReturn($message);
- $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(array('zip@button'));
+ $evt->shouldReceive('getFailedRecipients')->zeroOrMoreTimes()->andReturn(['zip@button']);
$reporter->shouldReceive('notify')->once()->with($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS);
$reporter->shouldReceive('notify')->once()->with($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL);
$reporter->shouldReceive('notify')->once()->with($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS);
@@ -69,17 +69,17 @@ class Swift_Plugins_ReporterPluginTest extends \SwiftMailerTestCase
$plugin->sendPerformed($evt);
}
- private function _createMessage()
+ private function createMessage()
{
- return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
+ return $this->getMockery('Swift_Mime_SimpleMessage')->shouldIgnoreMissing();
}
- private function _createSendEvent()
+ private function createSendEvent()
{
return $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
}
- private function _createReporter()
+ private function createReporter()
{
return $this->getMockery('Swift_Plugins_Reporter')->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 20aae5716d..d5a1c9ce94 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
@@ -1,64 +1,64 @@
<?php
-class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_Reporters_HitReporterTest extends \PHPUnit\Framework\TestCase
{
- private $_hitReporter;
- private $_message;
+ private $hitReporter;
+ private $message;
protected function setUp()
{
- $this->_hitReporter = new Swift_Plugins_Reporters_HitReporter();
- $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ $this->hitReporter = new Swift_Plugins_Reporters_HitReporter();
+ $this->message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
}
public function testReportingFail()
{
- $this->_hitReporter->notify($this->_message, 'foo@bar.tld',
+ $this->hitReporter->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->assertEquals(array('foo@bar.tld'),
- $this->_hitReporter->getFailedRecipients()
+ $this->assertEquals(['foo@bar.tld'],
+ $this->hitReporter->getFailedRecipients()
);
}
public function testMultipleReports()
{
- $this->_hitReporter->notify($this->_message, 'foo@bar.tld',
+ $this->hitReporter->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->_hitReporter->notify($this->_message, 'zip@button',
+ $this->hitReporter->notify($this->message, 'zip@button',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->assertEquals(array('foo@bar.tld', 'zip@button'),
- $this->_hitReporter->getFailedRecipients()
+ $this->assertEquals(['foo@bar.tld', 'zip@button'],
+ $this->hitReporter->getFailedRecipients()
);
}
public function testReportingPassIsIgnored()
{
- $this->_hitReporter->notify($this->_message, 'foo@bar.tld',
+ $this->hitReporter->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->_hitReporter->notify($this->_message, 'zip@button',
+ $this->hitReporter->notify($this->message, 'zip@button',
Swift_Plugins_Reporter::RESULT_PASS
);
- $this->assertEquals(array('foo@bar.tld'),
- $this->_hitReporter->getFailedRecipients()
+ $this->assertEquals(['foo@bar.tld'],
+ $this->hitReporter->getFailedRecipients()
);
}
public function testBufferCanBeCleared()
{
- $this->_hitReporter->notify($this->_message, 'foo@bar.tld',
+ $this->hitReporter->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->_hitReporter->notify($this->_message, 'zip@button',
+ $this->hitReporter->notify($this->message, 'zip@button',
Swift_Plugins_Reporter::RESULT_FAIL
);
- $this->assertEquals(array('foo@bar.tld', 'zip@button'),
- $this->_hitReporter->getFailedRecipients()
+ $this->assertEquals(['foo@bar.tld', 'zip@button'],
+ $this->hitReporter->getFailedRecipients()
);
- $this->_hitReporter->clear();
- $this->assertEquals(array(), $this->_hitReporter->getFailedRecipients());
+ $this->hitReporter->clear();
+ $this->assertEquals([], $this->hitReporter->getFailedRecipients());
}
}
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 fb0bc975cb..6b86cfe24d 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
@@ -1,20 +1,20 @@
<?php
-class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit_Framework_TestCase
+class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit\Framework\TestCase
{
- private $_html;
- private $_message;
+ private $html;
+ private $message;
protected function setUp()
{
- $this->_html = new Swift_Plugins_Reporters_HtmlReporter();
- $this->_message = $this->getMockBuilder('Swift_Mime_Message')->getMock();
+ $this->html = new Swift_Plugins_Reporters_HtmlReporter();
+ $this->message = $this->getMockBuilder('Swift_Mime_SimpleMessage')->disableOriginalConstructor()->getMock();
}
public function testReportingPass()
{
ob_start();
- $this->_html->notify($this->_message, 'foo@bar.tld',
+ $this->html->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_PASS
);
$html = ob_get_clean();
@@ -26,7 +26,7 @@ class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit_Framework_TestCa
public function testReportingFail()
{
ob_start();
- $this->_html->notify($this->_message, 'zip@button',
+ $this->html->notify($this->message, 'zip@button',
Swift_Plugins_Reporter::RESULT_FAIL
);
$html = ob_get_clean();
@@ -38,10 +38,10 @@ class Swift_Plugins_Reporters_HtmlReporterTest extends \PHPUnit_Framework_TestCa
public function testMultipleReports()
{
ob_start();
- $this->_html->notify($this->_message, 'foo@bar.tld',
+ $this->html->notify($this->message, 'foo@bar.tld',
Swift_Plugins_Reporter::RESULT_PASS
);
- $this->_html->notify($this->_message, 'zip@button',
+ $this->html->notify($this->message, 'zip@button',
Swift_Plugins_Reporter::RESULT_FAIL
);
$html = ob_get_clean();
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php
index 309f5063ca..e35dcc8dcd 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php
@@ -4,8 +4,8 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
{
public function testBytesPerMinuteThrottling()
{
- $sleeper = $this->_createSleeper();
- $timer = $this->_createTimer();
+ $sleeper = $this->createSleeper();
+ $timer = $this->createTimer();
//10MB/min
$plugin = new Swift_Plugins_ThrottlerPlugin(
@@ -25,9 +25,9 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
// .: (10,000,000/100,000)/60 emails per second = 1.667 emais/sec
- $message = $this->_createMessageWithByteCount(100000); //100KB
+ $message = $this->createMessageWithByteCount(100000); //100KB
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
for ($i = 0; $i < 5; ++$i) {
$plugin->beforeSendPerformed($evt);
@@ -37,8 +37,8 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
public function testMessagesPerMinuteThrottling()
{
- $sleeper = $this->_createSleeper();
- $timer = $this->_createTimer();
+ $sleeper = $this->createSleeper();
+ $timer = $this->createTimer();
//60/min
$plugin = new Swift_Plugins_ThrottlerPlugin(
@@ -56,9 +56,9 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
//60 messages per minute
//1 message per second
- $message = $this->_createMessageWithByteCount(10);
+ $message = $this->createMessageWithByteCount(10);
- $evt = $this->_createSendEvent($message);
+ $evt = $this->createSendEvent($message);
for ($i = 0; $i < 5; ++$i) {
$plugin->beforeSendPerformed($evt);
@@ -66,19 +66,19 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
}
}
- private function _createSleeper()
+ private function createSleeper()
{
return $this->getMockery('Swift_Plugins_Sleeper');
}
- private function _createTimer()
+ private function createTimer()
{
return $this->getMockery('Swift_Plugins_Timer');
}
- private function _createMessageWithByteCount($bytes)
+ private function createMessageWithByteCount($bytes)
{
- $msg = $this->getMockery('Swift_Mime_Message');
+ $msg = $this->getMockery('Swift_Mime_SimpleMessage');
$msg->shouldReceive('toByteStream')
->zeroOrMoreTimes()
->andReturnUsing(function ($is) use ($bytes) {
@@ -90,7 +90,7 @@ class Swift_Plugins_ThrottlerPluginTest extends \SwiftMailerTestCase
return $msg;
}
- private function _createSendEvent($message)
+ private function createSendEvent($message)
{
$evt = $this->getMockery('Swift_Events_SendEvent');
$evt->shouldReceive('getMessage')
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php
index 5eda223250..1d5f957fa2 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/DKIMSignerTest.php
@@ -1,17 +1,12 @@
<?php
+use Egulias\EmailValidator\EmailValidator;
+
class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
{
- protected function setUp()
- {
- if (PHP_VERSION_ID < 50400 && !defined('OPENSSL_ALGO_SHA256')) {
- $this->markTestSkipped('skipping because of https://bugs.php.net/bug.php?id=61421');
- }
- }
-
public function testBasicSigningHeaderManipulation()
{
- $headers = $this->_createHeaders();
+ $headers = $this->createHeaders();
$messageContent = 'Hello World';
$signer = new Swift_Signers_DKIMSigner(file_get_contents(dirname(dirname(dirname(__DIR__))).'/_samples/dkim/dkim.test.priv'), 'dummy.nxdomain.be', 'dummySelector');
/* @var $signer Swift_Signers_HeaderSigner */
@@ -30,13 +25,13 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
// SHA1 Signing
public function testSigningSHA1()
{
- $headerSet = $this->_createHeaderSet();
+ $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);
+ $this->assertEquals(['DKIM-Signature'], $altered);
$signer->reset();
$signer->setHeaders($headerSet);
$this->assertFalse($headerSet->has('DKIM-Signature'));
@@ -53,13 +48,13 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
// SHA256 Signing
public function testSigning256()
{
- $headerSet = $this->_createHeaderSet();
+ $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-sha256');
$signer->setSignatureTimestamp('1299879181');
$altered = $signer->getAlteredHeaders();
- $this->assertEquals(array('DKIM-Signature'), $altered);
+ $this->assertEquals(['DKIM-Signature'], $altered);
$signer->reset();
$signer->setHeaders($headerSet);
$this->assertFalse($headerSet->has('DKIM-Signature'));
@@ -76,7 +71,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
// Relaxed/Relaxed Hash Signing
public function testSigningRelaxedRelaxed256()
{
- $headerSet = $this->_createHeaderSet();
+ $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-sha256');
@@ -84,7 +79,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$signer->setBodyCanon('relaxed');
$signer->setHeaderCanon('relaxed');
$altered = $signer->getAlteredHeaders();
- $this->assertEquals(array('DKIM-Signature'), $altered);
+ $this->assertEquals(['DKIM-Signature'], $altered);
$signer->reset();
$signer->setHeaders($headerSet);
$this->assertFalse($headerSet->has('DKIM-Signature'));
@@ -101,14 +96,14 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
// Relaxed/Simple Hash Signing
public function testSigningRelaxedSimple256()
{
- $headerSet = $this->_createHeaderSet();
+ $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-sha256');
$signer->setSignatureTimestamp('1299879181');
$signer->setHeaderCanon('relaxed');
$altered = $signer->getAlteredHeaders();
- $this->assertEquals(array('DKIM-Signature'), $altered);
+ $this->assertEquals(['DKIM-Signature'], $altered);
$signer->reset();
$signer->setHeaders($headerSet);
$this->assertFalse($headerSet->has('DKIM-Signature'));
@@ -125,14 +120,14 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
// Simple/Relaxed Hash Signing
public function testSigningSimpleRelaxed256()
{
- $headerSet = $this->_createHeaderSet();
+ $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-sha256');
$signer->setSignatureTimestamp('1299879181');
$signer->setBodyCanon('relaxed');
$altered = $signer->getAlteredHeaders();
- $this->assertEquals(array('DKIM-Signature'), $altered);
+ $this->assertEquals(['DKIM-Signature'], $altered);
$signer->reset();
$signer->setHeaders($headerSet);
$this->assertFalse($headerSet->has('DKIM-Signature'));
@@ -146,7 +141,7 @@ 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=');
}
- private function _createHeaderSet()
+ private function createHeaderSet()
{
$cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream());
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
@@ -154,8 +149,8 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
- $grammar = new Swift_Mime_Grammar();
- $headers = new Swift_Mime_SimpleHeaderSet(new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar));
+ $emailValidator = new EmailValidator();
+ $headers = new Swift_Mime_SimpleHeaderSet(new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator));
return $headers;
}
@@ -163,7 +158,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
/**
* @return Swift_Mime_Headers
*/
- private function _createHeaders()
+ private function createHeaders()
{
$x = 0;
$cache = new Swift_KeyCache_ArrayKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream());
@@ -172,13 +167,13 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
$paramEncoder = new Swift_Encoder_Rfc2231Encoder(new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'));
- $grammar = new Swift_Mime_Grammar();
- $headerFactory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar);
- $headers = $this->getMockery('Swift_Mime_HeaderSet');
+ $emailValidator = new EmailValidator();
+ $headerFactory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $emailValidator);
+ $headers = $this->getMockery('Swift_Mime_SimpleHeaderSet');
$headers->shouldReceive('listAll')
->zeroOrMoreTimes()
- ->andReturn(array('From', 'To', 'Date', 'Subject'));
+ ->andReturn(['From', 'To', 'Date', 'Subject']);
$headers->shouldReceive('has')
->zeroOrMoreTimes()
->with('From')
@@ -186,7 +181,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headers->shouldReceive('getAll')
->zeroOrMoreTimes()
->with('From')
- ->andReturn(array($headerFactory->createMailboxHeader('From', 'test@test.test')));
+ ->andReturn([$headerFactory->createMailboxHeader('From', 'test@test.test')]);
$headers->shouldReceive('has')
->zeroOrMoreTimes()
->with('To')
@@ -194,7 +189,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headers->shouldReceive('getAll')
->zeroOrMoreTimes()
->with('To')
- ->andReturn(array($headerFactory->createMailboxHeader('To', 'test@test.test')));
+ ->andReturn([$headerFactory->createMailboxHeader('To', 'test@test.test')]);
$headers->shouldReceive('has')
->zeroOrMoreTimes()
->with('Date')
@@ -202,7 +197,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headers->shouldReceive('getAll')
->zeroOrMoreTimes()
->with('Date')
- ->andReturn(array($headerFactory->createTextHeader('Date', 'Fri, 11 Mar 2011 20:56:12 +0000 (GMT)')));
+ ->andReturn([$headerFactory->createTextHeader('Date', 'Fri, 11 Mar 2011 20:56:12 +0000 (GMT)')]);
$headers->shouldReceive('has')
->zeroOrMoreTimes()
->with('Subject')
@@ -210,7 +205,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headers->shouldReceive('getAll')
->zeroOrMoreTimes()
->with('Subject')
- ->andReturn(array($headerFactory->createTextHeader('Subject', 'Foo Bar Text Message')));
+ ->andReturn([$headerFactory->createTextHeader('Subject', 'Foo Bar Text Message')]);
$headers->shouldReceive('addTextHeader')
->zeroOrMoreTimes()
->with('DKIM-Signature', \Mockery::any())
@@ -218,7 +213,7 @@ class Swift_Signers_DKIMSignerTest extends \SwiftMailerTestCase
$headers->shouldReceive('getAll')
->zeroOrMoreTimes()
->with('DKIM-Signature')
- ->andReturn(array($headerFactory->createTextHeader('DKIM-Signature', 'Foo Bar Text Message')));
+ ->andReturn([$headerFactory->createTextHeader('DKIM-Signature', 'Foo Bar Text Message')]);
return $headers;
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php
index 5069c1f584..932e486286 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Signers/SMimeSignerTest.php
@@ -1,6 +1,6 @@
<?php
-class Swift_Signers_SMimeSignerTest extends \PHPUnit_Framework_TestCase
+class Swift_Signers_SMimeSignerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Swift_StreamFilters_StringReplacementFilterFactory
@@ -17,21 +17,21 @@ class Swift_Signers_SMimeSignerTest extends \PHPUnit_Framework_TestCase
$this->samplesDir = str_replace('\\', '/', realpath(__DIR__.'/../../../_samples/')).'/';
}
- public function testUnSingedMessage()
+ public function testUnSignedMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$this->assertEquals('Here is the message itself', $message->getBody());
}
- public function testSingedMessage()
+ public function testSignedMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$signer = new Swift_Signers_SMimeSigner();
@@ -70,11 +70,66 @@ OEL;
unset($messageStream);
}
- public function testSingedMessageExtraCerts()
+ public function testSignedMessageWithFullyWrappedMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Middle-out compression secrets'))
+ ->setFrom(['richard@piedpiper.com' => 'Richard Hendricks'])
+ ->setTo(['jared@piedpiper.com' => 'Jared Dunn'])
+ ->setBody('Here goes the entire algorithm...');
+
+ $signer = new Swift_Signers_SMimeSigner();
+ $signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');
+
+ // Tell the signer to wrap the full MIME message
+ $signer->setWrapFullMessage(true);
+ $message->attachSigner($signer);
+
+ $messageStream = $this->newFilteredStream();
+ $message->toByteStream($messageStream);
+ $messageStream->commit();
+
+ $entityString = $messageStream->getContent();
+ $headers = self::getHeadersOfMessage($entityString);
+
+ if (!($boundary = $this->getBoundary($headers['content-type']))) {
+ return false;
+ }
+
+ $expectedBody = <<<OEL
+This is an S/MIME signed message
+
+--$boundary
+Content-Type: message/rfc822; charset=utf-8
+Content-Transfer-Encoding: 7bit
+
+Message-ID: <[a-f0-9]+@swift.generated>
+Date: .*
+Subject: Middle-out compression secrets
+From: Richard Hendricks <richard@piedpiper.com>
+To: Jared Dunn <jared@piedpiper.com>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: quoted-printable
+
+Here goes the entire algorithm...
+--$boundary
+Content-Type: application/(x\-)?pkcs7-signature; name="smime\.p7s"
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="smime\.p7s"
+
+(?:^[a-zA-Z0-9\/\\r\\n+]*={0,2})
+
+--$boundary--
+OEL;
+ $this->assertValidVerify($expectedBody, $messageStream);
+ unset($messageStream);
+ }
+
+ public function testSignedMessageExtraCerts()
+ {
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$signer = new Swift_Signers_SMimeSigner();
@@ -113,11 +168,11 @@ OEL;
unset($messageStream);
}
- public function testSingedMessageBinary()
+ public function testSignedMessageBinary()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$signer = new Swift_Signers_SMimeSigner();
@@ -148,11 +203,11 @@ OEL;
unset($messageStreamClean, $messageStream);
}
- public function testSingedMessageWithAttachments()
+ public function testSignedMessageWithAttachments()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$message->attach(Swift_Attachment::fromPath($this->samplesDir.'/files/textfile.zip'));
@@ -214,9 +269,9 @@ OEL;
public function testEncryptedMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$originalMessage = $this->cleanMessage($message->toString());
@@ -242,7 +297,7 @@ OEL;
$decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {
+ if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', ['file://'.$this->samplesDir.'smime/encrypt.key', 'swift'])) {
$this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
}
@@ -250,17 +305,62 @@ OEL;
unset($decryptedMessageStream, $messageStream);
}
+ public function testEncryptedMessageWithFullyWrappedMessage()
+ {
+ $message = (new Swift_Message('Middle-out compression secrets'))
+ ->setFrom(['richard@piedpiper.com' => 'Richard Hendricks'])
+ ->setTo(['jared@piedpiper.com' => 'Jared Dunn'])
+ ->setBody('Here goes the entire algorithm...');
+
+ $originalMessage = $message->toString();
+
+ $signer = new Swift_Signers_SMimeSigner();
+ $signer->setEncryptCertificate($this->samplesDir.'smime/encrypt.crt');
+ $signer->setWrapFullMessage(true);
+ $message->attachSigner($signer);
+
+ $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
+ $message->toByteStream($messageStream);
+ $messageStream->commit();
+
+ $entityString = $messageStream->getContent();
+ $headers = self::getHeadersOfMessage($entityString);
+
+ if (!preg_match('#^application/(x\-)?pkcs7-mime; smime-type=enveloped\-data;#', $headers['content-type'])) {
+ $this->fail('Content-type does not match.');
+
+ return false;
+ }
+
+ $expectedBody = '(?:^[a-zA-Z0-9\/\\r\\n+]*={0,2})';
+
+ $decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
+
+ if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', ['file://'.$this->samplesDir.'smime/encrypt.key', 'swift'])) {
+ $this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
+ }
+
+ $decryptedMessage = $decryptedMessageStream->getContent();
+ $decryptedHeaders = self::getHeadersOfMessage($decryptedMessage);
+ $this->assertEquals('message/rfc822; charset=utf-8', $decryptedHeaders['content-type']);
+ $this->assertEquals('7bit', $decryptedHeaders['content-transfer-encoding']);
+
+ $decryptedMessageBody = self::getBodyOfMessage($decryptedMessage);
+ $this->assertEquals($originalMessage, $decryptedMessageBody);
+ unset($decryptedMessageStream, $messageStream);
+ }
+
public function testEncryptedMessageWithMultipleCerts()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$originalMessage = $this->cleanMessage($message->toString());
$signer = new Swift_Signers_SMimeSigner();
- $signer->setEncryptCertificate(array($this->samplesDir.'smime/encrypt.crt', $this->samplesDir.'smime/encrypt2.crt'));
+ $signer->setEncryptCertificate([$this->samplesDir.'smime/encrypt.crt', $this->samplesDir.'smime/encrypt2.crt']);
$message->attachSigner($signer);
$messageStream = new Swift_ByteStream_TemporaryFileByteStream();
@@ -280,7 +380,7 @@ OEL;
$decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {
+ if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', ['file://'.$this->samplesDir.'smime/encrypt.key', 'swift'])) {
$this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
}
@@ -289,7 +389,7 @@ OEL;
$decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt2.crt', array('file://'.$this->samplesDir.'smime/encrypt2.key', 'swift'))) {
+ if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt2.crt', ['file://'.$this->samplesDir.'smime/encrypt2.key', 'swift'])) {
$this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
}
@@ -299,9 +399,9 @@ OEL;
public function testSignThenEncryptedMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
$signer = new Swift_Signers_SMimeSigner();
@@ -326,7 +426,7 @@ OEL;
$decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {
+ if (!openssl_pkcs7_decrypt($messageStream->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', ['file://'.$this->samplesDir.'smime/encrypt.key', 'swift'])) {
$this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
}
@@ -364,14 +464,14 @@ OEL;
public function testEncryptThenSignMessage()
{
- $message = Swift_SignedMessage::newInstance('Wonderful Subject')
- ->setFrom(array('john@doe.com' => 'John Doe'))
- ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
+ $message = (new Swift_Message('Wonderful Subject'))
+ ->setFrom(['john@doe.com' => 'John Doe'])
+ ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
- $originalMessage = $this->cleanMessage($message->toString());
+ $originalMessage = $message->toString();
- $signer = Swift_Signers_SMimeSigner::newInstance();
+ $signer = new Swift_Signers_SMimeSigner();
$signer->setSignCertificate($this->samplesDir.'smime/sign.crt', $this->samplesDir.'smime/sign.key');
$signer->setEncryptCertificate($this->samplesDir.'smime/encrypt.crt');
$signer->setSignThenEncrypt(false);
@@ -392,10 +492,10 @@ OEL;
This is an S/MIME signed message
--$boundary
-(?P<encrypted_message>MIME-Version: 1\.0
-Content-Disposition: attachment; filename="smime\.p7m"
-Content-Type: application/(x\-)?pkcs7-mime; smime-type=enveloped-data; name="smime\.p7m"
+(?P<encrypted_message>Content-Type: application/(x\-)?pkcs7-mime; smime-type=enveloped-data;
+ name="smime\.p7m"; charset=utf-8
Content-Transfer-Encoding: base64
+Content-Disposition: attachment; filename="smime\.p7m"
(?:^[a-zA-Z0-9\/\\r\\n+]*={0,2})
@@ -426,7 +526,7 @@ OEL;
$decryptedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
- if (!openssl_pkcs7_decrypt($messageStreamClean->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', array('file://'.$this->samplesDir.'smime/encrypt.key', 'swift'))) {
+ if (!openssl_pkcs7_decrypt($messageStreamClean->getPath(), $decryptedMessageStream->getPath(), 'file://'.$this->samplesDir.'smime/encrypt.crt', ['file://'.$this->samplesDir.'smime/encrypt.key', 'swift'])) {
$this->fail(sprintf('Decrypt of the message failed. Internal error "%s".', openssl_error_string()));
}
@@ -441,13 +541,13 @@ OEL;
// File is UNIX encoded so convert them to correct line ending
$expected = str_replace("\n", "\r\n", $expected);
- $actual = trim(self::getBodyOfMessage($actual));
+ $actual = self::getBodyOfMessage($actual);
if (!$this->assertRegExp('%^'.$expected.'$\s*%m', $actual)) {
return false;
}
$opensslOutput = new Swift_ByteStream_TemporaryFileByteStream();
- $verify = openssl_pkcs7_verify($messageStream->getPath(), null, $opensslOutput->getPath(), array($this->samplesDir.'smime/ca.crt'));
+ $verify = openssl_pkcs7_verify($messageStream->getPath(), null, $opensslOutput->getPath(), [$this->samplesDir.'smime/ca.crt']);
if (false === $verify) {
$this->fail('Verification of the message failed.');
@@ -484,14 +584,11 @@ OEL;
protected static function getBodyOfMessage($message)
{
- return substr($message, strpos($message, "\r\n\r\n"));
+ return trim(substr($message, strpos($message, "\r\n\r\n")));
}
/**
* Strips of the sender headers and Mime-Version.
- *
- * @param Swift_ByteStream_TemporaryFileByteStream $messageStream
- * @param Swift_ByteStream_TemporaryFileByteStream $inputStream
*/
protected function cleanMessage($content)
{
@@ -499,7 +596,7 @@ OEL;
$headers = self::getHeadersOfMessage($content);
foreach ($headers as $headerName => $value) {
- if (!in_array($headerName, array('content-type', 'content-transfer-encoding', 'content-disposition'))) {
+ if (!in_array($headerName, ['content-type', 'content-transfer-encoding', 'content-disposition'])) {
continue;
}
@@ -514,7 +611,7 @@ OEL;
$newContent .= "$headerName: $value\r\n";
}
- return $newContent."\r\n".ltrim(self::getBodyOfMessage($content));
+ return $newContent."\r\n".self::getBodyOfMessage($content);
}
/**
@@ -529,17 +626,19 @@ OEL;
protected static function getHeadersOfMessage($message)
{
$headersPosEnd = strpos($message, "\r\n\r\n");
- $headerData = substr($message, 0, $headersPosEnd);
+ $headerData = trim(substr($message, 0, $headersPosEnd));
$headerLines = explode("\r\n", $headerData);
+ $headers = [];
- if (empty($headerLines)) {
- return array();
+ if (false === $headerLines) {
+ return $headers;
}
- $headers = array();
-
+ // Transform header lines into an associative array
+ $currentHeaderName = '';
foreach ($headerLines as $headerLine) {
- if (ctype_space($headerLines[0]) || false === strpos($headerLine, ':')) {
+ // Handle headers that span multiple lines
+ if (false === strpos($headerLine, ':')) {
$headers[$currentHeaderName] .= ' '.trim($headerLine);
continue;
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php
index c85bdc1e98..3c812242ae 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php
@@ -1,20 +1,20 @@
<?php
-class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit_Framework_TestCase
+class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit\Framework\TestCase
{
public function testBasicReplacementsAreMade()
{
- $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64));
+ $filter = $this->createFilter([0x61, 0x62], [0x63, 0x64]);
$this->assertEquals(
- array(0x59, 0x60, 0x63, 0x64, 0x65),
- $filter->filter(array(0x59, 0x60, 0x61, 0x62, 0x65))
+ [0x59, 0x60, 0x63, 0x64, 0x65],
+ $filter->filter([0x59, 0x60, 0x61, 0x62, 0x65])
);
}
public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer()
{
- $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64));
- $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)),
+ $filter = $this->createFilter([0x61, 0x62], [0x63, 0x64]);
+ $this->assertTrue($filter->shouldBuffer([0x59, 0x60, 0x61]),
'%s: Filter should buffer since 0x61 0x62 is the needle and the ending '.
'0x61 could be from 0x61 0x62'
);
@@ -22,34 +22,34 @@ class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit_Framew
public function testFilterCanMakeMultipleReplacements()
{
- $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(0x63));
+ $filter = $this->createFilter([[0x61], [0x62]], [0x63]);
$this->assertEquals(
- array(0x60, 0x63, 0x60, 0x63, 0x60),
- $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60))
+ [0x60, 0x63, 0x60, 0x63, 0x60],
+ $filter->filter([0x60, 0x61, 0x60, 0x62, 0x60])
);
}
public function testMultipleReplacementsCanBeDifferent()
{
- $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(array(0x63), array(0x64)));
+ $filter = $this->createFilter([[0x61], [0x62]], [[0x63], [0x64]]);
$this->assertEquals(
- array(0x60, 0x63, 0x60, 0x64, 0x60),
- $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60))
+ [0x60, 0x63, 0x60, 0x64, 0x60],
+ $filter->filter([0x60, 0x61, 0x60, 0x62, 0x60])
);
}
public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString()
{
- $filter = $this->_createFilter(array(0x0D, 0x0A), array(0x0A));
- $this->assertFalse($filter->shouldBuffer(array(0x61, 0x62, 0x0D, 0x0A, 0x63)),
+ $filter = $this->createFilter([0x0D, 0x0A], [0x0A]);
+ $this->assertFalse($filter->shouldBuffer([0x61, 0x62, 0x0D, 0x0A, 0x63]),
'%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF'
);
}
public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString()
{
- $filter = $this->_createFilter(array(array(0x61, 0x62), array(0x63)), array(0x64));
- $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)),
+ $filter = $this->createFilter([[0x61, 0x62], [0x63]], [0x64]);
+ $this->assertTrue($filter->shouldBuffer([0x59, 0x60, 0x61]),
'%s: Filter should buffer since 0x61 0x62 is a needle and the ending '.
'0x61 could be from 0x61 0x62'
);
@@ -57,53 +57,53 @@ class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit_Framew
public function testConvertingAllLineEndingsToCRLFWhenInputIsLF()
{
- $filter = $this->_createFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ $filter = $this->createFilter(
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
);
$this->assertEquals(
- array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),
- $filter->filter(array(0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63))
+ [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63],
+ $filter->filter([0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63])
);
}
public function testConvertingAllLineEndingsToCRLFWhenInputIsCR()
{
- $filter = $this->_createFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ $filter = $this->createFilter(
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
);
$this->assertEquals(
- array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),
- $filter->filter(array(0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63))
+ [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63],
+ $filter->filter([0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63])
);
}
public function testConvertingAllLineEndingsToCRLFWhenInputIsCRLF()
{
- $filter = $this->_createFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ $filter = $this->createFilter(
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
);
$this->assertEquals(
- array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63),
- $filter->filter(array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63))
+ [0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63],
+ $filter->filter([0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63])
);
}
public function testConvertingAllLineEndingsToCRLFWhenInputIsLFCR()
{
- $filter = $this->_createFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ $filter = $this->createFilter(
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
);
$this->assertEquals(
- array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63),
- $filter->filter(array(0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63))
+ [0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63],
+ $filter->filter([0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63])
);
}
@@ -111,18 +111,18 @@ class Swift_StreamFilters_ByteArrayReplacementFilterTest extends \PHPUnit_Framew
{
//Lighthouse Bug #23
- $filter = $this->_createFilter(
- array(array(0x0D, 0x0A), array(0x0D), array(0x0A)),
- array(array(0x0A), array(0x0A), array(0x0D, 0x0A))
+ $filter = $this->createFilter(
+ [[0x0D, 0x0A], [0x0D], [0x0A]],
+ [[0x0A], [0x0A], [0x0D, 0x0A]]
);
$this->assertEquals(
- array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63),
- $filter->filter(array(0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63))
+ [0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63],
+ $filter->filter([0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63])
);
}
- private function _createFilter($search, $replace)
+ 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 c14d5dc759..514829f620 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php
@@ -1,10 +1,10 @@
<?php
-class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Framework_TestCase
+class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit\Framework\TestCase
{
public function testInstancesOfStringReplacementFilterAreCreated()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$this->assertInstanceOf(
'Swift_StreamFilters_StringReplacementFilter',
$factory->createFilter('a', 'b')
@@ -13,7 +13,7 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr
public function testSameInstancesAreCached()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$filter1 = $factory->createFilter('a', 'b');
$filter2 = $factory->createFilter('a', 'b');
$this->assertSame($filter1, $filter2, '%s: Instances should be cached');
@@ -21,7 +21,7 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr
public function testDifferingInstancesAreNotCached()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$filter1 = $factory->createFilter('a', 'b');
$filter2 = $factory->createFilter('a', 'c');
$this->assertNotEquals($filter1, $filter2,
@@ -29,7 +29,7 @@ class Swift_StreamFilters_StringReplacementFilterFactoryTest extends \PHPUnit_Fr
);
}
- private function _createFactory()
+ 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 681e235234..1a5f4dca72 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php
@@ -1,16 +1,16 @@
<?php
-class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit_Framework_TestCase
+class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit\Framework\TestCase
{
public function testBasicReplacementsAreMade()
{
- $filter = $this->_createFilter('foo', 'bar');
+ $filter = $this->createFilter('foo', 'bar');
$this->assertEquals('XbarYbarZ', $filter->filter('XfooYfooZ'));
}
public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer()
{
- $filter = $this->_createFilter('foo', 'bar');
+ $filter = $this->createFilter('foo', 'bar');
$this->assertTrue($filter->shouldBuffer('XfooYf'),
'%s: Filter should buffer since "foo" is the needle and the ending '.
'"f" could be from "foo"'
@@ -19,19 +19,19 @@ class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit_Framework
public function testFilterCanMakeMultipleReplacements()
{
- $filter = $this->_createFilter(array('a', 'b'), 'foo');
+ $filter = $this->createFilter(['a', 'b'], 'foo');
$this->assertEquals('XfooYfooZ', $filter->filter('XaYbZ'));
}
public function testMultipleReplacementsCanBeDifferent()
{
- $filter = $this->_createFilter(array('a', 'b'), array('foo', 'zip'));
+ $filter = $this->createFilter(['a', 'b'], ['foo', 'zip']);
$this->assertEquals('XfooYzipZ', $filter->filter('XaYbZ'));
}
public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString()
{
- $filter = $this->_createFilter("\r\n", "\n");
+ $filter = $this->createFilter("\r\n", "\n");
$this->assertFalse($filter->shouldBuffer("foo\r\nbar"),
'%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF'
);
@@ -39,7 +39,7 @@ class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit_Framework
public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString()
{
- $filter = $this->_createFilter(array('foo', 'zip'), 'bar');
+ $filter = $this->createFilter(['foo', 'zip'], 'bar');
$this->assertTrue($filter->shouldBuffer('XfooYzi'),
'%s: Filter should buffer since "zip" is a needle and the ending '.
'"zi" could be from "zip"'
@@ -48,11 +48,11 @@ class Swift_StreamFilters_StringReplacementFilterTest extends \PHPUnit_Framework
public function testShouldBufferReturnsFalseOnEmptyBuffer()
{
- $filter = $this->_createFilter("\r\n", "\n");
+ $filter = $this->createFilter("\r\n", "\n");
$this->assertFalse($filter->shouldBuffer(''));
}
- private function _createFilter($search, $replace)
+ private function createFilter($search, $replace)
{
return new Swift_StreamFilters_StringReplacementFilter($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 81bda4f0d4..896171dcd5 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php
@@ -6,10 +6,10 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
{
public function testRegisterPluginLoadsPluginInEventDispatcher()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$listener = $this->getMockery('Swift_Events_EventListener');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('bindEventListener')
->once()
->with($listener);
@@ -19,18 +19,18 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
public function testSendingDispatchesBeforeSendEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
- $message = $this->_createMessage();
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
+ $message = $this->createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('mark@swiftmailer.org' => 'Mark'));
+ ->andReturn(['mark@swiftmailer.org' => 'Mark']);
$dispatcher->shouldReceive('createSendEvent')
->once()
->andReturn($evt);
@@ -43,25 +43,25 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->zeroOrMoreTimes()
->andReturn(false);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(1, $smtp->send($message));
}
public function testSendingDispatchesSendEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
- $message = $this->_createMessage();
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
+ $message = $this->createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('mark@swiftmailer.org' => 'Mark'));
+ ->andReturn(['mark@swiftmailer.org' => 'Mark']);
$dispatcher->shouldReceive('createSendEvent')
->once()
->andReturn($evt);
@@ -74,25 +74,25 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->zeroOrMoreTimes()
->andReturn(false);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(1, $smtp->send($message));
}
public function testSendEventCapturesFailures()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
- $message = $this->_createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('mark@swiftmailer.org' => 'Mark'));
+ ->andReturn(['mark@swiftmailer.org' => 'Mark']);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<chris@swiftmailer.org>\r\n")
@@ -123,27 +123,27 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->andReturn(false);
$evt->shouldReceive('setFailedRecipients')
->once()
- ->with(array('mark@swiftmailer.org'));
+ ->with(['mark@swiftmailer.org']);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(0, $smtp->send($message));
}
public function testSendEventHasResultFailedIfAllFailures()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
- $message = $this->_createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('mark@swiftmailer.org' => 'Mark'));
+ ->andReturn(['mark@swiftmailer.org' => 'Mark']);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<chris@swiftmailer.org>\r\n")
@@ -176,28 +176,28 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->once()
->with(Swift_Events_SendEvent::RESULT_FAILED);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(0, $smtp->send($message));
}
public function testSendEventHasResultTentativeIfSomeFailures()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
- $message = $this->_createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'mark@swiftmailer.org' => 'Mark',
'chris@site.tld' => 'Chris',
- ));
+ ]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<chris@swiftmailer.org>\r\n")
@@ -230,28 +230,28 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->once()
->with(Swift_Events_SendEvent::RESULT_TENTATIVE);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(1, $smtp->send($message));
}
public function testSendEventHasResultSuccessIfNoFailures()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
- $message = $this->_createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'mark@swiftmailer.org' => 'Mark',
'chris@site.tld' => 'Chris',
- ));
+ ]);
$dispatcher->shouldReceive('createSendEvent')
->zeroOrMoreTimes()
->with($smtp, \Mockery::any())
@@ -268,25 +268,25 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->once()
->with(Swift_Events_SendEvent::RESULT_SUCCESS);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(2, $smtp->send($message));
}
public function testCancellingEventBubbleBeforeSendStopsEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_SendEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
- $message = $this->_createMessage();
+ $smtp = $this->getTransport($buf, $dispatcher);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('chris@swiftmailer.org' => null));
+ ->andReturn(['chris@swiftmailer.org' => null]);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('mark@swiftmailer.org' => 'Mark'));
+ ->andReturn(['mark@swiftmailer.org' => 'Mark']);
$dispatcher->shouldReceive('createSendEvent')
->zeroOrMoreTimes()
->with($smtp, \Mockery::any())
@@ -300,17 +300,17 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->andReturn(true);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(0, $smtp->send($message));
}
public function testStartingTransportDispatchesTransportChangeEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createTransportChangeEvent')
->atLeast()->once()
@@ -325,16 +325,16 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->andReturn(false);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
}
public function testStartingTransportDispatchesBeforeTransportChangeEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createTransportChangeEvent')
->atLeast()->once()
@@ -349,16 +349,16 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->andReturn(false);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
}
public function testCancellingBubbleBeforeTransportStartStopsEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createTransportChangeEvent')
->atLeast()->once()
@@ -373,7 +373,7 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->andReturn(true);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertFalse($smtp->isStarted(),
@@ -383,10 +383,10 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
public function testStoppingTransportDispatchesTransportChangeEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createTransportChangeEvent')
->atLeast()->once()
@@ -398,17 +398,17 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
$dispatcher->shouldReceive('dispatchEvent')
->zeroOrMoreTimes();
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->stop();
}
public function testStoppingTransportDispatchesBeforeTransportChangeEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent')->shouldIgnoreMissing();
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createTransportChangeEvent')
->atLeast()->once()
@@ -420,17 +420,17 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
$dispatcher->shouldReceive('dispatchEvent')
->zeroOrMoreTimes();
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->stop();
}
public function testCancellingBubbleBeforeTransportStoppedStopsEvent()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportChangeEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$hasRun = false;
$dispatcher->shouldReceive('createTransportChangeEvent')
@@ -451,7 +451,7 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
return $hasRun;
});
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->stop();
@@ -462,10 +462,10 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
public function testResponseEventsAreGenerated()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_ResponseEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createResponseEvent')
->atLeast()->once()
@@ -475,16 +475,16 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->with($evt, 'responseReceived');
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
}
public function testCommandEventsAreGenerated()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_CommandEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$dispatcher->shouldReceive('createCommandEvent')
->once()
@@ -494,16 +494,16 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->once()
->with($evt, 'commandSent');
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
}
public function testExceptionsCauseExceptionEvents()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportExceptionEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$buf->shouldReceive('readLine')
->atLeast()->once()
@@ -528,10 +528,10 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
public function testExceptionBubblesCanBeCancelled()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher(false);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher(false);
$evt = $this->getMockery('Swift_Events_TransportExceptionEvent');
- $smtp = $this->_getTransport($buf, $dispatcher);
+ $smtp = $this->getTransport($buf, $dispatcher);
$buf->shouldReceive('readLine')
->atLeast()->once()
@@ -547,11 +547,11 @@ abstract class Swift_Transport_AbstractSmtpEventSupportTest extends Swift_Transp
->atLeast()->once()
->andReturn(true);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
}
- protected function _createEventDispatcher($stub = true)
+ protected function createEventDispatcher($stub = true)
{
return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing();
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php
index f49b489ed5..4c837fad51 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php
@@ -2,8 +2,7 @@
abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
{
- /** Abstract test method */
- abstract protected function _getTransport($buf);
+ abstract protected function getTransport($buf);
public function testStartAccepts220ServiceGreeting()
{
@@ -18,8 +17,8 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
E: 554
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('readLine')
@@ -27,7 +26,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(0)
->andReturn("220 some.server.tld bleh\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');
$smtp->start();
@@ -39,20 +38,20 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testBadGreetingCausesException()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('readLine')
->once()
->with(0)
->andReturn("554 I'm busy\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');
$smtp->start();
$this->fail('554 greeting indicates an error and should cause an exception');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
$this->assertFalse($smtp->isStarted(), '%s: start() should have failed');
}
}
@@ -93,8 +92,8 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -104,14 +103,14 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->andReturn("220 some.server.tld bleh\r\n");
$buf->shouldReceive('write')
->once()
- ->with('~^HELO .*?\r\n$~D')
+ ->with('~^HELO example.org\r\n$~D')
->andReturn(1);
$buf->shouldReceive('readLine')
->once()
->with(1)
->andReturn('250 ServerName'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
} catch (Exception $e) {
@@ -121,8 +120,8 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testInvalidHeloResponseCausesException()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -132,19 +131,19 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->andReturn("220 some.server.tld bleh\r\n");
$buf->shouldReceive('write')
->once()
- ->with('~^HELO .*?\r\n$~D')
+ ->with('~^HELO example.org\r\n$~D')
->andReturn(1);
$buf->shouldReceive('readLine')
->once()
->with(1)
->andReturn('504 WTF'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');
$smtp->start();
$this->fail('Non 250 HELO response should raise Exception');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
$this->assertFalse($smtp->isStarted(), '%s: SMTP start() should have failed');
}
}
@@ -162,8 +161,8 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
identifying the client.
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -180,7 +179,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('250 ServerName'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->setLocalDomain('mydomain.com');
$smtp->start();
}
@@ -222,15 +221,15 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
E: 552, 451, 452, 550, 553, 503
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('write')
@@ -242,7 +241,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn("250 OK\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
@@ -253,16 +252,16 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testInvalidResponseCodeFromMailCausesException()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<me@domain.com>\r\n")
@@ -272,30 +271,30 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('553 Bad'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
$this->fail('MAIL FROM should accept a 250 response');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
}
}
public function testSenderIsPreferredOverFrom()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getSender')
->once()
- ->andReturn(array('another@domain.com' => 'Someone'));
+ ->andReturn(['another@domain.com' => 'Someone']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<another@domain.com>\r\n")
@@ -305,29 +304,29 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testReturnPathIsPreferredOverSender()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getSender')
->once()
- ->andReturn(array('another@domain.com' => 'Someone'));
+ ->andReturn(['another@domain.com' => 'Someone']);
$message->shouldReceive('getReturnPath')
->once()
->andReturn('more@domain.com');
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<more@domain.com>\r\n")
@@ -337,7 +336,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
@@ -392,16 +391,16 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
//We'll treat 252 as accepted since it isn't really a failure
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<me@domain.com>\r\n")
@@ -419,7 +418,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(2)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
@@ -428,18 +427,101 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
}
}
+ public function testUtf8AddressWithIdnEncoder()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
+
+ $message->shouldReceive('getFrom')
+ ->once()
+ ->andReturn(['me@dömain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->once()
+ ->andReturn(['foo@bär' => null]);
+ $buf->shouldReceive('write')
+ ->once()
+ ->with("MAIL FROM:<me@xn--dmain-jua.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->once()
+ ->with("RCPT TO:<foo@xn--br-via>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 OK'."\r\n");
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $smtp->send($message);
+ }
+
+ public function testUtf8AddressWithUtf8Encoder()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf, null, new Swift_AddressEncoder_Utf8AddressEncoder());
+ $message = $this->createMessage();
+
+ $message->shouldReceive('getFrom')
+ ->once()
+ ->andReturn(['më@dömain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->once()
+ ->andReturn(['föö@bär' => null]);
+ $buf->shouldReceive('write')
+ ->once()
+ ->with("MAIL FROM:<më@dömain.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->once()
+ ->with("RCPT TO:<föö@bär>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 OK'."\r\n");
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $smtp->send($message);
+ }
+
+ public function testNonEncodableSenderCausesException()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
+
+ $message->shouldReceive('getFrom')
+ ->once()
+ ->andReturn(['më@domain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->once()
+ ->andReturn(['foo@bar' => null]);
+
+ $this->finishBuffer($buf);
+ try {
+ $smtp->start();
+ $smtp->send($message);
+ $this->fail('më@domain.com cannot be encoded (not observed)');
+ } catch (Swift_AddressEncoderException $e) {
+ $this->assertEquals('më@domain.com', $e->getAddress());
+ }
+ }
+
public function testMailFromCommandIsOnlySentOncePerMessage()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<me@domain.com>\r\n")
@@ -460,27 +542,28 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->never()
->with("MAIL FROM:<me@domain.com>\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testMultipleRecipientsSendsMultipleRcpt()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array(
+ ->andReturn([
'foo@bar' => null,
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ 'tëst@domain' => 'Test user',
+ ]);
$buf->shouldReceive('write')
->once()
->with("RCPT TO:<foo@bar>\r\n")
@@ -506,29 +589,29 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(3)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testCcRecipientsSendsMultipleRcpt()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getCc')
->once()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$buf->shouldReceive('write')
->once()
->with("RCPT TO:<foo@bar>\r\n")
@@ -554,29 +637,29 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(3)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testSendReturnsNumberOfSuccessfulRecipients()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getCc')
->once()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$buf->shouldReceive('write')
->once()
->with("RCPT TO:<foo@bar>\r\n")
@@ -602,7 +685,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(3)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(2, $smtp->send($message),
'%s: 1 of 3 recipients failed so 2 should be returned'
@@ -625,16 +708,16 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
S: 250
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("RCPT TO:<foo@bar>\r\n")
@@ -652,7 +735,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(2)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(0, $smtp->send($message),
'%s: 1 of 1 recipients failed so 0 should be returned'
@@ -691,16 +774,16 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
E: 451, 554, 503
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("DATA\r\n")
@@ -710,7 +793,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('354 Go ahead'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
@@ -721,16 +804,16 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testBadDataResponseCausesException()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("DATA\r\n")
@@ -740,27 +823,27 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(1)
->andReturn('451 Bad'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
$this->fail('354 is the expected response to DATA (not observed)');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
}
}
public function testMessageIsStreamedToBufferForData()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("DATA\r\n")
@@ -778,23 +861,23 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(2)
->andReturn('250 OK'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testBadResponseAfterDataTransmissionCausesException()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->once()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->once()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('write')
->once()
->with("DATA\r\n")
@@ -812,12 +895,12 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(2)
->andReturn('554 Error'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
$smtp->send($message);
$this->fail('250 is the expected response after a DATA transmission (not observed)');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
}
}
@@ -840,65 +923,65 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
transaction containing only a single RCPT command.
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getBcc')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$message->shouldReceive('setBcc')
->once()
- ->with(array());
+ ->with([]);
$message->shouldReceive('setBcc')
->zeroOrMoreTimes();
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
public function testEachBccRecipientIsSentASeparateMessage()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getBcc')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$message->shouldReceive('setBcc')
->atLeast()->once()
- ->with(array());
+ ->with([]);
$message->shouldReceive('setBcc')
->once()
- ->with(array('zip@button' => 'Zip Button'));
+ ->with(['zip@button' => 'Zip Button']);
$message->shouldReceive('setBcc')
->once()
- ->with(array('test@domain' => 'Test user'));
+ ->with(['test@domain' => 'Test user']);
$message->shouldReceive('setBcc')
->atLeast()->once()
- ->with(array(
+ ->with([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$buf->shouldReceive('write')->once()->with("MAIL FROM:<me@domain.com>\r\n")->andReturn(1);
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250 OK\r\n");
@@ -927,38 +1010,38 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')->once()->with("\r\n.\r\n")->andReturn(12);
$buf->shouldReceive('readLine')->once()->with(12)->andReturn("250 OK\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(3, $smtp->send($message));
}
public function testMessageStateIsRestoredOnFailure()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getBcc')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$message->shouldReceive('setBcc')
->once()
- ->with(array());
+ ->with([]);
$message->shouldReceive('setBcc')
->once()
- ->with(array(
+ ->with([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$buf->shouldReceive('write')
->once()
->with("MAIL FROM:<me@domain.com>\r\n")
@@ -984,13 +1067,13 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->with(3)
->andReturn("451 No\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
try {
$smtp->send($message);
$this->fail('A bad response was given so exception is expected');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
}
}
@@ -1018,9 +1101,9 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
"QUIT" CRLF
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('write')
@@ -1034,7 +1117,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('terminate')
->once();
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$this->assertFalse($smtp->isStarted());
$smtp->start();
@@ -1045,17 +1128,17 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testBufferCanBeFetched()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ref = $smtp->getBuffer();
$this->assertEquals($buf, $ref);
}
public function testBufferCanBeWrittenToUsingExecuteCommand()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with("FOO\r\n")
@@ -1071,9 +1154,9 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
public function testResponseCodesAreValidated()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with("FOO\r\n")
@@ -1084,45 +1167,45 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
->andReturn("551 Not ok\r\n");
try {
- $smtp->executeCommand("FOO\r\n", array(250, 251));
+ $smtp->executeCommand("FOO\r\n", [250, 251]);
$this->fail('A 250 or 251 response was needed but 551 was returned.');
- } catch (Exception $e) {
+ } catch (Swift_TransportException $e) {
}
}
public function testFailedRecipientsCanBeCollectedByReference()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('getBcc')
->zeroOrMoreTimes()
- ->andReturn(array(
+ ->andReturn([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$message->shouldReceive('setBcc')
->atLeast()->once()
- ->with(array());
+ ->with([]);
$message->shouldReceive('setBcc')
->once()
- ->with(array('zip@button' => 'Zip Button'));
+ ->with(['zip@button' => 'Zip Button']);
$message->shouldReceive('setBcc')
->once()
- ->with(array('test@domain' => 'Test user'));
+ ->with(['test@domain' => 'Test user']);
$message->shouldReceive('setBcc')
->atLeast()->once()
- ->with(array(
+ ->with([
'zip@button' => 'Zip Button',
'test@domain' => 'Test user',
- ));
+ ]);
$buf->shouldReceive('write')->once()->with("MAIL FROM:<me@domain.com>\r\n")->andReturn(1);
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250 OK\r\n");
@@ -1147,44 +1230,112 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')->once()->with("RSET\r\n")->andReturn(11);
$buf->shouldReceive('readLine')->once()->with(11)->andReturn("250 OK\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$this->assertEquals(1, $smtp->send($message, $failures));
- $this->assertEquals(array('zip@button', 'test@domain'), $failures,
+ $this->assertEquals(['zip@button', 'test@domain'], $failures,
'%s: Failures should be caught in an array'
);
}
public function testSendingRegeneratesMessageId()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain.com' => 'Me'));
+ ->andReturn(['me@domain.com' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$message->shouldReceive('generateId')
->once();
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->start();
$smtp->send($message);
}
- protected function _getBuffer()
+ public function testPing()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^NOOP\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 OK'."\r\n");
+
+ $this->finishBuffer($buf);
+ $this->assertTrue($smtp->ping());
+ }
+
+ public function testPingOnDeadConnection()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^NOOP\r\n$~D')
+ ->andThrow('Swift_TransportException');
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $this->assertTrue($smtp->isStarted());
+ $this->assertFalse($smtp->ping());
+ $this->assertFalse($smtp->isStarted());
+ }
+
+ public function testSetLocalDomain()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+
+ $smtp->setLocalDomain('example.com');
+ $this->assertEquals('example.com', $smtp->getLocalDomain());
+
+ $smtp->setLocalDomain('192.168.0.1');
+ $this->assertEquals('[192.168.0.1]', $smtp->getLocalDomain());
+
+ $smtp->setLocalDomain('[192.168.0.1]');
+ $this->assertEquals('[192.168.0.1]', $smtp->getLocalDomain());
+
+ $smtp->setLocalDomain('fd00::');
+ $this->assertEquals('[IPv6:fd00::]', $smtp->getLocalDomain());
+
+ $smtp->setLocalDomain('[IPv6:fd00::]');
+ $this->assertEquals('[IPv6:fd00::]', $smtp->getLocalDomain());
+ }
+
+ protected function getBuffer()
{
return $this->getMockery('Swift_Transport_IoBuffer')->shouldIgnoreMissing();
}
- protected function _createMessage()
+ protected function createMessage()
{
- return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
+ return $this->getMockery('Swift_Mime_SimpleMessage')->shouldIgnoreMissing();
}
- protected function _finishBuffer($buf)
+ protected function finishBuffer($buf)
{
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
@@ -1193,7 +1344,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with('~^(EH|HE)LO .*?\r\n$~D')
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
@@ -1201,7 +1352,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with('~^MAIL FROM:<.*?>\r\n$~D')
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
@@ -1209,7 +1360,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with('~^RCPT TO:<.*?>\r\n$~D')
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
@@ -1217,7 +1368,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with("DATA\r\n")
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
@@ -1225,7 +1376,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with("\r\n.\r\n")
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
@@ -1233,7 +1384,7 @@ abstract class Swift_Transport_AbstractSmtpTest extends \SwiftMailerTestCase
$buf->shouldReceive('write')
->zeroOrMoreTimes()
->with("RSET\r\n")
- ->andReturn($x = uniqid());
+ ->andReturn($x = uniqid('', true));
$buf->shouldReceive('readLine')
->zeroOrMoreTimes()
->with($x)
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 aca03a92e0..ba131e8ee5 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
@@ -2,11 +2,11 @@
class Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \SwiftMailerTestCase
{
- private $_agent;
+ private $agent;
protected function setUp()
{
- $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
+ $this->agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
}
public function testKeywordIsCramMd5()
@@ -15,49 +15,50 @@ class Swift_Transport_Esmtp_Auth_CramMd5AuthenticatorTest extends \SwiftMailerTe
The authentication type associated with CRAM is "CRAM-MD5".
*/
- $cram = $this->_getAuthenticator();
+ $cram = $this->getAuthenticator();
$this->assertEquals('CRAM-MD5', $cram->getAuthKeyword());
}
public function testSuccessfulAuthentication()
{
- $cram = $this->_getAuthenticator();
+ $cram = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("AUTH CRAM-MD5\r\n", array(334))
+ ->with("AUTH CRAM-MD5\r\n", [334])
->andReturn('334 '.base64_encode('<foo@bar>')."\r\n");
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(\Mockery::any(), array(235));
+ ->with(\Mockery::any(), [235]);
- $this->assertTrue($cram->authenticate($this->_agent, 'jack', 'pass'),
+ $this->assertTrue($cram->authenticate($this->agent, 'jack', 'pass'),
'%s: The buffer accepted all commands authentication should succeed'
);
}
- public function testAuthenticationFailureSendRsetAndReturnFalse()
+ /**
+ * @expectedException \Swift_TransportException
+ */
+ public function testAuthenticationFailureSendRset()
{
- $cram = $this->_getAuthenticator();
+ $cram = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("AUTH CRAM-MD5\r\n", array(334))
+ ->with("AUTH CRAM-MD5\r\n", [334])
->andReturn('334 '.base64_encode('<foo@bar>')."\r\n");
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(\Mockery::any(), array(235))
+ ->with(\Mockery::any(), [235])
->andThrow(new Swift_TransportException(''));
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("RSET\r\n", array(250));
+ ->with("RSET\r\n", [250]);
- $this->assertFalse($cram->authenticate($this->_agent, 'jack', 'pass'),
- '%s: Authentication fails, so RSET should be sent'
- );
+ $cram->authenticate($this->agent, 'jack', 'pass');
}
- private function _getAuthenticator()
+ 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 13f0209af9..499ceb772c 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
@@ -2,62 +2,63 @@
class Swift_Transport_Esmtp_Auth_LoginAuthenticatorTest extends \SwiftMailerTestCase
{
- private $_agent;
+ private $agent;
protected function setUp()
{
- $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
+ $this->agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
}
public function testKeywordIsLogin()
{
- $login = $this->_getAuthenticator();
+ $login = $this->getAuthenticator();
$this->assertEquals('LOGIN', $login->getAuthKeyword());
}
public function testSuccessfulAuthentication()
{
- $login = $this->_getAuthenticator();
+ $login = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("AUTH LOGIN\r\n", array(334));
- $this->_agent->shouldReceive('executeCommand')
+ ->with("AUTH LOGIN\r\n", [334]);
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(base64_encode('jack')."\r\n", array(334));
- $this->_agent->shouldReceive('executeCommand')
+ ->with(base64_encode('jack')."\r\n", [334]);
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(base64_encode('pass')."\r\n", array(235));
+ ->with(base64_encode('pass')."\r\n", [235]);
- $this->assertTrue($login->authenticate($this->_agent, 'jack', 'pass'),
+ $this->assertTrue($login->authenticate($this->agent, 'jack', 'pass'),
'%s: The buffer accepted all commands authentication should succeed'
);
}
- public function testAuthenticationFailureSendRsetAndReturnFalse()
+ /**
+ * @expectedException \Swift_TransportException
+ */
+ public function testAuthenticationFailureSendRset()
{
- $login = $this->_getAuthenticator();
+ $login = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("AUTH LOGIN\r\n", array(334));
- $this->_agent->shouldReceive('executeCommand')
+ ->with("AUTH LOGIN\r\n", [334]);
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(base64_encode('jack')."\r\n", array(334));
- $this->_agent->shouldReceive('executeCommand')
+ ->with(base64_encode('jack')."\r\n", [334]);
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with(base64_encode('pass')."\r\n", array(235))
+ ->with(base64_encode('pass')."\r\n", [235])
->andThrow(new Swift_TransportException(''));
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("RSET\r\n", array(250));
+ ->with("RSET\r\n", [250]);
- $this->assertFalse($login->authenticate($this->_agent, 'jack', 'pass'),
- '%s: Authentication fails, so RSET should be sent'
- );
+ $login->authenticate($this->agent, 'jack', 'pass');
}
- private function _getAuthenticator()
+ 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 911d2585c9..df306eb490 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
@@ -2,29 +2,29 @@
class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestCase
{
- private $_message1 = '4e544c4d535350000100000007020000';
- private $_message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000';
- private $_message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000';
+ private $message1 = '4e544c4d535350000100000007020000';
+ private $message2 = '4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000';
+ private $message3 = '4e544c4d5353500003000000180018006000000076007600780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d00420045005200bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000';
protected function setUp()
{
- if (!function_exists('openssl_encrypt') || !function_exists('openssl_random_pseudo_bytes') || !function_exists('bcmul') || !function_exists('iconv')) {
+ if (!function_exists('openssl_encrypt') || !function_exists('bcmul') || !function_exists('iconv')) {
$this->markTestSkipped('One of the required functions is not available.');
}
}
public function testKeywordIsNtlm()
{
- $login = $this->_getAuthenticator();
+ $login = $this->getAuthenticator();
$this->assertEquals('NTLM', $login->getAuthKeyword());
}
public function testMessage1Generator()
{
- $login = $this->_getAuthenticator();
- $message1 = $this->_invokePrivateMethod('createMessage1', $login);
+ $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()
@@ -33,8 +33,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
$challenge = 'b019d38bad875c9d';
$lmv1 = '1879f60127f8a877022132ec221bcbf3ca016a9f76095606';
- $login = $this->_getAuthenticator();
- $lmv1Result = $this->_invokePrivateMethod('createLMPassword', $login, array($password, $this->hex2bin($challenge)));
+ $login = $this->getAuthenticator();
+ $lmv1Result = $this->invokePrivateMethod('createLMPassword', $login, [$password, hex2bin($challenge)]);
$this->assertEquals($lmv1, bin2hex($lmv1Result), '%s: The keys should be the same cause we use the same values to generate them.');
}
@@ -47,8 +47,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
$challenge = '0123456789abcdef';
$lmv2 = 'd6e6152ea25d03b7c6ba6629c2d6aaf0ffffff0011223344';
- $login = $this->_getAuthenticator();
- $lmv2Result = $this->_invokePrivateMethod('createLMv2Password', $login, array($password, $username, $domain, $this->hex2bin($challenge), $this->hex2bin('ffffff0011223344')));
+ $login = $this->getAuthenticator();
+ $lmv2Result = $this->invokePrivateMethod('createLMv2Password', $login, [$password, $username, $domain, hex2bin($challenge), hex2bin('ffffff0011223344')]);
$this->assertEquals($lmv2, bin2hex($lmv2Result), '%s: The keys should be the same cause we use the same values to generate them.');
}
@@ -62,8 +62,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
$ntlmResponse = 'e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a';
$message3T = '4e544c4d5353500003000000180018006000000018001800780000000c000c0040000000080008004c0000000c000c0054000000000000009a0000000102000054004500530054004e00540074006500730074004d0045004d004200450052001879f60127f8a877022132ec221bcbf3ca016a9f76095606e6285df3287c5d194f84df1a94817c7282d09754b6f9e02a';
- $login = $this->_getAuthenticator();
- $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse)));
+ $login = $this->getAuthenticator();
+ $message3 = $this->invokePrivateMethod('createMessage3', $login, [$domain, $username, $workstation, hex2bin($lmResponse), 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');
}
@@ -76,18 +76,18 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
$lmResponse = 'bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9';
$ntlmResponse = 'caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000';
- $login = $this->_getAuthenticator();
- $message3 = $this->_invokePrivateMethod('createMessage3', $login, array($domain, $username, $workstation, $this->hex2bin($lmResponse), $this->hex2bin($ntlmResponse)));
+ $login = $this->getAuthenticator();
+ $message3 = $this->invokePrivateMethod('createMessage3', $login, [$domain, $username, $workstation, hex2bin($lmResponse), 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()
{
$username = "DOMAIN\user";
- $login = $this->_getAuthenticator();
- list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));
+ $login = $this->getAuthenticator();
+ list($domain, $user) = $this->invokePrivateMethod('getDomainAndUsername', $login, [$username]);
$this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match');
$this->assertEquals('user', $user, '%s: the fetched user did not match');
@@ -97,8 +97,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
{
$username = "domain.com\user";
- $login = $this->_getAuthenticator();
- list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));
+ $login = $this->getAuthenticator();
+ list($domain, $user) = $this->invokePrivateMethod('getDomainAndUsername', $login, [$username]);
$this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match');
$this->assertEquals('user', $user, '%s: the fetched user did not match');
@@ -108,8 +108,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
{
$username = 'user@DOMAIN';
- $login = $this->_getAuthenticator();
- list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));
+ $login = $this->getAuthenticator();
+ list($domain, $user) = $this->invokePrivateMethod('getDomainAndUsername', $login, [$username]);
$this->assertEquals('DOMAIN', $domain, '%s: the fetched domain did not match');
$this->assertEquals('user', $user, '%s: the fetched user did not match');
@@ -119,8 +119,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
{
$username = 'user@domain.com';
- $login = $this->_getAuthenticator();
- list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));
+ $login = $this->getAuthenticator();
+ list($domain, $user) = $this->invokePrivateMethod('getDomainAndUsername', $login, [$username]);
$this->assertEquals('domain.com', $domain, '%s: the fetched domain did not match');
$this->assertEquals('user', $user, '%s: the fetched user did not match');
@@ -130,8 +130,8 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
{
$username = 'user';
- $login = $this->_getAuthenticator();
- list($domain, $user) = $this->_invokePrivateMethod('getDomainAndUsername', $login, array($username));
+ $login = $this->getAuthenticator();
+ list($domain, $user) = $this->invokePrivateMethod('getDomainAndUsername', $login, [$username]);
$this->assertEquals('', $domain, '%s: the fetched domain did not match');
$this->assertEquals('user', $user, '%s: the fetched user did not match');
@@ -143,71 +143,62 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticatorTest extends \SwiftMailerTestC
$username = 'test';
$secret = 'test1234';
- $ntlm = $this->_getAuthenticator();
- $agent = $this->_getAgent();
+ $ntlm = $this->getAuthenticator();
+ $agent = $this->getAgent();
$agent->shouldReceive('executeCommand')
->once()
->with('AUTH NTLM '.base64_encode(
- $this->_invokePrivateMethod('createMessage1', $ntlm)
- )."\r\n", array(334))
- ->andReturn('334 '.base64_encode($this->hex2bin('4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000')));
+ $this->invokePrivateMethod('createMessage1', $ntlm)
+ )."\r\n", [334])
+ ->andReturn('334 '.base64_encode(hex2bin('4e544c4d53535000020000000c000c003000000035828980514246973ea892c10000000000000000460046003c00000054004500530054004e00540002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d0000000000')));
$agent->shouldReceive('executeCommand')
->once()
->with(base64_encode(
- $this->_invokePrivateMethod('createMessage3', $ntlm, array($domain, $username, $this->hex2bin('4d0045004d00420045005200'), $this->hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), $this->hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000'))
- ))."\r\n", array(235));
+ $this->invokePrivateMethod('createMessage3', $ntlm, [$domain, $username, hex2bin('4d0045004d00420045005200'), hex2bin('bf2e015119f6bdb3f6fdb768aa12d478f5ce3d2401c8f6e9'), hex2bin('caa4da8f25d5e840974ed8976d3ada46010100000000000030fa7e3c677bc301f5ce3d2401c8f6e90000000002000c0054004500530054004e00540001000c004d0045004d0042004500520003001e006d0065006d006200650072002e0074006500730074002e0063006f006d000000000000000000')]
+ ))."\r\n", [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, hex2bin('30fa7e3c677bc301'), hex2bin('f5ce3d2401c8f6e9')), '%s: The buffer accepted all commands authentication should succeed');
}
- public function testAuthenticationFailureSendRsetAndReturnFalse()
+ /**
+ * @expectedException \Swift_TransportException
+ */
+ public function testAuthenticationFailureSendRset()
{
$domain = 'TESTNT';
$username = 'test';
$secret = 'test1234';
- $ntlm = $this->_getAuthenticator();
- $agent = $this->_getAgent();
+ $ntlm = $this->getAuthenticator();
+ $agent = $this->getAgent();
$agent->shouldReceive('executeCommand')
->once()
->with('AUTH NTLM '.base64_encode(
- $this->_invokePrivateMethod('createMessage1', $ntlm)
- )."\r\n", array(334))
+ $this->invokePrivateMethod('createMessage1', $ntlm)
+ )."\r\n", [334])
->andThrow(new Swift_TransportException(''));
$agent->shouldReceive('executeCommand')
->once()
- ->with("RSET\r\n", array(250));
+ ->with("RSET\r\n", [250]);
- $this->assertFalse($ntlm->authenticate($agent, $username.'@'.$domain, $secret, $this->hex2bin('30fa7e3c677bc301'), $this->hex2bin('f5ce3d2401c8f6e9')), '%s: Authentication fails, so RSET should be sent');
+ $ntlm->authenticate($agent, $username.'@'.$domain, $secret, hex2bin('30fa7e3c677bc301'), hex2bin('f5ce3d2401c8f6e9'));
}
- private function _getAuthenticator()
+ private function getAuthenticator()
{
return new Swift_Transport_Esmtp_Auth_NTLMAuthenticator();
}
- private function _getAgent()
+ private function getAgent()
{
return $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
}
- private function _invokePrivateMethod($method, $instance, array $args = array())
+ private function invokePrivateMethod($method, $instance, array $args = [])
{
$methodC = new ReflectionMethod($instance, trim($method));
$methodC->setAccessible(true);
return $methodC->invokeArgs($instance, $args);
}
-
- /**
- * Hex2bin replacement for < PHP 5.4.
- *
- * @param string $hex
- *
- * @return string Binary
- */
- protected function hex2bin($hex)
- {
- return function_exists('hex2bin') ? hex2bin($hex) : pack('H*', $hex);
- }
}
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 73a906277f..1bb2c992b6 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
@@ -2,11 +2,11 @@
class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTestCase
{
- private $_agent;
+ private $agent;
protected function setUp()
{
- $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
+ $this->agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
}
public function testKeywordIsPlain()
@@ -15,7 +15,7 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTest
The name associated with this mechanism is "PLAIN".
*/
- $login = $this->_getAuthenticator();
+ $login = $this->getAuthenticator();
$this->assertEquals('PLAIN', $login->getAuthKeyword());
}
@@ -28,39 +28,40 @@ class Swift_Transport_Esmtp_Auth_PlainAuthenticatorTest extends \SwiftMailerTest
(U+0000) character, followed by the clear-text password.
*/
- $plain = $this->_getAuthenticator();
+ $plain = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
->with('AUTH PLAIN '.base64_encode(
'jack'.chr(0).'jack'.chr(0).'pass'
- )."\r\n", array(235));
+ )."\r\n", [235]);
- $this->assertTrue($plain->authenticate($this->_agent, 'jack', 'pass'),
+ $this->assertTrue($plain->authenticate($this->agent, 'jack', 'pass'),
'%s: The buffer accepted all commands authentication should succeed'
);
}
- public function testAuthenticationFailureSendRsetAndReturnFalse()
+ /**
+ * @expectedException \Swift_TransportException
+ */
+ public function testAuthenticationFailureSendRset()
{
- $plain = $this->_getAuthenticator();
+ $plain = $this->getAuthenticator();
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
->with('AUTH PLAIN '.base64_encode(
'jack'.chr(0).'jack'.chr(0).'pass'
- )."\r\n", array(235))
+ )."\r\n", [235])
->andThrow(new Swift_TransportException(''));
- $this->_agent->shouldReceive('executeCommand')
+ $this->agent->shouldReceive('executeCommand')
->once()
- ->with("RSET\r\n", array(250));
+ ->with("RSET\r\n", [250]);
- $this->assertFalse($plain->authenticate($this->_agent, 'jack', 'pass'),
- '%s: Authentication fails, so RSET should be sent'
- );
+ $plain->authenticate($this->agent, 'jack', 'pass');
}
- private function _getAuthenticator()
+ 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 d52328a133..36a4cf818c 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php
@@ -2,43 +2,43 @@
class Swift_Transport_Esmtp_AuthHandlerTest extends \SwiftMailerTestCase
{
- private $_agent;
+ private $agent;
protected function setUp()
{
- $this->_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
+ $this->agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing();
}
public function testKeywordIsAuth()
{
- $auth = $this->_createHandler(array());
+ $auth = $this->createHandler([]);
$this->assertEquals('AUTH', $auth->getHandledKeyword());
}
public function testUsernameCanBeSetAndFetched()
{
- $auth = $this->_createHandler(array());
+ $auth = $this->createHandler([]);
$auth->setUsername('jack');
$this->assertEquals('jack', $auth->getUsername());
}
public function testPasswordCanBeSetAndFetched()
{
- $auth = $this->_createHandler(array());
+ $auth = $this->createHandler([]);
$auth->setPassword('pass');
$this->assertEquals('pass', $auth->getPassword());
}
public function testAuthModeCanBeSetAndFetched()
{
- $auth = $this->_createHandler(array());
+ $auth = $this->createHandler([]);
$auth->setAuthMode('PLAIN');
$this->assertEquals('PLAIN', $auth->getAuthMode());
}
public function testMixinMethods()
{
- $auth = $this->_createHandler(array());
+ $auth = $this->createHandler([]);
$mixins = $auth->exposeMixinMethods();
$this->assertTrue(in_array('getUsername', $mixins),
'%s: getUsername() should be accessible via mixin'
@@ -62,98 +62,98 @@ class Swift_Transport_Esmtp_AuthHandlerTest extends \SwiftMailerTestCase
public function testAuthenticatorsAreCalledAccordingToParamsAfterEhlo()
{
- $a1 = $this->_createMockAuthenticator('PLAIN');
- $a2 = $this->_createMockAuthenticator('LOGIN');
+ $a1 = $this->createMockAuthenticator('PLAIN');
+ $a2 = $this->createMockAuthenticator('LOGIN');
$a1->shouldReceive('authenticate')
->never()
- ->with($this->_agent, 'jack', 'pass');
+ ->with($this->agent, 'jack', 'pass');
$a2->shouldReceive('authenticate')
->once()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(true);
- $auth = $this->_createHandler(array($a1, $a2));
+ $auth = $this->createHandler([$a1, $a2]);
$auth->setUsername('jack');
$auth->setPassword('pass');
- $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN'));
- $auth->afterEhlo($this->_agent);
+ $auth->setKeywordParams(['CRAM-MD5', 'LOGIN']);
+ $auth->afterEhlo($this->agent);
}
public function testAuthenticatorsAreNotUsedIfNoUsernameSet()
{
- $a1 = $this->_createMockAuthenticator('PLAIN');
- $a2 = $this->_createMockAuthenticator('LOGIN');
+ $a1 = $this->createMockAuthenticator('PLAIN');
+ $a2 = $this->createMockAuthenticator('LOGIN');
$a1->shouldReceive('authenticate')
->never()
- ->with($this->_agent, 'jack', 'pass');
+ ->with($this->agent, 'jack', 'pass');
$a2->shouldReceive('authenticate')
->never()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(true);
- $auth = $this->_createHandler(array($a1, $a2));
+ $auth = $this->createHandler([$a1, $a2]);
- $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN'));
- $auth->afterEhlo($this->_agent);
+ $auth->setKeywordParams(['CRAM-MD5', 'LOGIN']);
+ $auth->afterEhlo($this->agent);
}
public function testSeveralAuthenticatorsAreTriedIfNeeded()
{
- $a1 = $this->_createMockAuthenticator('PLAIN');
- $a2 = $this->_createMockAuthenticator('LOGIN');
+ $a1 = $this->createMockAuthenticator('PLAIN');
+ $a2 = $this->createMockAuthenticator('LOGIN');
$a1->shouldReceive('authenticate')
->once()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(false);
$a2->shouldReceive('authenticate')
->once()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(true);
- $auth = $this->_createHandler(array($a1, $a2));
+ $auth = $this->createHandler([$a1, $a2]);
$auth->setUsername('jack');
$auth->setPassword('pass');
- $auth->setKeywordParams(array('PLAIN', 'LOGIN'));
- $auth->afterEhlo($this->_agent);
+ $auth->setKeywordParams(['PLAIN', 'LOGIN']);
+ $auth->afterEhlo($this->agent);
}
public function testFirstAuthenticatorToPassBreaksChain()
{
- $a1 = $this->_createMockAuthenticator('PLAIN');
- $a2 = $this->_createMockAuthenticator('LOGIN');
- $a3 = $this->_createMockAuthenticator('CRAM-MD5');
+ $a1 = $this->createMockAuthenticator('PLAIN');
+ $a2 = $this->createMockAuthenticator('LOGIN');
+ $a3 = $this->createMockAuthenticator('CRAM-MD5');
$a1->shouldReceive('authenticate')
->once()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(false);
$a2->shouldReceive('authenticate')
->once()
- ->with($this->_agent, 'jack', 'pass')
+ ->with($this->agent, 'jack', 'pass')
->andReturn(true);
$a3->shouldReceive('authenticate')
->never()
- ->with($this->_agent, 'jack', 'pass');
+ ->with($this->agent, 'jack', 'pass');
- $auth = $this->_createHandler(array($a1, $a2));
+ $auth = $this->createHandler([$a1, $a2]);
$auth->setUsername('jack');
$auth->setPassword('pass');
- $auth->setKeywordParams(array('PLAIN', 'LOGIN', 'CRAM-MD5'));
- $auth->afterEhlo($this->_agent);
+ $auth->setKeywordParams(['PLAIN', 'LOGIN', 'CRAM-MD5']);
+ $auth->afterEhlo($this->agent);
}
- private function _createHandler($authenticators)
+ private function createHandler($authenticators)
{
return new Swift_Transport_Esmtp_AuthHandler($authenticators);
}
- private function _createMockAuthenticator($type)
+ private function createMockAuthenticator($type)
{
$authenticator = $this->getMockery('Swift_Transport_Esmtp_Authenticator')->shouldIgnoreMissing();
$authenticator->shouldReceive('getAuthKeyword')
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 166e1605bd..d9e363a706 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php
@@ -13,8 +13,8 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
{
public function testExtensionHandlersAreSortedAsNeeded()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -32,16 +32,16 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->zeroOrMoreTimes()
->with('AUTH')
->andReturn(-1);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2));
- $this->assertEquals(array($ext2, $ext1), $smtp->getExtensionHandlers());
+ $smtp->setExtensionHandlers([$ext1, $ext2]);
+ $this->assertEquals([$ext2, $ext1], $smtp->getExtensionHandlers());
}
public function testHandlersAreNotifiedOfParams()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -71,23 +71,23 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('AUTH');
$ext1->shouldReceive('setKeywordParams')
->once()
- ->with(array('PLAIN', 'LOGIN'));
+ ->with(['PLAIN', 'LOGIN']);
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('SIZE');
$ext2->shouldReceive('setKeywordParams')
->zeroOrMoreTimes()
- ->with(array('123456'));
- $this->_finishBuffer($buf);
+ ->with(['123456']);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2));
+ $smtp->setExtensionHandlers([$ext1, $ext2]);
$smtp->start();
}
public function testSupportedExtensionHandlersAreRunAfterEhlo()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -131,28 +131,28 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
$ext3->shouldReceive('afterEhlo')
->never()
->with($smtp);
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
+ $smtp->setExtensionHandlers([$ext1, $ext2, $ext3]);
$smtp->start();
}
public function testExtensionsCanModifyMailFromParams()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher();
- $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher();
+ $smtp = new Swift_Transport_EsmtpTransport($buf, [], $dispatcher, 'example.org');
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain' => 'Me'));
+ ->andReturn(['me@domain' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('readLine')
->once()
@@ -190,7 +190,7 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->once()
->with(3)
->andReturn("250 OK\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
@@ -200,7 +200,11 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('FOO');
$ext1->shouldReceive('getPriorityOver')
->zeroOrMoreTimes()
- ->with('AUTH')
+ ->with('STARTTLS')
+ ->andReturn(1);
+ $ext1->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('SIZE')
->andReturn(-1);
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
@@ -212,33 +216,45 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->zeroOrMoreTimes()
->with('AUTH')
->andReturn(1);
+ $ext2->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('STARTTLS')
+ ->andReturn(1);
$ext3->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('STARTTLS');
$ext3->shouldReceive('getMailParams')
->never();
+ $ext3->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('AUTH')
+ ->andReturn(-1);
+ $ext3->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('SIZE')
+ ->andReturn(-1);
- $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
+ $smtp->setExtensionHandlers([$ext1, $ext2, $ext3]);
$smtp->start();
$smtp->send($message);
}
public function testExtensionsCanModifyRcptParams()
{
- $buf = $this->_getBuffer();
- $dispatcher = $this->_createEventDispatcher();
- $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);
+ $buf = $this->getBuffer();
+ $dispatcher = $this->createEventDispatcher();
+ $smtp = new Swift_Transport_EsmtpTransport($buf, [], $dispatcher, 'example.org');
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
- $message = $this->_createMessage();
+ $message = $this->createMessage();
$message->shouldReceive('getFrom')
->zeroOrMoreTimes()
- ->andReturn(array('me@domain' => 'Me'));
+ ->andReturn(['me@domain' => 'Me']);
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null));
+ ->andReturn(['foo@bar' => null]);
$buf->shouldReceive('readLine')
->once()
@@ -276,7 +292,7 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->once()
->with(3)
->andReturn("250 OK\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
@@ -286,7 +302,11 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('FOO');
$ext1->shouldReceive('getPriorityOver')
->zeroOrMoreTimes()
- ->with('AUTH')
+ ->with('STARTTLS')
+ ->andReturn(1);
+ $ext1->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('SIZE')
->andReturn(-1);
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
@@ -296,6 +316,10 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('ZIP');
$ext2->shouldReceive('getPriorityOver')
->zeroOrMoreTimes()
+ ->with('STARTTLS')
+ ->andReturn(1);
+ $ext2->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
->with('AUTH')
->andReturn(1);
$ext3->shouldReceive('getHandledKeyword')
@@ -303,16 +327,24 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('STARTTLS');
$ext3->shouldReceive('getRcptParams')
->never();
+ $ext3->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('AUTH')
+ ->andReturn(-1);
+ $ext3->shouldReceive('getPriorityOver')
+ ->zeroOrMoreTimes()
+ ->with('SIZE')
+ ->andReturn(-1);
- $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
+ $smtp->setExtensionHandlers([$ext1, $ext2, $ext3]);
$smtp->start();
$smtp->send($message);
}
public function testExtensionsAreNotifiedOnCommand()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -345,20 +377,20 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->once()
->with(2)
->andReturn("250 Cool\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('AUTH');
$ext1->shouldReceive('onCommand')
->once()
- ->with($smtp, "FOO\r\n", array(250, 251), \Mockery::any(), \Mockery::any());
+ ->with($smtp, "FOO\r\n", [250, 251], \Mockery::any(), \Mockery::any());
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('SIZE');
$ext2->shouldReceive('onCommand')
->once()
- ->with($smtp, "FOO\r\n", array(250, 251), \Mockery::any(), \Mockery::any());
+ ->with($smtp, "FOO\r\n", [250, 251], \Mockery::any(), \Mockery::any());
$ext3->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('STARTTLS');
@@ -366,15 +398,15 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->never()
->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
- $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
+ $smtp->setExtensionHandlers([$ext1, $ext2, $ext3]);
$smtp->start();
- $smtp->executeCommand("FOO\r\n", array(250, 251));
+ $smtp->executeCommand("FOO\r\n", [250, 251]);
}
public function testChainOfCommandAlgorithmWhenNotifyingExtensions()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -402,14 +434,14 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
$buf->shouldReceive('write')
->never()
->with("FOO\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('AUTH');
$ext1->shouldReceive('onCommand')
->once()
- ->with($smtp, "FOO\r\n", array(250, 251), \Mockery::any(), \Mockery::any())
+ ->with($smtp, "FOO\r\n", [250, 251], \Mockery::any(), \Mockery::any())
->andReturnUsing(function ($a, $b, $c, $d, &$e) {
$e = true;
@@ -429,15 +461,15 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->never()
->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
- $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
+ $smtp->setExtensionHandlers([$ext1, $ext2, $ext3]);
$smtp->start();
- $smtp->executeCommand("FOO\r\n", array(250, 251));
+ $smtp->executeCommand("FOO\r\n", [250, 251]);
}
public function testExtensionsCanExposeMixinMethods()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -446,7 +478,7 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('AUTH');
$ext1->shouldReceive('exposeMixinMethods')
->zeroOrMoreTimes()
- ->andReturn(array('setUsername', 'setPassword'));
+ ->andReturn(['setUsername', 'setPassword']);
$ext1->shouldReceive('setUsername')
->once()
->with('mick');
@@ -456,17 +488,17 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('STARTTLS');
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2));
+ $smtp->setExtensionHandlers([$ext1, $ext2]);
$smtp->setUsername('mick');
$smtp->setPassword('pass');
}
public function testMixinMethodsBeginningWithSetAndNullReturnAreFluid()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -475,7 +507,7 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('AUTH');
$ext1->shouldReceive('exposeMixinMethods')
->zeroOrMoreTimes()
- ->andReturn(array('setUsername', 'setPassword'));
+ ->andReturn(['setUsername', 'setPassword']);
$ext1->shouldReceive('setUsername')
->once()
->with('mick')
@@ -487,9 +519,9 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('STARTTLS');
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2));
+ $smtp->setExtensionHandlers([$ext1, $ext2]);
$ret = $smtp->setUsername('mick');
$this->assertEquals($smtp, $ret);
$ret = $smtp->setPassword('pass');
@@ -498,8 +530,8 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
public function testMixinSetterWhichReturnValuesAreNotFluid()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandlerMixin')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
@@ -508,7 +540,7 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
->andReturn('AUTH');
$ext1->shouldReceive('exposeMixinMethods')
->zeroOrMoreTimes()
- ->andReturn(array('setUsername', 'setPassword'));
+ ->andReturn(['setUsername', 'setPassword']);
$ext1->shouldReceive('setUsername')
->once()
->with('mick')
@@ -520,9 +552,9 @@ class Swift_Transport_EsmtpTransport_ExtensionSupportTest extends Swift_Transpor
$ext2->shouldReceive('getHandledKeyword')
->zeroOrMoreTimes()
->andReturn('STARTTLS');
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
- $smtp->setExtensionHandlers(array($ext1, $ext2));
+ $smtp->setExtensionHandlers([$ext1, $ext2]);
$this->assertEquals('x', $smtp->setUsername('mick'));
$this->assertEquals('x', $smtp->setPassword('pass'));
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php
index e6cca15b0e..db1edcef49 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php
@@ -2,54 +2,54 @@
class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEventSupportTest
{
- protected function _getTransport($buf, $dispatcher = null)
+ protected function getTransport($buf, $dispatcher = null, $addressEncoder = null)
{
- if (!$dispatcher) {
- $dispatcher = $this->_createEventDispatcher();
- }
+ $dispatcher = $dispatcher ?? $this->createEventDispatcher();
+ $addressEncoder = $addressEncoder ?? new Swift_AddressEncoder_IdnAddressEncoder();
- return new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);
+ return new Swift_Transport_EsmtpTransport($buf, [], $dispatcher, 'example.org', $addressEncoder);
}
public function testHostCanBeSetAndFetched()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$smtp->setHost('foo');
$this->assertEquals('foo', $smtp->getHost(), '%s: Host should be returned');
}
public function testPortCanBeSetAndFetched()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$smtp->setPort(25);
$this->assertEquals(25, $smtp->getPort(), '%s: Port should be returned');
}
public function testTimeoutCanBeSetAndFetched()
{
- $buf = $this->_getBuffer();
+ $buf = $this->getBuffer();
$buf->shouldReceive('setParam')
->once()
->with('timeout', 10);
- $smtp = $this->_getTransport($buf);
+ $smtp = $this->getTransport($buf);
$smtp->setTimeout(10);
$this->assertEquals(10, $smtp->getTimeout(), '%s: Timeout should be returned');
}
public function testEncryptionCanBeSetAndFetched()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$smtp->setEncryption('tls');
$this->assertEquals('tls', $smtp->getEncryption(), '%s: Crypto should be returned');
}
public function testStartSendsHeloToInitiate()
{
- //Overridden for EHLO instead
+ // previous loop would fail if there is an issue
+ $this->addToAssertionCount(1);
}
public function testStartSendsEhloToInitiate()
@@ -88,8 +88,8 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -106,11 +106,11 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->with(1)
->andReturn('250 ServerName'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
} catch (Exception $e) {
- $this->fail('Starting Esmtp should send EHLO and accept 250 response');
+ $this->fail('Starting Esmtp should send EHLO and accept 250 response: '.$e->getMessage());
}
}
@@ -124,8 +124,8 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
that it was in before the EHLO was received.
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -150,7 +150,7 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->with(2)
->andReturn('250 HELO'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$smtp->start();
} catch (Exception $e) {
@@ -163,8 +163,8 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
public function testInvalidHeloResponseCausesException()
{
//Overridden to first try EHLO
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
@@ -188,7 +188,7 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->once()
->with(2)
->andReturn('504 WTF'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
try {
$this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started');
@@ -212,8 +212,8 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
identifying the client.
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('readLine')
@@ -229,7 +229,7 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->with(1)
->andReturn('250 ServerName'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->setLocalDomain('mydomain.com');
$smtp->start();
}
@@ -248,8 +248,8 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
identifying the client.
*/
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('initialize')
->once();
$buf->shouldReceive('readLine')
@@ -273,15 +273,368 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->with(2)
->andReturn('250 ServerName'."\r\n");
- $this->_finishBuffer($buf);
+ $this->finishBuffer($buf);
$smtp->setLocalDomain('mydomain.com');
$smtp->start();
}
+ public function testPipelining()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $this->assertNull($smtp->getPipelining());
+
+ $message = $this->createMessage();
+ $message->shouldReceive('getFrom')
+ ->zeroOrMoreTimes()
+ ->andReturn(['me@domain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->zeroOrMoreTimes()
+ ->andReturn(['foo@bar' => null]);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^EHLO .+?\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250-ServerName'."\r\n");
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 PIPELINING'."\r\n");
+
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("MAIL FROM:<me@domain.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<foo@bar>\r\n")
+ ->andReturn(2);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("DATA\r\n")->andReturn(3);
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(1)->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(2)->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(3)->andReturn("354 OK\r\n");
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $sent = $smtp->send($message, $failedRecipients);
+
+ $this->assertEquals(1, $sent);
+ $this->assertEmpty($failedRecipients);
+
+ $this->assertTrue($smtp->getPipelining());
+ }
+
+ public function testPipeliningWithRecipientFailure()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $this->assertNull($smtp->getPipelining());
+
+ $message = $this->createMessage();
+ $message->shouldReceive('getFrom')
+ ->zeroOrMoreTimes()
+ ->andReturn(['me@domain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->zeroOrMoreTimes()
+ ->andReturn([
+ 'good@foo' => null,
+ 'bad@foo' => null,
+ 'good@bar' => null,
+ ]);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^EHLO .+?\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250-ServerName'."\r\n");
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 PIPELINING'."\r\n");
+
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("MAIL FROM:<me@domain.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<good@foo>\r\n")
+ ->andReturn(2);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<bad@foo>\r\n")
+ ->andReturn(3);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<good@bar>\r\n")
+ ->andReturn(4);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("DATA\r\n")
+ ->andReturn(5);
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(1)
+ ->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(2)
+ ->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(3)
+ ->andReturn("450 Unknown address bad@foo\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(4)
+ ->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(5)
+ ->andReturn("354 OK\r\n");
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $sent = $smtp->send($message, $failedRecipients);
+
+ $this->assertEquals(2, $sent);
+ $this->assertEquals(['bad@foo'], $failedRecipients);
+
+ $this->assertTrue($smtp->getPipelining());
+ }
+
+ public function testPipeliningWithSenderFailure()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $this->assertNull($smtp->getPipelining());
+
+ $message = $this->createMessage();
+ $message->shouldReceive('getFrom')
+ ->zeroOrMoreTimes()
+ ->andReturn(['me@domain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->zeroOrMoreTimes()
+ ->andReturn(['foo@bar' => null]);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^EHLO .+?\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250-ServerName'."\r\n");
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 PIPELINING'."\r\n");
+
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("MAIL FROM:<me@domain.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<foo@bar>\r\n")
+ ->andReturn(2);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("DATA\r\n")->andReturn(3);
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(1)
+ ->andReturn("550 Unknown address me@domain.com\r\n");
+
+ $smtp->start();
+
+ $this->expectException('Swift_TransportException');
+ $this->expectExceptionMessage('Expected response code 250 but got code "550"');
+ $smtp->send($message, $failedRecipients);
+ }
+
+ public function testPipeliningWithDataFailure()
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $this->assertNull($smtp->getPipelining());
+
+ $message = $this->createMessage();
+ $message->shouldReceive('getFrom')
+ ->zeroOrMoreTimes()
+ ->andReturn(['me@domain.com' => 'Me']);
+ $message->shouldReceive('getTo')
+ ->zeroOrMoreTimes()
+ ->andReturn(['foo@bar' => null]);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^EHLO .+?\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250-ServerName'."\r\n");
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 PIPELINING'."\r\n");
+
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("MAIL FROM:<me@domain.com>\r\n")
+ ->andReturn(1);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("RCPT TO:<foo@bar>\r\n")
+ ->andReturn(2);
+ $buf->shouldReceive('write')
+ ->ordered()
+ ->once()
+ ->with("DATA\r\n")->andReturn(3);
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(1)
+ ->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(2)
+ ->andReturn("250 OK\r\n");
+ $buf->shouldReceive('readLine')
+ ->ordered()
+ ->once()
+ ->with(3)
+ ->andReturn("452 Insufficient system storage\r\n");
+
+ $smtp->start();
+
+ $this->expectException('Swift_TransportException');
+ $this->expectExceptionMessage('Expected response code 354 but got code "452"');
+ $smtp->send($message, $failedRecipients);
+ }
+
+ public function providerPipeliningOverride()
+ {
+ return [
+ [null, true, true],
+ [null, false, false],
+ [true, false, true],
+ [true, true, true],
+ [false, false, false],
+ [false, true, false],
+ ];
+ }
+
+ /**
+ * @dataProvider providerPipeliningOverride
+ */
+ public function testPipeliningOverride($enabled, bool $supported, bool $expected)
+ {
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
+ $this->assertNull($smtp->getPipelining());
+
+ $smtp->setPipelining($enabled);
+ $this->assertSame($enabled, $smtp->getPipelining());
+
+ $message = $this->createMessage();
+ $message->shouldReceive('getFrom')
+ ->zeroOrMoreTimes()
+ ->andReturn(['me@domain.com' => 'Me']);
+
+ $buf->shouldReceive('initialize')
+ ->once();
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(0)
+ ->andReturn("220 some.server.tld bleh\r\n");
+ $buf->shouldReceive('write')
+ ->once()
+ ->with('~^EHLO .+?\r\n$~D')
+ ->andReturn(1);
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250-ServerName'."\r\n");
+ $buf->shouldReceive('readLine')
+ ->once()
+ ->with(1)
+ ->andReturn('250 '.($supported ? 'PIPELINING' : 'FOOBAR')."\r\n");
+
+ $this->finishBuffer($buf);
+ $smtp->start();
+ $smtp->send($message);
+
+ $this->assertSame($expected, $smtp->getPipelining());
+ }
+
public function testFluidInterface()
{
- $buf = $this->_getBuffer();
- $smtp = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $smtp = $this->getTransport($buf);
$buf->shouldReceive('setParam')
->once()
->with('timeout', 30);
@@ -291,6 +644,7 @@ class Swift_Transport_EsmtpTransportTest extends Swift_Transport_AbstractSmtpEve
->setPort(25)
->setEncryption('tls')
->setTimeout(30)
+ ->setPipelining(false)
;
$this->assertEquals($ref, $smtp);
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php
index e56e37f40f..deb0617da6 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php
@@ -4,8 +4,8 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
public function testFirstTransportIsUsed()
{
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState = false;
@@ -33,7 +33,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
$t2->shouldReceive('start')->never();
$t2->shouldReceive('send')->never();
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message1));
$this->assertEquals(1, $transport->send($message2));
@@ -43,7 +43,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -91,14 +91,14 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message));
}
public function testZeroIsReturnedIfTransportReturnsZero()
{
- $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
+ $message = $this->getMockery('Swift_Mime_SimpleMessage')->shouldIgnoreMissing();
$t1 = $this->getMockery('Swift_Transport')->shouldIgnoreMissing();
$connectionState = false;
@@ -126,7 +126,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
return 0;
});
- $transport = $this->_getTransport(array($t1));
+ $transport = $this->getTransport([$t1]);
$transport->start();
$this->assertEquals(0, $transport->send($message));
}
@@ -135,10 +135,10 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('maur b0rken');
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
- $message3 = $this->getMockery('Swift_Mime_Message');
- $message4 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message3 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message4 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -195,7 +195,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message1));
$this->assertEquals(1, $transport->send($message2));
@@ -207,7 +207,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -255,7 +255,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
try {
$transport->send($message);
@@ -298,7 +298,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$transport->stop();
}
@@ -307,7 +307,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
@@ -358,7 +358,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertTrue($transport->isStarted());
try {
@@ -373,8 +373,8 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
@@ -436,7 +436,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
->never()
->with($message2, \Mockery::any());
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertTrue($transport->isStarted());
try {
@@ -453,9 +453,9 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
public function testFailureReferenceIsPassedToDelegates()
{
- $failures = array();
+ $failures = [];
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$connectionState = false;
@@ -481,14 +481,14 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1));
+ $transport = $this->getTransport([$t1]);
$transport->start();
$transport->send($message, $failures);
}
public function testRegisterPluginDelegatesToLoadedTransports()
{
- $plugin = $this->_createPlugin();
+ $plugin = $this->createPlugin();
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
@@ -499,11 +499,93 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
->once()
->with($plugin);
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->registerPlugin($plugin);
}
- private function _getTransport(array $transports)
+ public function testEachDelegateIsPinged()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+ $connectionState1 = false;
+ $connectionState2 = false;
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->once()
+ ->andReturn(true);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertTrue($transport->isStarted());
+ $this->assertTrue($transport->ping());
+ }
+
+ public function testDelegateIsKilledWhenPingFails()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $t2->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState2) {
+ return $connectionState2;
+ });
+ $t2->shouldReceive('ping')
+ ->twice()
+ ->andReturn(true);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertTrue($transport->ping());
+ $this->assertTrue($transport->ping());
+ $this->assertTrue($transport->isStarted());
+ }
+
+ public function XtestTransportShowsAsNotStartedIfAllPingFails()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $t2->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState2) {
+ return $connectionState2;
+ });
+ $t2->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertFalse($transport->ping());
+ $this->assertFalse($transport->isStarted());
+ $this->assertFalse($transport->ping());
+ }
+
+ private function getTransport(array $transports)
{
$transport = new Swift_Transport_FailoverTransport();
$transport->setTransports($transports);
@@ -511,7 +593,7 @@ class Swift_Transport_FailoverTransportTest extends \SwiftMailerTestCase
return $transport;
}
- private function _createPlugin()
+ private function createPlugin()
{
return $this->getMockery('Swift_Events_EventListener');
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php
index f6bb819992..dbc60afa73 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php
@@ -4,8 +4,8 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
public function testEachTransportIsUsedInTurn()
{
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -62,7 +62,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
->never()
->with($message1, \Mockery::any());
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message1));
$this->assertEquals(1, $transport->send($message2));
@@ -70,10 +70,10 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
public function testTransportsAreReusedInRotatingFashion()
{
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
- $message3 = $this->getMockery('Swift_Mime_Message');
- $message4 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message3 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message4 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -154,7 +154,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
->never()
->with($message3, \Mockery::any());
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message1));
@@ -167,7 +167,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -218,14 +218,14 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
$testCase->fail();
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message));
}
public function testMessageIsTriedOnNextTransportIfZeroReturned()
{
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -277,14 +277,14 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
return 0;
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message));
}
public function testZeroIsReturnedIfAllTransportsReturnZero()
{
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -336,7 +336,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
return 1;
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(0, $transport->send($message));
}
@@ -345,10 +345,10 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('maur b0rken');
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
- $message3 = $this->getMockery('Swift_Mime_Message');
- $message4 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message3 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message4 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -408,7 +408,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
$testCase->fail();
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertEquals(1, $transport->send($message1));
$this->assertEquals(1, $transport->send($message2));
@@ -420,7 +420,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -468,7 +468,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
try {
$transport->send($message);
@@ -510,7 +510,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$transport->stop();
}
@@ -519,7 +519,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -567,7 +567,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertTrue($transport->isStarted());
try {
@@ -582,8 +582,8 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
{
$e = new Swift_TransportException('b0rken');
- $message1 = $this->getMockery('Swift_Mime_Message');
- $message2 = $this->getMockery('Swift_Mime_Message');
+ $message1 = $this->getMockery('Swift_Mime_SimpleMessage');
+ $message2 = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
$connectionState1 = false;
@@ -643,7 +643,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
->never()
->with($message2, \Mockery::any());
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->start();
$this->assertTrue($transport->isStarted());
try {
@@ -660,10 +660,10 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
public function testFailureReferenceIsPassedToDelegates()
{
- $failures = array();
+ $failures = [];
$testCase = $this;
- $message = $this->getMockery('Swift_Mime_Message');
+ $message = $this->getMockery('Swift_Mime_SimpleMessage');
$t1 = $this->getMockery('Swift_Transport');
$connectionState = false;
@@ -690,14 +690,14 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
}
});
- $transport = $this->_getTransport(array($t1));
+ $transport = $this->getTransport([$t1]);
$transport->start();
$transport->send($message, $failures);
}
public function testRegisterPluginDelegatesToLoadedTransports()
{
- $plugin = $this->_createPlugin();
+ $plugin = $this->createPlugin();
$t1 = $this->getMockery('Swift_Transport');
$t2 = $this->getMockery('Swift_Transport');
@@ -709,10 +709,99 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
->once()
->with($plugin);
- $transport = $this->_getTransport(array($t1, $t2));
+ $transport = $this->getTransport([$t1, $t2]);
$transport->registerPlugin($plugin);
}
+ public function testEachDelegateIsPinged()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->once()
+ ->andReturn(true);
+
+ $t2->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState2) {
+ return $connectionState2;
+ });
+ $t2->shouldReceive('ping')
+ ->once()
+ ->andReturn(true);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertTrue($transport->isStarted());
+ $this->assertTrue($transport->ping());
+ }
+
+ public function testDelegateIsKilledWhenPingFails()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->twice()
+ ->andReturn(true);
+
+ $t2->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState2) {
+ return $connectionState2;
+ });
+ $t2->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertTrue($transport->ping());
+ $this->assertTrue($transport->ping());
+ $this->assertTrue($transport->isStarted());
+ }
+
+ public function testTransportShowsAsNotStartedIfAllPingFails()
+ {
+ $t1 = $this->getMockery('Swift_Transport');
+ $t2 = $this->getMockery('Swift_Transport');
+
+ $testCase = $this;
+ $t1->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState1) {
+ return $connectionState1;
+ });
+ $t1->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $t2->shouldReceive('isStarted')
+ ->zeroOrMoreTimes()
+ ->andReturnUsing(function () use (&$connectionState2) {
+ return $connectionState2;
+ });
+ $t2->shouldReceive('ping')
+ ->once()
+ ->andReturn(false);
+
+ $transport = $this->getTransport([$t1, $t2]);
+ $this->assertFalse($transport->ping());
+ $this->assertFalse($transport->isStarted());
+ $this->assertFalse($transport->ping());
+ }
+
/**
* Adapted from Yay_Matchers_ReferenceMatcher.
*/
@@ -726,7 +815,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
}
$copy = $ref2;
- $randomString = uniqid('yay');
+ $randomString = uniqid('yay', true);
$ref2 = $randomString;
$isRef = ($ref1 === $ref2);
$ref2 = $copy;
@@ -734,7 +823,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
return $isRef;
}
- private function _getTransport(array $transports)
+ private function getTransport(array $transports)
{
$transport = new Swift_Transport_LoadBalancedTransport();
$transport->setTransports($transports);
@@ -742,7 +831,7 @@ class Swift_Transport_LoadBalancedTransportTest extends \SwiftMailerTestCase
return $transport;
}
- private function _createPlugin()
+ private function createPlugin()
{
return $this->getMockery('Swift_Events_EventListener');
}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php
deleted file mode 100644
index 6672a3d11c..0000000000
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php
+++ /dev/null
@@ -1,533 +0,0 @@
-<?php
-
-/**
- * @group legacy
- */
-class Swift_Transport_MailTransportTest extends \SwiftMailerTestCase
-{
- public function testTransportInvokesMailOncePerMessage()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $invoker->shouldReceive('mail')
- ->once();
-
- $transport->send($message);
- }
-
- public function testTransportUsesToFieldBodyInSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $to = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'To' => $to,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $to->shouldReceive('getFieldBody')
- ->zeroOrMoreTimes()
- ->andReturn('Foo <foo@bar>');
- $invoker->shouldReceive('mail')
- ->once()
- ->with('Foo <foo@bar>', \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testTransportUsesSubjectFieldBodyInSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $subj = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'Subject' => $subj,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $subj->shouldReceive('getFieldBody')
- ->zeroOrMoreTimes()
- ->andReturn('Thing');
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), 'Thing', \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testTransportUsesBodyOfMessage()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('toString')
- ->zeroOrMoreTimes()
- ->andReturn(
- "To: Foo <foo@bar>\r\n".
- "\r\n".
- 'This body'
- );
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), 'This body', \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testTransportSettingUsingReturnPathForExtraParams()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('getReturnPath')
- ->zeroOrMoreTimes()
- ->andReturn(
- 'foo@bar'
- );
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-ffoo@bar');
-
- $transport->send($message);
- }
-
- public function testTransportSettingEmptyExtraParams()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('getReturnPath')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $message->shouldReceive('getSender')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $message->shouldReceive('getFrom')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), null);
-
- $transport->send($message);
- }
-
- public function testTransportSettingSettingExtraParamsWithF()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
- $transport->setExtraParams('-x\'foo\' -f%s');
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('getReturnPath')
- ->zeroOrMoreTimes()
- ->andReturn(
- 'foo@bar'
- );
- $message->shouldReceive('getSender')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $message->shouldReceive('getFrom')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\' -ffoo@bar');
-
- $transport->send($message);
- }
-
- public function testTransportSettingSettingExtraParamsWithoutF()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
- $transport->setExtraParams('-x\'foo\'');
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('getReturnPath')
- ->zeroOrMoreTimes()
- ->andReturn(
- 'foo@bar'
- );
- $message->shouldReceive('getSender')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $message->shouldReceive('getFrom')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\'');
-
- $transport->send($message);
- }
-
- public function testTransportSettingInvalidFromEmail()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('getReturnPath')
- ->zeroOrMoreTimes()
- ->andReturn(
- '"attacker\" -oQ/tmp/ -X/var/www/cache/phpcode.php "@email.com'
- );
- $message->shouldReceive('getSender')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $message->shouldReceive('getFrom')
- ->zeroOrMoreTimes()
- ->andReturn(null);
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), null);
-
- $transport->send($message);
- }
-
- public function testTransportUsesHeadersFromMessage()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessageWithRecipient($headers);
-
- $message->shouldReceive('toString')
- ->zeroOrMoreTimes()
- ->andReturn(
- "Subject: Stuff\r\n".
- "\r\n".
- 'This body'
- );
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), 'Subject: Stuff'.PHP_EOL, \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testTransportReturnsCountOfAllRecipientsIfInvokerReturnsTrue()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessage($headers);
-
- $message->shouldReceive('getTo')
- ->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null, 'zip@button' => null));
- $message->shouldReceive('getCc')
- ->zeroOrMoreTimes()
- ->andReturn(array('test@test' => null));
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any())
- ->andReturn(true);
-
- $this->assertEquals(3, $transport->send($message));
- }
-
- public function testTransportReturnsZeroIfInvokerReturnsFalse()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessage($headers);
-
- $message->shouldReceive('getTo')
- ->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => null, 'zip@button' => null));
- $message->shouldReceive('getCc')
- ->zeroOrMoreTimes()
- ->andReturn(array('test@test' => null));
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any())
- ->andReturn(false);
-
- $this->assertEquals(0, $transport->send($message));
- }
-
- public function testToHeaderIsRemovedFromHeaderSetDuringSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $to = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'To' => $to,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $headers->shouldReceive('remove')
- ->once()
- ->with('To');
- $headers->shouldReceive('remove')
- ->zeroOrMoreTimes();
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testSubjectHeaderIsRemovedFromHeaderSetDuringSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $subject = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'Subject' => $subject,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $headers->shouldReceive('remove')
- ->once()
- ->with('Subject');
- $headers->shouldReceive('remove')
- ->zeroOrMoreTimes();
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testToHeaderIsPutBackAfterSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $to = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'To' => $to,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $headers->shouldReceive('set')
- ->once()
- ->with($to);
- $headers->shouldReceive('set')
- ->zeroOrMoreTimes();
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testSubjectHeaderIsPutBackAfterSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $subject = $this->_createHeader();
- $headers = $this->_createHeaders(array(
- 'Subject' => $subject,
- ));
- $message = $this->_createMessageWithRecipient($headers);
-
- $headers->shouldReceive('set')
- ->once()
- ->with($subject);
- $headers->shouldReceive('set')
- ->zeroOrMoreTimes();
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any());
-
- $transport->send($message);
- }
-
- public function testMessageHeadersOnlyHavePHPEolsDuringSending()
- {
- $invoker = $this->_createInvoker();
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $subject = $this->_createHeader();
- $subject->shouldReceive('getFieldBody')->andReturn("Foo\r\nBar");
-
- $headers = $this->_createHeaders(array(
- 'Subject' => $subject,
- ));
- $message = $this->_createMessageWithRecipient($headers);
- $message->shouldReceive('toString')
- ->zeroOrMoreTimes()
- ->andReturn(
- "From: Foo\r\n<foo@bar>\r\n".
- "\r\n".
- "This\r\n".
- 'body'
- );
-
- if ("\r\n" != PHP_EOL) {
- $expectedHeaders = "From: Foo\n<foo@bar>\n";
- $expectedSubject = "Foo\nBar";
- $expectedBody = "This\nbody";
- } else {
- $expectedHeaders = "From: Foo\r\n<foo@bar>\r\n";
- $expectedSubject = "Foo\r\nBar";
- $expectedBody = "This\r\nbody";
- }
-
- $invoker->shouldReceive('mail')
- ->once()
- ->with(\Mockery::any(), $expectedSubject, $expectedBody, $expectedHeaders, \Mockery::any());
-
- $transport->send($message);
- }
-
- /**
- * @expectedException \Swift_TransportException
- * @expectedExceptionMessage Cannot send message without a recipient
- */
- public function testExceptionWhenNoRecipients()
- {
- $invoker = $this->_createInvoker();
- $invoker->shouldReceive('mail');
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessage($headers);
-
- $transport->send($message);
- }
-
- public function noExceptionWhenRecipientsExistProvider()
- {
- return array(
- array('To'),
- array('Cc'),
- array('Bcc'),
- );
- }
-
- /**
- * @dataProvider noExceptionWhenRecipientsExistProvider
- *
- * @param string $header
- */
- public function testNoExceptionWhenRecipientsExist($header)
- {
- $invoker = $this->_createInvoker();
- $invoker->shouldReceive('mail');
- $dispatcher = $this->_createEventDispatcher();
- $transport = $this->_createTransport($invoker, $dispatcher);
-
- $headers = $this->_createHeaders();
- $message = $this->_createMessage($headers);
- $message->shouldReceive(sprintf('get%s', $header))->andReturn(array('foo@bar' => 'Foo'));
-
- $transport->send($message);
- }
-
- private function _createTransport($invoker, $dispatcher)
- {
- return new Swift_Transport_MailTransport($invoker, $dispatcher);
- }
-
- private function _createEventDispatcher()
- {
- return $this->getMockery('Swift_Events_EventDispatcher')->shouldIgnoreMissing();
- }
-
- private function _createInvoker()
- {
- return $this->getMockery('Swift_Transport_MailInvoker');
- }
-
- private function _createMessage($headers)
- {
- $message = $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing();
- $message->shouldReceive('getHeaders')
- ->zeroOrMoreTimes()
- ->andReturn($headers);
-
- return $message;
- }
-
- private function _createMessageWithRecipient($headers, $recipient = array('foo@bar' => 'Foo'))
- {
- $message = $this->_createMessage($headers);
- $message->shouldReceive('getTo')->andReturn($recipient);
-
- return $message;
- }
-
- private function _createHeaders($headers = array())
- {
- $set = $this->getMockery('Swift_Mime_HeaderSet')->shouldIgnoreMissing();
-
- if (count($headers) > 0) {
- foreach ($headers as $name => $header) {
- $set->shouldReceive('get')
- ->zeroOrMoreTimes()
- ->with($name)
- ->andReturn($header);
- $set->shouldReceive('has')
- ->zeroOrMoreTimes()
- ->with($name)
- ->andReturn(true);
- }
- }
-
- $header = $this->_createHeader();
- $set->shouldReceive('get')
- ->zeroOrMoreTimes()
- ->andReturn($header);
- $set->shouldReceive('has')
- ->zeroOrMoreTimes()
- ->andReturn(true);
-
- return $set;
- }
-
- private function _createHeader()
- {
- return $this->getMockery('Swift_Mime_Header')->shouldIgnoreMissing();
- }
-}
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php
index 9040f9ea4d..fe40d6c8a0 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php
@@ -2,31 +2,30 @@
class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtpEventSupportTest
{
- protected function _getTransport($buf, $dispatcher = null, $command = '/usr/sbin/sendmail -bs')
+ protected function getTransport($buf, $dispatcher = null, $addressEncoder = null, $command = '/usr/sbin/sendmail -bs')
{
if (!$dispatcher) {
- $dispatcher = $this->_createEventDispatcher();
+ $dispatcher = $this->createEventDispatcher();
}
- $transport = new Swift_Transport_SendmailTransport($buf, $dispatcher);
+ $transport = new Swift_Transport_SendmailTransport($buf, $dispatcher, 'example.org', $addressEncoder);
$transport->setCommand($command);
return $transport;
}
- protected function _getSendmail($buf, $dispatcher = null)
+ protected function getSendmail($buf, $dispatcher = null)
{
if (!$dispatcher) {
- $dispatcher = $this->_createEventDispatcher();
+ $dispatcher = $this->createEventDispatcher();
}
- $sendmail = new Swift_Transport_SendmailTransport($buf, $dispatcher);
- return $sendmail;
+ return new Swift_Transport_SendmailTransport($buf, $dispatcher);
}
public function testCommandCanBeSetAndFetched()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getSendmail($buf);
+ $buf = $this->getBuffer();
+ $sendmail = $this->getSendmail($buf);
$sendmail->setCommand('/usr/sbin/sendmail -bs');
$this->assertEquals('/usr/sbin/sendmail -bs', $sendmail->getCommand());
@@ -36,13 +35,13 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
public function testSendingMessageIn_t_ModeUsesSimplePipe()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getSendmail($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $sendmail = $this->getSendmail($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));
+ ->andReturn(['foo@bar' => 'Foobar', 'zip@button' => 'Zippy']);
$message->shouldReceive('toByteStream')
->once()
->with($buf);
@@ -52,10 +51,10 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
->once();
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array("\r\n" => "\n", "\n." => "\n.."));
+ ->with(["\r\n" => "\n", "\n." => "\n.."]);
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array());
+ ->with([]);
$sendmail->setCommand('/usr/sbin/sendmail -t');
$this->assertEquals(2, $sendmail->send($message));
@@ -63,13 +62,13 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
public function testSendingIn_t_ModeWith_i_FlagDoesntEscapeDot()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getSendmail($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $sendmail = $this->getSendmail($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));
+ ->andReturn(['foo@bar' => 'Foobar', 'zip@button' => 'Zippy']);
$message->shouldReceive('toByteStream')
->once()
->with($buf);
@@ -79,10 +78,10 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
->once();
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array("\r\n" => "\n"));
+ ->with(["\r\n" => "\n"]);
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array());
+ ->with([]);
$sendmail->setCommand('/usr/sbin/sendmail -i -t');
$this->assertEquals(2, $sendmail->send($message));
@@ -90,13 +89,13 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
public function testSendingInTModeWith_oi_FlagDoesntEscapeDot()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getSendmail($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $sendmail = $this->getSendmail($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));
+ ->andReturn(['foo@bar' => 'Foobar', 'zip@button' => 'Zippy']);
$message->shouldReceive('toByteStream')
->once()
->with($buf);
@@ -106,10 +105,10 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
->once();
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array("\r\n" => "\n"));
+ ->with(["\r\n" => "\n"]);
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array());
+ ->with([]);
$sendmail->setCommand('/usr/sbin/sendmail -oi -t');
$this->assertEquals(2, $sendmail->send($message));
@@ -117,13 +116,13 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
public function testSendingMessageRegeneratesId()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getSendmail($buf);
- $message = $this->_createMessage();
+ $buf = $this->getBuffer();
+ $sendmail = $this->getSendmail($buf);
+ $message = $this->createMessage();
$message->shouldReceive('getTo')
->zeroOrMoreTimes()
- ->andReturn(array('foo@bar' => 'Foobar', 'zip@button' => 'Zippy'));
+ ->andReturn(['foo@bar' => 'Foobar', 'zip@button' => 'Zippy']);
$message->shouldReceive('generateId');
$buf->shouldReceive('initialize')
->once();
@@ -131,10 +130,10 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
->once();
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array("\r\n" => "\n", "\n." => "\n.."));
+ ->with(["\r\n" => "\n", "\n." => "\n.."]);
$buf->shouldReceive('setWriteTranslations')
->once()
- ->with(array());
+ ->with([]);
$sendmail->setCommand('/usr/sbin/sendmail -t');
$this->assertEquals(2, $sendmail->send($message));
@@ -142,8 +141,8 @@ class Swift_Transport_SendmailTransportTest extends Swift_Transport_AbstractSmtp
public function testFluidInterface()
{
- $buf = $this->_getBuffer();
- $sendmail = $this->_getTransport($buf);
+ $buf = $this->getBuffer();
+ $sendmail = $this->getTransport($buf);
$ref = $sendmail->setCommand('/foo');
$this->assertEquals($ref, $sendmail);
diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php
index 5109b56b28..540709afc7 100644
--- a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php
+++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php
@@ -1,42 +1,42 @@
<?php
-class Swift_Transport_StreamBufferTest extends \PHPUnit_Framework_TestCase
+class Swift_Transport_StreamBufferTest extends \PHPUnit\Framework\TestCase
{
public function testSettingWriteTranslationsCreatesFilters()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->once())
->method('createFilter')
->with('a', 'b')
- ->will($this->returnCallback(array($this, '_createFilter')));
+ ->will($this->returnCallback([$this, 'createFilter']));
- $buffer = $this->_createBuffer($factory);
- $buffer->setWriteTranslations(array('a' => 'b'));
+ $buffer = $this->createBuffer($factory);
+ $buffer->setWriteTranslations(['a' => 'b']);
}
public function testOverridingTranslationsOnlyAddsNeededFilters()
{
- $factory = $this->_createFactory();
+ $factory = $this->createFactory();
$factory->expects($this->exactly(2))
->method('createFilter')
- ->will($this->returnCallback(array($this, '_createFilter')));
+ ->will($this->returnCallback([$this, 'createFilter']));
- $buffer = $this->_createBuffer($factory);
- $buffer->setWriteTranslations(array('a' => 'b'));
- $buffer->setWriteTranslations(array('x' => 'y', 'a' => 'b'));
+ $buffer = $this->createBuffer($factory);
+ $buffer->setWriteTranslations(['a' => 'b']);
+ $buffer->setWriteTranslations(['x' => 'y', 'a' => 'b']);
}
- private function _createBuffer($replacementFactory)
+ private function createBuffer($replacementFactory)
{
return new Swift_Transport_StreamBuffer($replacementFactory);
}
- private function _createFactory()
+ private function createFactory()
{
return $this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock();
}
- public function _createFilter()
+ public function createFilter()
{
return $this->getMockBuilder('Swift_StreamFilter')->getMock();
}