Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce
Coupon_Code_Generator::extract_ids
Extract integer IDs from an array of {id, title} objects.
Метод класса: Coupon_Code_Generator{}
Хуков нет.
Возвращает
array. Array of integer IDs.
Использование
// private - только в коде основоного (родительского) класса $result = $this->extract_ids( $items ): array;
- $items(массив) (обязательный)
- Array of items with
'id'key.
Код Coupon_Code_Generator::extract_ids() Coupon Code Generator::extract ids WC 11.2.2
private function extract_ids( array $items ): array {
return array_map(
function ( $item ): int {
if ( ! is_array( $item ) ) {
return 0;
}
$id = $item['id'] ?? 0;
return is_numeric( $id ) ? (int) $id : 0;
},
$items
);
}