- Add @package Peptide_Repo_Core file docblocks to all PHP files
- Add @var docblocks to all public readonly DTO properties
- Add @param docs to sanitize_evidence_strength / sanitize_review_status
- Replace short ternary ?: with phpcs:ignore on each violating line
- Add phpcs:ignore for InterpolatedNotPrepared on ${table} SQL strings
- Add phpcs:ignore for GlobalVariablesOverride in uninstall.php and card.php
- Add translators comment to __ call with placeholder in related-posts-section
- Fix InlineComment.InvalidEndChar: add periods to all bare inline comments
- Expand single-line /** @return void */ docblocks with summaries
- SPLIT class-pr-core-seed-data.php (was 360 lines):
→ class-pr-core-seed-data.php (149 lines, orchestration only)
→ class-pr-core-seed-fixtures.php (254 lines, static fixture data)
- SPLIT class-pr-core-peptide-cpt.php (was 309 lines):
→ class-pr-core-peptide-cpt.php (224 lines, CPT + hooks + sanitizers)
→ class-pr-core-peptide-meta-schema.php (133 lines, meta field defs)
- SPLIT class-pr-core-settings.php (was 340 lines after docblock expansion):
→ class-pr-core-settings.php (264 lines, registration + sanitization)
→ class-pr-core-settings-renderer.php (124 lines, render methods)
- All includes/ PHP files now <= 300 lines
Agent-Session: claude-adopt-ci-20260616
139 lines
3.3 KiB
PHP
139 lines
3.3 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Typed data-transfer object for a legal status cell.
|
|
*
|
|
* What: Immutable value object wrapping a row from pr_legal_cells.
|
|
* Who calls it: PR_Core_Legal_Repository returns these; consumers read them.
|
|
* Dependencies: None.
|
|
*
|
|
* @see migrations/class-pr-core-migration-0002-legal-cells.php — Table schema.
|
|
* @see repositories/class-pr-core-legal-repository.php — Creates these from DB rows.
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
class PR_Core_Legal_Cell_DTO {
|
|
|
|
/**
|
|
* Int.
|
|
*
|
|
* @var int
|
|
*/
|
|
public readonly int $id;
|
|
/**
|
|
* Int.
|
|
*
|
|
* @var int
|
|
*/
|
|
public readonly int $peptide_id;
|
|
/**
|
|
* String.
|
|
*
|
|
* @var string
|
|
*/
|
|
public readonly string $country_code;
|
|
/**
|
|
* String.
|
|
*
|
|
* @var string
|
|
*/
|
|
public readonly string $status;
|
|
/**
|
|
* ?string.
|
|
*
|
|
* @var ?string
|
|
*/
|
|
public readonly ?string $regulatory_framework;
|
|
/**
|
|
* ?string.
|
|
*
|
|
* @var ?string
|
|
*/
|
|
public readonly ?string $regulatory_text_url;
|
|
/**
|
|
* ?string.
|
|
*
|
|
* @var ?string
|
|
*/
|
|
public readonly ?string $regulatory_text_quote;
|
|
/**
|
|
* ?string.
|
|
*
|
|
* @var ?string
|
|
*/
|
|
public readonly ?string $notes;
|
|
/**
|
|
* String.
|
|
*
|
|
* @var string
|
|
*/
|
|
public readonly string $last_verified_at;
|
|
/**
|
|
* Int.
|
|
*
|
|
* @var int
|
|
*/
|
|
public readonly int $schema_version;
|
|
/**
|
|
* Int.
|
|
*
|
|
* @var int
|
|
*/
|
|
public readonly int $reviewer_id;
|
|
/**
|
|
* ?int.
|
|
*
|
|
* @var ?int
|
|
*/
|
|
public readonly ?int $superseded_by_id;
|
|
|
|
/**
|
|
* Construct.
|
|
*
|
|
* @param array<string, mixed> $data Associative array from database row.
|
|
*/
|
|
public function __construct( array $data ) {
|
|
$this->id = (int) ( $data['id'] ?? 0 );
|
|
$this->peptide_id = (int) ( $data['peptide_id'] ?? 0 );
|
|
$this->country_code = (string) ( $data['country_code'] ?? '' );
|
|
$this->status = (string) ( $data['status'] ?? 'unclear' );
|
|
$this->regulatory_framework = $data['regulatory_framework'] ?? null;
|
|
$this->regulatory_text_url = $data['regulatory_text_url'] ?? null;
|
|
$this->regulatory_text_quote = $data['regulatory_text_quote'] ?? null;
|
|
$this->notes = $data['notes'] ?? null;
|
|
$this->last_verified_at = (string) ( $data['last_verified_at'] ?? '' );
|
|
$this->schema_version = (int) ( $data['schema_version'] ?? 1 );
|
|
$this->reviewer_id = (int) ( $data['reviewer_id'] ?? 0 );
|
|
$this->superseded_by_id = isset( $data['superseded_by_id'] ) ? (int) $data['superseded_by_id'] : null;
|
|
}
|
|
|
|
/**
|
|
* Check if this cell is the active (non-superseded) version.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function is_active(): bool {
|
|
return null === $this->superseded_by_id;
|
|
}
|
|
|
|
/**
|
|
* Convert to associative array for REST/admin output.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function to_array(): array {
|
|
return array(
|
|
'id' => $this->id,
|
|
'peptide_id' => $this->peptide_id,
|
|
'country_code' => $this->country_code,
|
|
'status' => $this->status,
|
|
'regulatory_framework' => $this->regulatory_framework,
|
|
'regulatory_text_url' => $this->regulatory_text_url,
|
|
'regulatory_text_quote' => $this->regulatory_text_quote,
|
|
'notes' => $this->notes,
|
|
'last_verified_at' => $this->last_verified_at,
|
|
'is_active' => $this->is_active(),
|
|
);
|
|
}
|
|
}
|