k = $key; $this->srcOffsets = $srcOffsets; } /** * Create an object from unserialized data-parsoid.pi * @param array $data * @return self */ public static function newFromJsonArray( array $data ): ParamInfo { $info = new self( $data['k'] ?? '' ); $info->named = $data['named'] ?? false; $info->spc = $data['spc'] ?? null; return $info; } /** * Serialize for data-parsoid.pi. The rest of the data is temporary, it is * not needed across requests. * * @return array */ public function toJsonArray(): array { $ret = [ 'k' => $this->k ]; if ( $this->named ) { $ret['named'] = true; } if ( $this->spc ) { $ret['spc'] = $this->spc; } return $ret; } }