for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace RM\SMSender;
use ReflectionClass;
class MessageFactory implements IMessageFactory
{
/**
* @var string
*/
public $class;
* List of methods with values for Message
* @var array
public $params = [];
* @return IMessage
public function create()
$message = new $this->class;
foreach ($this->params as $method => $value) {
if ((new ReflectionClass($message))->hasMethod($method)) {
$message->$method($value);
}
return $message;