Skip to content

Commit 82edcf9

Browse files
committed
[ADD] Builder and Helper improvements
1 parent fdf7aa9 commit 82edcf9

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/BuilderAbstract.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,7 @@ public abstract function cartWithItems();
134134

135135
public abstract function deliveryMethod();
136136

137-
public function items()
138-
{
139-
return array_merge(
140-
$this->productItem(),
141-
$this->extraItems(),
142-
$this->handlingItems()
143-
);
144-
}
145-
146-
public abstract function handlingItems();
137+
public abstract function items();
147138

148139
public abstract function customer();
149140

src/Helper.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
class Helper {
1010
const ISO8601_PATTERN = '^((\d{4})-([0-1]\d)-([0-3]\d))+$|P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$';
11+
static $centsPerWhole = 100;
12+
1113

1214
public static function isConsistentCart( $cart ) {
1315
$totals = self::totals( $cart );
@@ -42,4 +44,8 @@ public static function removeNulls( $data ) {
4244
public static function notNull( $value1, $value2 ) {
4345
return is_null( $value1 ) ? $value2 : $value1;
4446
}
47+
48+
public static function integerPrice( $price ) {
49+
return intval( round( self::$centsPerWhole * $price ) );
50+
}
4551
}

0 commit comments

Comments
 (0)