few large files". * * @package AIPT\Api\ContentStructure\Engine\Generators\Formula * @since 2.8.0 */ namespace AIPT\Api\ContentStructure\Engine\Generators\Formula; defined( 'ABSPATH' ) || exit; /** * Formula-specific MeasuredCheck row builders. */ final class FormulaChecks { /** * A generic MeasuredCheck row. * * @param string $id Check id. * @param string $label Check label. * @param string $status 'pass' | 'warn' | 'fail' | 'skip'. * @param string $detail Measured detail sentence. * @param string|null $unit_id Unit id, when the check is unit-scoped. * @return array{id:string,label:string,status:string,detail:string,unitId?:string} */ public static function row( string $id, string $label, string $status, string $detail, ?string $unit_id = null ): array { $check = array( 'id' => $id, 'label' => $label, 'status' => $status, 'detail' => $detail ); if ( null !== $unit_id ) { $check['unitId'] = $unit_id; } return $check; } /** * A character-length measured check against a hard limit (Title, SEO * title/description, Image alt): "{len} of {max} characters - limit * enforced." * * @param string $id Check id. * @param string $label Check label. * @param int $len Measured character count (after any deterministic trim/drop). * @param int $max Configured hard character limit. * @param bool $ok Whether the final length is within the limit. * @return array */ public static function charLength( string $id, string $label, int $len, int $max, bool $ok ): array { return self::row( $id, $label, $ok ? 'pass' : 'fail', sprintf( /* translators: %1$d: measured character count. %2$d: configured character limit. */ __( '%1$d of %2$d characters - limit enforced.', 'ai-product-tools' ), $len, $max ) ); } }