static public function create(array $data = null)
    {
        if (empty($data["type"]) && isset($data["transaction"])) {
            $type = $data["transaction"]["type"];
        }
        elseif (! $data || empty($data["type"])) {
            return new static($data);
        }
        else {
            $type = $data["type"];
        }

        // valid transaction type input
        $validTypes = array_keys(self::$typesClassMap);
        if (! $type || ! in_array($type, $validTypes)) {
            $type = TransactionType::TRANSFER;
        }

        // mutate transaction (morph specialized class)
        $classTx = self::$typesClassMap[$type];

        if ($type === TransactionType::TRANSFER
            && in_array($data["version"], [self::VERSION_2, self::VERSION_2_TEST, self::VERSION_2_MIJIN])) {

            $classTx = "\\NEM\\Models\\Transaction\\MosaicTransfer";
        }

        return new $classTx($data);
    }
static public function create(array $data = null)
    {
        if (empty($data["type"]) && isset($data["transaction"])) {
            $type = $data["transaction"]["type"];
        }
        elseif (! $data || empty($data["type"])) {
            return new static($data);
        }
        else {
            $type = $data["type"];
        }

        // valid transaction type input
        $validTypes = array_keys(self::$typesClassMap);
        if (! $type || ! in_array($type, $validTypes)) {
            $type = TransactionType::TRANSFER;
        }

        // mutate transaction (morph specialized class)
        $classTx = self::$typesClassMap[$type];

        if ($type === TransactionType::TRANSFER
            && in_array($data["version"], [self::VERSION_2, self::VERSION_2_TEST, self::VERSION_2_MIJIN])) {

            $classTx = "\\NEM\\Models\\Transaction\\MosaicTransfer";
        }

        return new $classTx($data);
    }
static public function create ( array $ data = null ) { if ( empty ( $ data [ "type" ] ) && isset ( $ data [ "transaction" ] ) ) { $ type = $ data [ "transaction" ] [ "type" ] ; } elseif ( ! $ data || empty ( $ data [ "type" ] ) ) { return new static ( $ data ) ; } else { $ type = $ data [ "type" ] ; } // valid transaction type input $ validTypes = array_keys ( self :: $ typesClassMap ) ; if ( ! $ type || ! in_array ( $ type , $ validTypes ) ) { $ type = TransactionType :: TRANSFER ; } // mutate transaction (morph specialized class) $ classTx = self :: $ typesClassMap [ $ type ] ; if ( $ type === TransactionType :: TRANSFER && in_array ( $ data [ "version" ] , [ self :: VERSION_2 , self :: VERSION_2_TEST , self :: VERSION_2_MIJIN ] ) ) { $ classTx = "\\NEM\\Models\\Transaction\\MosaicTransfer" ; } return new $ classTx ( $ data ) ; }
Class method to create a Transaction object out of
a DTO data set.

The `type` field is used to determine which class
must be loaded, see the static `typeClassMap` property
for details.
Class method to create a Transaction object out of a DTO data set .