Skip to content

Commit

Permalink
Merge pull request #15 from daniellienert/bugfix/fix-interface
Browse files Browse the repository at this point in the history
BUGFIX: Require Swift_Transport instead of TransportInterface
  • Loading branch information
kdambekalns authored Jan 1, 2019
2 parents e732f46 + b1c2356 commit c841a19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Classes/TransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class TransportFactory
* @param string $transportType Object name of the transport to create
* @param array $transportOptions Options for the transport
* @param array $transportArguments Constructor arguments for the transport
* @return TransportInterface The created transport instance
* @return \Swift_Transport The created transport instance
* @throws Exception
* @throws \ReflectionException
*/
public function create(string $transportType, array $transportOptions = [], array $transportArguments = null): TransportInterface
public function create(string $transportType, array $transportOptions = [], array $transportArguments = null): \Swift_Transport
{
if (!class_exists($transportType)) {
throw new Exception(sprintf('The specified transport backend "%s" does not exist.', $transportType), 1269351207);
Expand All @@ -44,7 +44,7 @@ public function create(string $transportType, array $transportOptions = [], arra
$transport = new $transportType();
}

if ($transport instanceof TransportInterface) {
if ($transport instanceof \Swift_Transport) {
foreach ($transportOptions as $optionName => $optionValue) {
if (ObjectAccess::isPropertySettable($transport, $optionName)) {
ObjectAccess::setProperty($transport, $optionName, $optionValue);
Expand All @@ -54,6 +54,6 @@ public function create(string $transportType, array $transportOptions = [], arra
return $transport;
}

throw new Exception(sprintf('The specified transport backend "%s" does not implement %s.', $transportType, TransportInterface::class), 1544727431);
throw new Exception(sprintf('The specified transport backend "%s" does not implement %s.', $transportType, \Swift_Transport::class), 1544727431);
}
}

0 comments on commit c841a19

Please sign in to comment.