public static function normalizeOutputsStruct(array $outputs) {
        $result = [];

        foreach ($outputs as $k => $v) {
            if (is_numeric($k)) {
                if (!is_array($v)) {
                    throw new \InvalidArgumentException("outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]");
                }

                if (isset($v['address']) && isset($v['value'])) {
                    $address = $v['address'];
                    $value = $v['value'];
                } elseif (count($v) == 2 && isset($v[0]) && isset($v[1])) {
                    $address = $v[0];
                    $value = $v[1];
                } else {
                    throw new \InvalidArgumentException("outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]");
                }
            } else {
                $address = $k;
                $value = $v;
            }

            $result[] = ['address' => $address, 'value' => $value];
        }

        return $result;
    }
public static function normalizeOutputsStruct(array $outputs) {
        $result = [];

        foreach ($outputs as $k => $v) {
            if (is_numeric($k)) {
                if (!is_array($v)) {
                    throw new \InvalidArgumentException("outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]");
                }

                if (isset($v['address']) && isset($v['value'])) {
                    $address = $v['address'];
                    $value = $v['value'];
                } elseif (count($v) == 2 && isset($v[0]) && isset($v[1])) {
                    $address = $v[0];
                    $value = $v[1];
                } else {
                    throw new \InvalidArgumentException("outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]");
                }
            } else {
                $address = $k;
                $value = $v;
            }

            $result[] = ['address' => $address, 'value' => $value];
        }

        return $result;
    }
public static function normalizeOutputsStruct ( array $ outputs ) { $ result = [ ] ; foreach ( $ outputs as $ k => $ v ) { if ( is_numeric ( $ k ) ) { if ( ! is_array ( $ v ) ) { throw new \ InvalidArgumentException ( "outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]" ) ; } if ( isset ( $ v [ 'address' ] ) && isset ( $ v [ 'value' ] ) ) { $ address = $ v [ 'address' ] ; $ value = $ v [ 'value' ] ; } elseif ( count ( $ v ) == 2 && isset ( $ v [ 0 ] ) && isset ( $ v [ 1 ] ) ) { $ address = $ v [ 0 ] ; $ value = $ v [ 1 ] ; } else { throw new \ InvalidArgumentException ( "outputs should be [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]" ) ; } } else { $ address = $ k ; $ value = $ v ; } $ result [ ] = [ 'address' => $ address , 'value' => $ value ] ; } return $ result ; }
parse outputs into normalized struct

@param array $outputs    [address => value, ] or [[address, value], ] or [['address' => address, 'value' => value], ]
@return array            [['address' => address, 'value' => value], ]
parse outputs into normalized struct