mailer(); } } /** * Initializes Square email classes. * * @internal * * @since 2.0.0 */ public function init_emails() { $this->init_mailer(); if ( null === $this->square_sync_completed ) { $this->square_sync_completed = new Emails\Sync_Completed(); } if ( null === $this->square_access_token_email ) { $this->square_access_token_email = new Emails\Access_Token_Email(); } if ( null === $this->square_gift_card_sent ) { $this->square_gift_card_sent = new Emails\Gift_Card_Sent(); } } /** * Adds WooCommerce Square email handlers. * * @internal * * @since 2.0.0 * * @param \WC_Email[] $emails associative array of email IDs and objects * @return \WC_Email[] */ public function get_email_classes( $emails = array() ) { // init emails if uninitialized $this->init_emails(); if ( ! array_key_exists( 'wc_square_sync_completed', $emails ) || ! $emails['wc_square_sync_completed'] instanceof Emails\Sync_Completed ) { $emails['wc_square_sync_completed'] = $this->square_sync_completed; } if ( ! array_key_exists( 'wc_square_access_token_email', $emails ) || ! $emails['wc_square_access_token_email'] instanceof Emails\Sync_Completed ) { $emails['wc_square_access_token_email'] = $this->square_access_token_email; } if ( ! array_key_exists( 'wc_square_gift_card_sent', $emails ) || ! $emails['wc_square_gift_card_sent'] instanceof Emails\Sync_Completed ) { $emails['wc_square_gift_card_sent'] = $this->square_gift_card_sent; } return $emails; } /** * Gets the Square sync completed email instance. * * @since 2.0.0 * * @return Emails\Sync_Completed */ public function get_sync_completed_email() { $this->init_emails(); return $this->square_sync_completed; } /** * Gets the Square access token email instance. * * @since 2.1.0 * * @return Emails\Access_Token_Email */ public function get_access_token_email() { $this->init_emails(); return $this->square_access_token_email; } /** * Gets the Square Gift Card email sent instance. * * @since 4.2.0 * * @return Emails\Gift_Card_Sent */ public function get_gift_card_sent() { $this->init_emails(); return $this->square_gift_card_sent; } }