| @@ 45-58 (lines=14) @@ | ||
| 42 | * @param string $offset |
|
| 43 | * @return mixed |
|
| 44 | */ |
|
| 45 | public function offsetGet( $offset ) { |
|
| 46 | if ( 'line_subtotal' === $offset ) { |
|
| 47 | $offset = 'subtotal'; |
|
| 48 | } elseif ( 'line_subtotal_tax' === $offset ) { |
|
| 49 | $offset = 'subtotal_tax'; |
|
| 50 | } elseif ( 'line_total' === $offset ) { |
|
| 51 | $offset = 'total'; |
|
| 52 | } elseif ( 'line_tax' === $offset ) { |
|
| 53 | $offset = 'total_tax'; |
|
| 54 | } elseif ( 'line_tax_data' === $offset ) { |
|
| 55 | $offset = 'taxes'; |
|
| 56 | } |
|
| 57 | return parent::offsetGet( $offset ); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * offsetSet for ArrayAccess/Backwards compatibility. |
|
| @@ 66-79 (lines=14) @@ | ||
| 63 | * @param string $offset |
|
| 64 | * @param mixed $value |
|
| 65 | */ |
|
| 66 | public function offsetSet( $offset, $value ) { |
|
| 67 | if ( 'line_subtotal' === $offset ) { |
|
| 68 | $offset = 'subtotal'; |
|
| 69 | } elseif ( 'line_subtotal_tax' === $offset ) { |
|
| 70 | $offset = 'subtotal_tax'; |
|
| 71 | } elseif ( 'line_total' === $offset ) { |
|
| 72 | $offset = 'total'; |
|
| 73 | } elseif ( 'line_tax' === $offset ) { |
|
| 74 | $offset = 'total_tax'; |
|
| 75 | } elseif ( 'line_tax_data' === $offset ) { |
|
| 76 | $offset = 'taxes'; |
|
| 77 | } |
|
| 78 | parent::offsetSet( $offset, $value ); |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * offsetExists for ArrayAccess |
|