code = $code; } elseif ( $type === 'default_locale' && $code !== '' ) { $this->default_locale = $code; } else { throw new InvalidArgumentException( 'Empty language code or invalid column type!' ); } } public function exists() { return (bool) $this->wpdb->get_var( $this->wpdb->prepare( " SELECT code FROM {$this->wpdb->prefix}{$this->table} WHERE code= %s LIMIT 1", $this->code() ) ); } public function code() { if ( ! $this->code ) { $this->code = $this->wpdb->get_var( $this->wpdb->prepare( " SELECT code FROM {$this->wpdb->prefix}{$this->table} WHERE default_locale=%s LIMIT 1", $this->default_locale ) ); } return $this->code; } }