'llm_instructions'] = self::EMPTY_RESULT_HINT; } return $response; } private function resolve_page( array $input ): int { $page = isset( $input['page'] ) ? (int) $input['page'] : 1; return max( 1, $page ); } private function resolve_per_page( array $input ): int { $per_page = isset( $input['per_page'] ) ? (int) $input['per_page'] : self::DEFAULT_PER_PAGE; return max( 1, min( self::MAX_PER_PAGE, $per_page ) ); } private function resolve_mime_types( array $input ): array { $type = isset( $input['type'] ) && is_string( $input['type'] ) ? $input['type'] : self::TYPE_ALL; if ( self::TYPE_SVG === $type ) { return [ self::SVG_MIME_TYPE ]; } if ( self::TYPE_VIDEO === $type ) { return self::VIDEO_MIME_TYPES; } return self::IMAGE_MIME_TYPES; } private function format_attachment( \WP_Post $attachment ): array { $metadata = wp_get_attachment_metadata( $attachment->ID ); return [ 'id' => (int) $attachment->ID, 'url' => (string) wp_get_attachment_url( $attachment->ID ), 'title' => (string) $attachment->post_title, 'alt' => (string) get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ), 'mime_type' => (string) $attachment->post_mime_type, 'width' => isset( $metadata['width'] ) ? (int) $metadata['width'] : null, 'height' => isset( $metadata['height'] ) ? (int) $metadata['height'] : null, ]; } }