Making WordPress.org


Ignore:
Timestamp:
05/21/2024 11:43:05 AM (2 years ago)
Author:
amieiro
Message:

Translate: Sync "Translation Events" from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/event/event.php

    r13683 r13739  
    2626}
    2727
    28 class InvalidTitle extends Exception {
    29         public function __construct( Throwable $previous = null ) {
    30                 parent::__construct( 'Event title is invalid', 0, $previous );
    31         }
    32 }
    33 
    3428class InvalidStatus extends Exception {
    3529        public function __construct( Throwable $previous = null ) {
     
    5347         * @throws InvalidEnd
    5448         * @throws InvalidStatus
    55          * @throws InvalidTitle
    5649         */
    5750        public function __construct(
     
    8679        public function end(): Event_End_Date {
    8780                return $this->end;
     81        }
     82
     83        public function is_published(): bool {
     84                return 'publish' === $this->status;
     85        }
     86
     87        public function is_draft(): bool {
     88                return 'draft' === $this->status;
    8889        }
    8990
     
    152153        }
    153154
    154         /**
    155          * @throws InvalidTitle
    156          */
    157155        public function set_title( string $title ): void {
    158                 if ( ! $title ) {
    159                         throw new InvalidTitle();
    160                 }
    161156                $this->title = $title;
    162157        }
Note: See TracChangeset for help on using the changeset viewer.