src/General/Motor/MotorStatusMessageFactory.php
public function create(NetworkRawMessage $rawMessage): IncomingMessage
    {
        $data = $rawMessage->getData();
        $this->validateArray($data, 'motors');

        $motors = [];
        foreach ($data['motors'] as $motor) {
            $this->validateNumeric($motor, 'id');
            $this->validateNumeric($motor, 'pin');
            $this->validateNumeric($motor, 'power');

            $motors[] = new Motor($motor['id'], $motor['power'], $motor['pin']);
        }

        return new IncomingMotorStatusMessage($rawMessage->getSender(), new MotorStatus($motors));
    }
public function create(NetworkRawMessage $rawMessage): IncomingMessage
    {
        $data = $rawMessage->getData();
        $this->validateArray($data, 'motors');

        $motors = [];
        foreach ($data['motors'] as $motor) {
            $this->validateNumeric($motor, 'id');
            $this->validateNumeric($motor, 'pin');
            $this->validateNumeric($motor, 'power');

            $motors[] = new Motor($motor['id'], $motor['power'], $motor['pin']);
        }

        return new IncomingMotorStatusMessage($rawMessage->getSender(), new MotorStatus($motors));
    }
@param NetworkRawMessage $rawMessage

@return IncomingMotorStatusMessage|IncomingMessage