public static function createWriter($element)
{
if ($element instanceof WriterInterface) {
$writer = $element;
} elseif (isset($element['writer']) && $element['writer'] instanceof WriterInterface) {
$writer = $element['writer'];
} else {
throw new InvalidArgumentException('Workflow::addWriter() must be called with either an instance of ' . '"Plum\\Plum\\Writer\\WriterInterface" or with an array that contains ' . '"writer".');
}
$pipe = new self($element);
$pipe->writer = $writer;
return $pipe;
}