Fase 1: Estructura Base y DI Container - Clean Architecture

COMPLETADO: Fase 1 de la migración a Clean Architecture + POO

## Estructura de Carpetas
- ✓ Estructura completa de 4 capas (Domain, Application, Infrastructure, Presentation)
- ✓ Carpetas de Use Cases (SaveComponent, GetComponent, DeleteComponent, SyncSchema)
- ✓ Estructura de tests (Unit, Integration, E2E)
- ✓ Carpetas de schemas y templates

## Composer y Autoloading
- ✓ PSR-4 autoloading configurado para ROITheme namespace
- ✓ Autoloader optimizado regenerado

## DI Container
- ✓ DIContainer implementado con patrón Singleton
- ✓ Métodos set(), get(), has() para gestión de servicios
- ✓ Getters específicos para ComponentRepository, ValidationService, CacheService
- ✓ Placeholders que serán implementados en Fase 5
- ✓ Prevención de clonación y deserialización

## Interfaces
- ✓ ComponentRepositoryInterface (Domain)
- ✓ ValidationServiceInterface (Application)
- ✓ CacheServiceInterface (Application)
- ✓ Component entity placeholder (Domain)

## Bootstrap
- ✓ functions.php actualizado con carga de Composer autoloader
- ✓ Inicialización del DIContainer
- ✓ Helper function roi_container() disponible globalmente

## Tests
- ✓ 10 tests unitarios para DIContainer (100% cobertura)
- ✓ Total: 13 tests unitarios, 28 assertions
- ✓ Suite de tests pasando correctamente

## Validación
- ✓ Script de validación automatizado (48/48 checks pasados)
- ✓ 100% de validaciones exitosas

La arquitectura base está lista para la Fase 2.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-17 13:48:24 -06:00
parent b782ebceee
commit de5fff4f5c
149 changed files with 3187 additions and 9554 deletions

View File

@@ -5,7 +5,7 @@
* This file contains SEO-related theme functions that work
* seamlessly with Rank Math SEO plugin without conflicts.
*
* @package Apus_Theme
* @package ROI_Theme
* @since 1.0.0
*/
@@ -22,11 +22,11 @@ if (!defined('ABSPATH')) {
*
* @since 1.0.0
*/
function apus_remove_generator() {
function roi_remove_generator() {
return '';
}
remove_action('wp_head', 'wp_generator');
add_filter('the_generator', 'apus_remove_generator');
add_filter('the_generator', 'roi_remove_generator');
/**
* Remove RSD (Really Simple Discovery) link
@@ -64,13 +64,13 @@ remove_action('wp_head', 'rest_output_link_wp_head');
*
* @since 1.0.0
*/
function apus_robots_header() {
function roi_robots_header() {
if (is_robots()) {
header('Cache-Control: public, max-age=86400');
header('Expires: ' . gmdate('r', time() + 86400));
}
}
add_action('pre_handle_robots_txt', 'apus_robots_header');
add_action('pre_handle_robots_txt', 'roi_robots_header');
/**
* Improve comment feed performance
@@ -90,7 +90,7 @@ add_action('pre_handle_robots_txt', 'apus_robots_header');
*
* @since 1.0.0
*/
function apus_admin_notice_missing_alt() {
function roi_admin_notice_missing_alt() {
if (!current_user_can('upload_files')) {
return;
}
@@ -107,9 +107,9 @@ function apus_admin_notice_missing_alt() {
*
* @since 1.0.0
*/
function apus_seo_head_hooks() {
function roi_seo_head_hooks() {
// This ensures proper hook execution order for Rank Math compatibility
do_action('apus_head_close');
do_action('roi_head_close');
}
/**
@@ -120,12 +120,12 @@ function apus_seo_head_hooks() {
*
* @since 1.0.0
*/
function apus_prefetch_external() {
function roi_prefetch_external() {
// Google Fonts prefetch
echo '<link rel="preconnect" href="https://fonts.googleapis.com">' . "\n";
echo '<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>' . "\n";
}
add_action('wp_head', 'apus_prefetch_external', 1);
add_action('wp_head', 'roi_prefetch_external', 1);
/**
* Open Graph support for Rank Math compatibility
@@ -135,7 +135,7 @@ add_action('wp_head', 'apus_prefetch_external', 1);
*
* @since 1.0.0
*/
function apus_check_rank_math_active() {
function roi_check_rank_math_active() {
return defined('RANK_MATH_VERSION');
}
@@ -147,9 +147,9 @@ function apus_check_rank_math_active() {
*
* @since 1.0.0
*/
function apus_schema_fallback() {
function roi_schema_fallback() {
// Only output schema if Rank Math is NOT active
if (apus_check_rank_math_active()) {
if (roi_check_rank_math_active()) {
return;
}
@@ -165,12 +165,12 @@ function apus_schema_fallback() {
$schema['description'] = get_bloginfo('description');
}
echo "\n" . '<!-- Apus Theme Basic Schema (Rank Math not active) -->' . "\n";
echo "\n" . '<!-- ROI Theme Basic Schema (Rank Math not active) -->' . "\n";
echo '<script type="application/ld+json">' . "\n";
echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
echo '</script>' . "\n";
}
add_action('wp_head', 'apus_schema_fallback', 20);
add_action('wp_head', 'roi_schema_fallback', 20);
/**
* Security headers configuration
@@ -180,13 +180,13 @@ add_action('wp_head', 'apus_schema_fallback', 20);
*
* @since 1.0.0
*/
function apus_security_headers() {
function roi_security_headers() {
// These headers improve trust signals for search engines
header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
}
add_action('send_headers', 'apus_security_headers');
add_action('send_headers', 'roi_security_headers');
/**
* Ensure title tag support is active
@@ -196,10 +196,10 @@ add_action('send_headers', 'apus_security_headers');
*
* @since 1.0.0
*/
function apus_verify_title_tag_support() {
function roi_verify_title_tag_support() {
if (!current_theme_supports('title-tag')) {
// Log warning if title-tag support is somehow disabled
error_log('Warning: Apus Theme title-tag support not properly initialized');
error_log('Warning: ROI Theme title-tag support not properly initialized');
}
}
add_action('after_setup_theme', 'apus_verify_title_tag_support', 20);
add_action('after_setup_theme', 'roi_verify_title_tag_support', 20);