Making WordPress.org


Ignore:
Timestamp:
05/09/2024 08:33:51 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/attendee/attendee.php

    r13529 r13683  
    1111
    1212        /**
     13         * @var string[]
     14         */
     15        private array $contributed_locales;
     16
     17        /**
    1318         * @throws Exception
    1419         */
    15         public function __construct( int $event_id, int $user_id ) {
     20        public function __construct( int $event_id, int $user_id, bool $is_host = false, array $contributed_locales = array() ) {
    1621                if ( $event_id < 1 ) {
    1722                        throw new Exception( 'invalid event id' );
     
    2126                }
    2227
    23                 $this->event_id = $event_id;
    24                 $this->user_id  = $user_id;
    25                 $this->is_host  = false;
     28                $this->event_id            = $event_id;
     29                $this->user_id             = $user_id;
     30                $this->is_host             = $is_host;
     31                $this->contributed_locales = $contributed_locales;
    2632        }
    2733
     
    3844        }
    3945
     46        public function is_contributor(): bool {
     47                return ! empty( $this->contributed_locales );
     48        }
     49
    4050        public function mark_as_host(): void {
    4151                $this->is_host = true;
     
    4555                $this->is_host = false;
    4656        }
     57
     58        /**
     59         * @return string[]
     60         */
     61        public function contributed_locales(): array {
     62                return $this->contributed_locales;
     63        }
    4764}
Note: See TracChangeset for help on using the changeset viewer.