category = $category; $this->catId = $catId; if ( is_string( $params ) ) { $params = FormatJson::decode( $params, true ); } $this->params = $params; $this->lintId = $lintId; $this->location = $location; // Convenient accessors for all errors $this->templateInfo = $params['templateInfo'] ?? null; $this->tagInfo = $params['name'] ?? null; } /** * Unique id to identify this error, for internal * purposes * * @return string */ public function id() { return $this->category . ",{$this->location[0]},{$this->location[1]}," . FormatJson::encode( $this->params ); } /** * Get the params that are extra for this error, * not part of the default set * * @return array */ public function getExtraParams() { $params = $this->params; unset( $params['templateInfo'] ); return $params; } }