__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* Notification Factory
*/
declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\StockNotifications;
use Automattic\WooCommerce\Internal\StockNotifications\Notification;
defined( 'ABSPATH' ) || exit;
/**
* Notification factory class
*/
class Factory {
/**
* Get the notification object.
*
* @param int $notification_id Notification ID to get.
* @return Notification|bool
*/
public static function get_notification( int $notification_id ) {
if ( ! $notification_id ) {
return false;
}
try {
$notification = new Notification( $notification_id );
return $notification;
} catch ( \Exception $e ) {
\wc_caught_exception( $e, __FUNCTION__, array( $notification_id ) );
return false;
}
}
/**
* Create a dummy notification for preview/testing purposes.
*
* @return Notification
*/
public static function create_dummy_notification(): Notification {
$notification = new Notification();
// Create a dummy product.
$product = new \WC_Product();
$product->set_name( __( 'Dummy Product', 'woocommerce' ) );
$product->set_price( 25 );
$product->set_image_id( get_option( 'woocommerce_placeholder_image', 0 ) );
// Set required notification data.
$notification->set_product_id( $product->get_id() );
$notification->set_user_email( '[email protected]' );
// Store the dummy product in the notification object for preview.
$notification->product = $product;
return $notification;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Admin | Folder | 0775 |
|
|
| AsyncTasks | Folder | 0775 |
|
|
| Emails | Folder | 0775 |
|
|
| Enums | Folder | 0775 |
|
|
| Frontend | Folder | 0775 |
|
|
| Privacy | Folder | 0775 |
|
|
| Utilities | Folder | 0775 |
|
|
| Config.php | File | 4.95 KB | 0664 |
|
| DataRetentionController.php | File | 3.1 KB | 0664 |
|
| Factory.php | File | 1.45 KB | 0664 |
|
| Notification.php | File | 13.2 KB | 0664 |
|
| NotificationQuery.php | File | 1.63 KB | 0664 |
|
| StockNotifications.php | File | 2.47 KB | 0664 |
|
| StockSyncController.php | File | 5.32 KB | 0664 |
|