with-notices-trait.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Components\Admin\Notices\Traits; |
| 5 | |
| 6 | use JFB_Components\Admin\Notices\Notices_Repository; |
| 7 | |
| 8 | // If this file is called directly, abort. |
| 9 | if ( ! defined( 'WPINC' ) ) { |
| 10 | die; |
| 11 | } |
| 12 | |
| 13 | trait With_Notices_Trait { |
| 14 | |
| 15 | private $notices; |
| 16 | |
| 17 | public function notices(): Notices_Repository { |
| 18 | if ( ! $this->notices ) { |
| 19 | $this->notices = new Notices_Repository(); |
| 20 | } |
| 21 | |
| 22 | return $this->notices; |
| 23 | } |
| 24 | |
| 25 | } |
| 26 |