feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Response;
|
||||
|
||||
use KadenceWP\KadenceBlocks\Optimizer\Enums\Viewport;
|
||||
|
||||
/**
|
||||
* Data Transfer Object representing comprehensive website performance analysis.
|
||||
*
|
||||
* Contains the complete optimization analysis including device-specific data
|
||||
* for desktop and mobile viewports, plus detailed analysis for all images found.
|
||||
*/
|
||||
final class WebsiteAnalysis {
|
||||
|
||||
public bool $isStale;
|
||||
public DeviceAnalysis $desktop;
|
||||
public DeviceAnalysis $mobile;
|
||||
|
||||
/**
|
||||
* @var ImageAnalysis[]
|
||||
*/
|
||||
public array $images;
|
||||
|
||||
/**
|
||||
* @param ImageAnalysis[] $images The image analysis collection.
|
||||
*/
|
||||
private function __construct(
|
||||
bool $isStale,
|
||||
DeviceAnalysis $desktop,
|
||||
DeviceAnalysis $mobile,
|
||||
array $images = []
|
||||
) {
|
||||
$this->isStale = $isStale;
|
||||
$this->desktop = $desktop;
|
||||
$this->mobile = $mobile;
|
||||
$this->images = $images;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array{isStale?: bool, desktop: array, mobile: array, images: array} $attributes
|
||||
*
|
||||
* @throws \Exception If we fail to create a DateTimeImmutable object.
|
||||
*/
|
||||
public static function from( array $attributes ): self {
|
||||
$images = array_map(
|
||||
static function ( array $result ): ImageAnalysis {
|
||||
return ImageAnalysis::from( $result );
|
||||
},
|
||||
$attributes['images'] ?? []
|
||||
);
|
||||
|
||||
$isStale = (bool) ( $attributes['isStale'] ?? false );
|
||||
|
||||
return new self(
|
||||
$isStale,
|
||||
DeviceAnalysis::from( $attributes['desktop'] ),
|
||||
DeviceAnalysis::from( $attributes['mobile'] ),
|
||||
$images
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{isStale: bool, desktop: array, mobile: array, images: array}
|
||||
*/
|
||||
public function toArray(): array {
|
||||
return [
|
||||
'isStale' => $this->isStale,
|
||||
'desktop' => $this->desktop->toArray(),
|
||||
'mobile' => $this->mobile->toArray(),
|
||||
'images' => array_map(
|
||||
static function ( ImageAnalysis $image ): array {
|
||||
return $image->toArray();
|
||||
},
|
||||
$this->images
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device analysis for a specific viewport.
|
||||
*
|
||||
* @param Viewport $vp The viewport to fetch data for.
|
||||
*
|
||||
* @return DeviceAnalysis|null
|
||||
*/
|
||||
public function getDevice( Viewport $vp ): ?DeviceAnalysis {
|
||||
return $this->{$vp} ?? null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user