me ][ $block_style_name ] ); return true; } /** * Retrieves the properties of a registered block style for the given block type. * * @since 5.3.0 * * @param string $block_name Block type name including namespace. * @param string $block_style_name Block style name. * @return array Registered block style properties. */ public function get_registered( $block_name, $block_style_name ) { if ( ! $this->is_registered( $block_name, $block_style_name ) ) { return null; } return $this->registered_block_styles[ $block_name ][ $block_style_name ]; } /** * Retrieves all registered block styles. * * @since 5.3.0 * * @return array[] Array of arrays containing the registered block styles properties grouped by block type. */ public function get_all_registered() { return $this->registered_block_styles; } /** * Retrieves registered block styles for a specific block type. * * @since 5.3.0 * * @param string $block_name Block type name including namespace. * @return array[] Array whose keys are block style names and whose values are block style properties. */ public function get_registered_styles_for_block( $block_name ) { if ( isset( $this->registered_block_styles[ $block_name ] ) ) { return $this->registered_block_styles[ $block_name ]; } return array(); } /** * Checks if a block style is registered for the given block type. * * @since 5.3.0 * * @param string $block_name Block type name including namespace. * @param string $block_style_name Block style name. * @return bool True if the block style is registered, false otherwise. */ public function is_registered( $block_name, $block_style_name ) { return isset( $this->registered_block_styles[ $block_name ][ $block_style_name ] ); } /** * Utility method to retrieve the main instance of the class. * * The instance will be created if it does not exist yet. * * @since 5.3.0 * * @return WP_Block_Styles_Registry The main instance. */ public static function get_instance() { if ( null === self::$instance ) { self::$instance = new self(); } return self::$instance; } } * * @since 5.5.0 * * @link https://www.php.net/manual/en/iterator.next.php */ #[ReturnTypeWillChange] public function next() { next( $this->blocks ); } /** * Checks if current position is valid. * * @since 5.5.0 * * @link https://www.php.net/manual/en/iterator.valid.php */ #[ReturnTypeWillChange] public function valid() { return null !== key( $this->blocks ); } /** * Returns the count of blocks in the list. * * @since 5.5.0 * * @link https://www.php.net/manual/en/countable.count.php * * @return int Block count. */ #[ReturnTypeWillChange] public function count() { return count( $this->blocks ); } }