$data Shape stored in the blocklingo_settings option. */ public static function from_array( array $data ): self { $code = (string) ( $data['code'] ?? '' ); return new self( $code, (string) ( $data['slug'] ?? $code ), (string) ( $data['name'] ?? $code ), (string) ( $data['locale'] ?? $code ), (string) ( $data['flag'] ?? '' ), ! empty( $data['rtl'] ) ); } /** @return array{code: string, slug: string, name: string, locale: string, flag: string, rtl: int} */ public function to_array(): array { return array( 'code' => $this->code, 'slug' => $this->slug, 'name' => $this->name, 'locale' => $this->locale, 'flag' => $this->flag, 'rtl' => $this->rtl ? 1 : 0, ); } /** "🇺🇦 Українська" */ public function label(): string { return trim( $this->flag . ' ' . $this->name ); } }