Creates an instance based on the Message.

@param Message $msg

@return WorkerHandlerStatus
970200
public static function fromMessage(Message $msg)
    {
        $workerHandlerId = $msg->shift();
        $requestId = $msg->shift();
        if (!$requestId) {
            $requestId = null;
        }

        return new self($workerHandlerId, $requestId);
    }
437066
public static function createProtocolMessage(Message $msg)
    {
        $version = $msg->shift();
        if (!self::hasProtocolVersion(($version))) {
            throw new UnknownProtocolVersionException();
        }

        $type = $msg->shift();
        $class = self::getClassByType($type);

        return $class::fromMessage($msg);
    }
323562
public function executeMsg(JobMessage $msg, ExecutionContext $execution = null)
    {
        if (null === $execution) {
            $execution = $this->createJobExecutionFromMessage($msg);
        }

        return $msg->execute($execution, $this->msgFactory);
    }
510875
private function create($messageClass, $message)
    {
        $interfaces = array_values(class_implements($messageClass, true));
        return new IncomingLogicalMessage($message, $messageClass, $interfaces);
    }
1292018
public static function fromMessage(Message $msg)
    {
        $request_id = $msg->shift();
        $result     = $msg->shift() ?: '';

        return new self($request_id, $result);
    }
1198616
public function onClientHandlerMessage(ClientHandlerJobRequest $msg)
    {
        $request = new Request($msg->getRequestId(), $msg->getActionName(), $msg->getParameters());
        $this->addRequest($request);

        $this->getStream('clientHandler')->send(
            new ClientHandlerJobResponse(
                $msg->getRequestId(),
                $this->getId()
            )
        );
    }
1329775
public function ShowBanner($msg) {
	/*//
	print a header banner to the console with a message inside it.
	//*/

		$linefill = (75 - (strlen($msg) + 4));
		printf('%s%s%s',PHP_EOL,str_repeat('=',75),PHP_EOL);
		printf('== %s %s%s%s',$msg,str_repeat('=',$linefill),PHP_EOL,PHP_EOL);
		return $this;
	}
320727
protected function log($msg, $priority = Propel::LOG_INFO)
    {
        return Propel::log(get_class($this) . ': ' . $msg, $priority);
    }
676245
public function create($msg)
    {
        // Verificar se mensagem pode ser traduzida pelo sistema da Lang do Laravel
        if (is_string($msg) && ($this->lang->has($msg)))
            $msg = $this->lang->get($msg);

        // Se msg for um objeto ou array deve fazer um print_r
        if (is_object($msg) || is_array($msg))
            $msg = print_r($msg, true);

        $args    = func_get_args();
        $args[0] = $msg;
        $msg     = trim(call_user_func_array('sprintf', $args));

        $code = $args[count($args) - 1];

        if (is_numeric($code))
            return new \Exception($msg, $code);
        else
            return new \Exception($msg);
    }
28108
public static function fromMessage(Message $msg)
    {
        $queueStatus = array();
        while ($msg->peek() !== null) {
            $action = $msg->shift();
            $queueStatus[$action] = array(
                'action'    => $action,
                'queue'     => $msg->shift(),
                'busy'      => $msg->shift(),
                'available' => $msg->shift()
            );
        }

        return new self($queueStatus);
    }
516823
public static function parse(string $msg): Message
    {
        $obj = new self;
        $parts = explode("\r\n", $msg);
        $obj->body = MessageBody::parse(array_pop($parts));
        foreach ($parts as $line) {
            if ($line) {
                $pair = explode(': ', $line);
                $obj->headers[$pair[0]] = $pair[1];
            }
        }
        return $obj;
    }
913299
public function setError(array $msg)
    {
        if (!isset($msg['msg']))
            throw new InvalidArgumentException("Error message does not contain msg key");

        $this->errors = [$msg];
        $this->fixed_error = $msg;
        return $this;
    }
986357
public static function getInstance(): MessageHelper {
		if (empty(self::$instance)) {
			self::$instance = new MessageHelper();
		}

		return self::$instance;
	}
115208
public static function create(MessageInterface $rawMessage): self
    {
        $message = new static(function () use ($rawMessage) {
            return $rawMessage->getBody();
        });

        $message->setRawMessage($rawMessage);

        return $message;
    }
1286318
public function debug($msg)
    {
        if ($this->iniGetBool('display_errors') === true) {
            $this->write((string)$msg, 'DEBUG');
        }

        return $this;
    }
1073356
public function onWorkerHandlerStatusMessage(WorkerHandlerStatus $msg)
    {
        $handlerId = $msg->getWorkerHandlerId();

        if (isset($this->workerHandlers[$handlerId])) {
            // Remove to make sure the handlers are ordered by time.
            unset($this->workerHandlers[$handlerId]);
        }

        $this->workerHandlers[$handlerId] = microtime(true);

        $requestId = $msg->getRequestId();

        if ($requestId === null) {
            return;
        }

        $this->getLogger()->debug('Storage has a result available for: '.$requestId.'.');

        $this->sendResponseToClients($requestId);
    }
762151
public static function log($msg)
    {
        if (!self::$_enabled) {
            return;
        }

        if (is_null(self::$_file)) {
            echo "log: $msg\n";
            return;
        }

        return self::_logToFile($msg);
    }