Ad_Repository.php
| 1 | <?php // phpcs:ignore WordPress.Files.FileName |
| 2 | |
| 3 | namespace Advanced_Ads; |
| 4 | |
| 5 | use AdvancedAds\Abstracts\Ad; |
| 6 | |
| 7 | /** |
| 8 | * Ad Repository/Factory class. |
| 9 | * |
| 10 | * @deprecated 2.0.0 |
| 11 | */ |
| 12 | class Ad_Repository { |
| 13 | /** |
| 14 | * Get the ad object from the repository. Create and add it, if it doesn't exist. |
| 15 | * If the passed id is not an ad, return the created ad object without adding it to the repository. |
| 16 | * This behavior prevents breaking changes. |
| 17 | * |
| 18 | * @deprecated 2.0.0 |
| 19 | * |
| 20 | * @param int $id The ad id to look for. |
| 21 | * |
| 22 | * @return Ad|bool |
| 23 | */ |
| 24 | public static function get( int $id ) { |
| 25 | return wp_advads_get_ad( $id ); |
| 26 | } |
| 27 | } |
| 28 |