Adopt reusable CI standard + PHPUnit conversion (#22)

Squash-merge of PR #22: adopt shared reusable CI workflow, convert PHPUnit to stubs, update branch-protection contexts.

QA-approved at 05d8094a1d. All required CI checks green.

Agent-Session: 2026-06-17-prcore-ci-deploy
This commit is contained in:
peptiderepo
2026-06-17 01:12:00 +07:00
committed by GitHub
parent d0b5875fd8
commit 665d7fa9e1
72 changed files with 4604 additions and 1212 deletions

View File

@@ -1,6 +1,18 @@
<?php
/**
* Jsonld Faq.
*
* @package Peptide_Repo_Core
*/
declare(strict_types=1);
/**
* Reads _pr_faq_items post-meta (JSON array of {question, answer} objects)
*
* @package Peptide_Repo_Core
*/
/**
* Builds the schema.org FAQPage graph piece for a peptide page.
*
@@ -17,7 +29,11 @@ declare(strict_types=1);
*/
class PR_Core_Jsonld_Faq {
/** @var string Meta key holding the FAQ items JSON array. */
/**
* Meta key holding the FAQ items JSON array.
*
* @var string Meta key holding the FAQ items JSON array.
*/
public const META_FAQ_ITEMS = '_pr_faq_items';
/**
@@ -34,11 +50,11 @@ class PR_Core_Jsonld_Faq {
return null;
}
return [
return array(
'@type' => 'FAQPage',
'@id' => $permalink . '#faq',
'mainEntity' => array_map( [ $this, 'build_question' ], $items ),
];
'mainEntity' => array_map( array( $this, 'build_question' ), $items ),
);
}
/**
@@ -48,14 +64,14 @@ class PR_Core_Jsonld_Faq {
* @return array<string, mixed> Schema.org Question node.
*/
private function build_question( array $item ): array {
return [
'@type' => 'Question',
'name' => esc_html( $item['question'] ),
'acceptedAnswer' => [
return array(
'@type' => 'Question',
'name' => esc_html( $item['question'] ),
'acceptedAnswer' => array(
'@type' => 'Answer',
'text' => esc_html( $item['answer'] ),
],
];
),
);
}
/**
@@ -71,16 +87,16 @@ class PR_Core_Jsonld_Faq {
$raw = get_post_meta( $post_id, self::META_FAQ_ITEMS, true );
if ( ! is_string( $raw ) || '' === $raw ) {
return [];
return array();
}
$decoded = json_decode( $raw, true );
if ( ! is_array( $decoded ) || empty( $decoded ) ) {
return [];
return array();
}
$valid = [];
$valid = array();
foreach ( $decoded as $item ) {
if ( ! is_array( $item ) ) {
continue;
@@ -88,10 +104,10 @@ class PR_Core_Jsonld_Faq {
$question = sanitize_text_field( (string) ( $item['question'] ?? '' ) );
$answer = sanitize_textarea_field( (string) ( $item['answer'] ?? '' ) );
if ( '' !== $question && '' !== $answer ) {
$valid[] = [
$valid[] = array(
'question' => $question,
'answer' => $answer,
];
);
}
}