Passed
Push — main ( aaef5c...e4c121 )
by TARIQ
71:39
created
packages/woocommerce-blocks/src/BlockTypes/ProductBestSellers.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
  */
7 7
 class ProductBestSellers extends AbstractProductGrid {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-best-sellers';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-best-sellers';
15 15
 
16
-	/**
17
-	 * Set args specific to this block
18
-	 *
19
-	 * @param array $query_args Query args.
20
-	 */
21
-	protected function set_block_query_args( &$query_args ) {
22
-		$query_args['orderby'] = 'popularity';
23
-	}
16
+    /**
17
+     * Set args specific to this block
18
+     *
19
+     * @param array $query_args Query args.
20
+     */
21
+    protected function set_block_query_args( &$query_args ) {
22
+        $query_args['orderby'] = 'popularity';
23
+    }
24 24
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	 *
19 19
 	 * @param array $query_args Query args.
20 20
 	 */
21
-	protected function set_block_query_args( &$query_args ) {
21
+	protected function set_block_query_args(&$query_args) {
22 22
 		$query_args['orderby'] = 'popularity';
23 23
 	}
24 24
 }
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/ProductImage.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -6,54 +6,54 @@
 block discarded – undo
6 6
  */
7 7
 class ProductImage extends AbstractBlock {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-image';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-image';
15 15
 
16
-	/**
17
-	 * API version name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $api_version = '2';
16
+    /**
17
+     * API version name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $api_version = '2';
22 22
 
23
-	/**
24
-	 * Get block supports. Shared with the frontend.
25
-	 * IMPORTANT: If you change anything here, make sure to update the JS file too.
26
-	 *
27
-	 * @return array
28
-	 */
29
-	protected function get_block_type_supports() {
30
-		return array(
31
-			'__experimentalBorder'   =>
32
-			array(
33
-				'radius'                          => true,
34
-				'__experimentalSkipSerialization' => true,
35
-			),
36
-			'typography'             =>
37
-			array(
38
-				'fontSize'                        => true,
39
-				'__experimentalSkipSerialization' => true,
40
-			),
41
-			'spacing'                =>
42
-			array(
43
-				'margin'                          => true,
44
-				'__experimentalSkipSerialization' => true,
45
-			),
46
-			'__experimentalSelector' => '.wc-block-components-product-image',
47
-		);
48
-	}
23
+    /**
24
+     * Get block supports. Shared with the frontend.
25
+     * IMPORTANT: If you change anything here, make sure to update the JS file too.
26
+     *
27
+     * @return array
28
+     */
29
+    protected function get_block_type_supports() {
30
+        return array(
31
+            '__experimentalBorder'   =>
32
+            array(
33
+                'radius'                          => true,
34
+                '__experimentalSkipSerialization' => true,
35
+            ),
36
+            'typography'             =>
37
+            array(
38
+                'fontSize'                        => true,
39
+                '__experimentalSkipSerialization' => true,
40
+            ),
41
+            'spacing'                =>
42
+            array(
43
+                'margin'                          => true,
44
+                '__experimentalSkipSerialization' => true,
45
+            ),
46
+            '__experimentalSelector' => '.wc-block-components-product-image',
47
+        );
48
+    }
49 49
 
50
-	/**
51
-	 * Register script and style assets for the block type before it is registered.
52
-	 *
53
-	 * This registers the scripts; it does not enqueue them.
54
-	 */
55
-	protected function register_block_type_assets() {
56
-		parent::register_block_type_assets();
57
-		$this->register_chunk_translations( [ $this->block_name ] );
58
-	}
50
+    /**
51
+     * Register script and style assets for the block type before it is registered.
52
+     *
53
+     * This registers the scripts; it does not enqueue them.
54
+     */
55
+    protected function register_block_type_assets() {
56
+        parent::register_block_type_assets();
57
+        $this->register_chunk_translations( [ $this->block_name ] );
58
+    }
59 59
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 */
52 52
 	protected function register_block_type_assets() {
53 53
 		parent::register_block_type_assets();
54
-		$this->register_chunk_translations( [ $this->block_name ] );
54
+		$this->register_chunk_translations([$this->block_name]);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/MiniCartContents.php 2 patches
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -13,131 +13,131 @@
 block discarded – undo
13 13
  * @internal
14 14
  */
15 15
 class MiniCartContents extends AbstractBlock {
16
-	/**
17
-	 * Block name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $block_name = 'mini-cart-contents';
16
+    /**
17
+     * Block name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $block_name = 'mini-cart-contents';
22 22
 
23
-	/**
24
-	 * Get the editor script handle for this block type.
25
-	 *
26
-	 * @param string $key Data to get, or default to everything.
27
-	 *
28
-	 * @return array|string;
29
-	 */
30
-	protected function get_block_type_editor_script( $key = null ) {
31
-		$script = [
32
-			'handle'       => 'wc-' . $this->block_name . '-block',
33
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
34
-			'dependencies' => [ 'wc-blocks' ],
35
-		];
36
-		return $key ? $script[ $key ] : $script;
37
-	}
23
+    /**
24
+     * Get the editor script handle for this block type.
25
+     *
26
+     * @param string $key Data to get, or default to everything.
27
+     *
28
+     * @return array|string;
29
+     */
30
+    protected function get_block_type_editor_script( $key = null ) {
31
+        $script = [
32
+            'handle'       => 'wc-' . $this->block_name . '-block',
33
+            'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
34
+            'dependencies' => [ 'wc-blocks' ],
35
+        ];
36
+        return $key ? $script[ $key ] : $script;
37
+    }
38 38
 
39
-	/**
40
-	 * Get the frontend script handle for this block type.
41
-	 *
42
-	 * @param string $key Data to get, or default to everything.
43
-	 *
44
-	 * @return null
45
-	 */
46
-	protected function get_block_type_script( $key = null ) {
47
-		// The frontend script is a dependency of the Mini Cart block so it's
48
-		// already lazy-loaded.
49
-		return null;
50
-	}
39
+    /**
40
+     * Get the frontend script handle for this block type.
41
+     *
42
+     * @param string $key Data to get, or default to everything.
43
+     *
44
+     * @return null
45
+     */
46
+    protected function get_block_type_script( $key = null ) {
47
+        // The frontend script is a dependency of the Mini Cart block so it's
48
+        // already lazy-loaded.
49
+        return null;
50
+    }
51 51
 
52
-	/**
53
-	 * Render the markup for the Mini Cart contents block.
54
-	 *
55
-	 * @param array  $attributes Block attributes.
56
-	 * @param string $content    Block content.
57
-	 *
58
-	 * @return string Rendered block type output.
59
-	 */
60
-	protected function render( $attributes, $content ) {
61
-		if ( is_admin() || WC()->is_rest_api_request() ) {
62
-			// In the editor we will display the placeholder, so no need to
63
-			// print the markup.
64
-			return '';
65
-		}
52
+    /**
53
+     * Render the markup for the Mini Cart contents block.
54
+     *
55
+     * @param array  $attributes Block attributes.
56
+     * @param string $content    Block content.
57
+     *
58
+     * @return string Rendered block type output.
59
+     */
60
+    protected function render( $attributes, $content ) {
61
+        if ( is_admin() || WC()->is_rest_api_request() ) {
62
+            // In the editor we will display the placeholder, so no need to
63
+            // print the markup.
64
+            return '';
65
+        }
66 66
 
67
-		return $content;
68
-	}
67
+        return $content;
68
+    }
69 69
 
70
-	/**
71
-	 * Enqueue frontend assets for this block, just in time for rendering.
72
-	 *
73
-	 * @param array $attributes  Any attributes that currently are available from the block.
74
-	 */
75
-	protected function enqueue_assets( array $attributes ) {
76
-		parent::enqueue_assets( $attributes );
77
-		$text_color = StyleAttributesUtils::get_text_color_class_and_style( $attributes );
78
-		$bg_color   = StyleAttributesUtils::get_background_color_class_and_style( $attributes );
70
+    /**
71
+     * Enqueue frontend assets for this block, just in time for rendering.
72
+     *
73
+     * @param array $attributes  Any attributes that currently are available from the block.
74
+     */
75
+    protected function enqueue_assets( array $attributes ) {
76
+        parent::enqueue_assets( $attributes );
77
+        $text_color = StyleAttributesUtils::get_text_color_class_and_style( $attributes );
78
+        $bg_color   = StyleAttributesUtils::get_background_color_class_and_style( $attributes );
79 79
 
80
-		$styles = array(
81
-			array(
82
-				'selector'   => '.wc-block-mini-cart__drawer .components-modal__header',
83
-				'properties' => array(
84
-					array(
85
-						'property' => 'color',
86
-						'value'    => $text_color ? $text_color['value'] : false,
87
-					),
88
-				),
89
-			),
90
-			array(
91
-				'selector'   => array(
92
-					'.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout',
93
-					'.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:hover',
94
-					'.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:focus',
95
-					'.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart:hover',
96
-					'.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart:focus',
97
-					'.wc-block-mini-cart__shopping-button a:hover',
98
-					'.wc-block-mini-cart__shopping-button a:focus',
99
-				),
100
-				'properties' => array(
101
-					array(
102
-						'property' => 'color',
103
-						'value'    => $bg_color ? $bg_color['value'] : false,
104
-					),
105
-					array(
106
-						'property' => 'border-color',
107
-						'value'    => $text_color ? $text_color['value'] : false,
108
-					),
109
-					array(
110
-						'property' => 'background-color',
111
-						'value'    => $text_color ? $text_color['value'] : false,
112
-					),
113
-				),
114
-			),
115
-		);
80
+        $styles = array(
81
+            array(
82
+                'selector'   => '.wc-block-mini-cart__drawer .components-modal__header',
83
+                'properties' => array(
84
+                    array(
85
+                        'property' => 'color',
86
+                        'value'    => $text_color ? $text_color['value'] : false,
87
+                    ),
88
+                ),
89
+            ),
90
+            array(
91
+                'selector'   => array(
92
+                    '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout',
93
+                    '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:hover',
94
+                    '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-checkout:focus',
95
+                    '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart:hover',
96
+                    '.wc-block-mini-cart__footer .wc-block-mini-cart__footer-actions .wc-block-mini-cart__footer-cart:focus',
97
+                    '.wc-block-mini-cart__shopping-button a:hover',
98
+                    '.wc-block-mini-cart__shopping-button a:focus',
99
+                ),
100
+                'properties' => array(
101
+                    array(
102
+                        'property' => 'color',
103
+                        'value'    => $bg_color ? $bg_color['value'] : false,
104
+                    ),
105
+                    array(
106
+                        'property' => 'border-color',
107
+                        'value'    => $text_color ? $text_color['value'] : false,
108
+                    ),
109
+                    array(
110
+                        'property' => 'background-color',
111
+                        'value'    => $text_color ? $text_color['value'] : false,
112
+                    ),
113
+                ),
114
+            ),
115
+        );
116 116
 
117
-		$parsed_style = '';
117
+        $parsed_style = '';
118 118
 
119
-		foreach ( $styles as $style ) {
120
-			$selector = is_array( $style['selector'] ) ? implode( ',', $style['selector'] ) : $style['selector'];
119
+        foreach ( $styles as $style ) {
120
+            $selector = is_array( $style['selector'] ) ? implode( ',', $style['selector'] ) : $style['selector'];
121 121
 
122
-			$properties = array_filter(
123
-				$style['properties'],
124
-				function( $property ) {
125
-					return $property['value'];
126
-				}
127
-			);
122
+            $properties = array_filter(
123
+                $style['properties'],
124
+                function( $property ) {
125
+                    return $property['value'];
126
+                }
127
+            );
128 128
 
129
-			if ( ! empty( $properties ) ) {
130
-				$parsed_style .= $selector . '{';
131
-				foreach ( $properties as $property ) {
132
-					$parsed_style .= sprintf( '%1$s:%2$s;', $property['property'], $property['value'] );
133
-				}
134
-				$parsed_style .= '}';
135
-			}
136
-		}
129
+            if ( ! empty( $properties ) ) {
130
+                $parsed_style .= $selector . '{';
131
+                foreach ( $properties as $property ) {
132
+                    $parsed_style .= sprintf( '%1$s:%2$s;', $property['property'], $property['value'] );
133
+                }
134
+                $parsed_style .= '}';
135
+            }
136
+        }
137 137
 
138
-		wp_add_inline_style(
139
-			'wc-blocks-style',
140
-			$parsed_style
141
-		);
142
-	}
138
+        wp_add_inline_style(
139
+            'wc-blocks-style',
140
+            $parsed_style
141
+        );
142
+    }
143 143
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @return array|string;
29 29
 	 */
30
-	protected function get_block_type_editor_script( $key = null ) {
30
+	protected function get_block_type_editor_script($key = null) {
31 31
 		$script = [
32 32
 			'handle'       => 'wc-' . $this->block_name . '-block',
33
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
34
-			'dependencies' => [ 'wc-blocks' ],
33
+			'path'         => $this->asset_api->get_block_asset_build_path($this->block_name),
34
+			'dependencies' => ['wc-blocks'],
35 35
 		];
36
-		return $key ? $script[ $key ] : $script;
36
+		return $key ? $script[$key] : $script;
37 37
 	}
38 38
 
39 39
 	/**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * @return null
45 45
 	 */
46
-	protected function get_block_type_script( $key = null ) {
46
+	protected function get_block_type_script($key = null) {
47 47
 		// The frontend script is a dependency of the Mini Cart block so it's
48 48
 		// already lazy-loaded.
49 49
 		return null;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @return string Rendered block type output.
59 59
 	 */
60
-	protected function render( $attributes, $content ) {
61
-		if ( is_admin() || WC()->is_rest_api_request() ) {
60
+	protected function render($attributes, $content) {
61
+		if (is_admin() || WC()->is_rest_api_request()) {
62 62
 			// In the editor we will display the placeholder, so no need to
63 63
 			// print the markup.
64 64
 			return '';
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @param array $attributes  Any attributes that currently are available from the block.
74 74
 	 */
75
-	protected function enqueue_assets( array $attributes ) {
76
-		parent::enqueue_assets( $attributes );
77
-		$text_color = StyleAttributesUtils::get_text_color_class_and_style( $attributes );
78
-		$bg_color   = StyleAttributesUtils::get_background_color_class_and_style( $attributes );
75
+	protected function enqueue_assets(array $attributes) {
76
+		parent::enqueue_assets($attributes);
77
+		$text_color = StyleAttributesUtils::get_text_color_class_and_style($attributes);
78
+		$bg_color   = StyleAttributesUtils::get_background_color_class_and_style($attributes);
79 79
 
80 80
 		$styles = array(
81 81
 			array(
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 
117 117
 		$parsed_style = '';
118 118
 
119
-		foreach ( $styles as $style ) {
120
-			$selector = is_array( $style['selector'] ) ? implode( ',', $style['selector'] ) : $style['selector'];
119
+		foreach ($styles as $style) {
120
+			$selector = is_array($style['selector']) ? implode(',', $style['selector']) : $style['selector'];
121 121
 
122 122
 			$properties = array_filter(
123 123
 				$style['properties'],
124
-				function( $property ) {
124
+				function($property) {
125 125
 					return $property['value'];
126 126
 				}
127 127
 			);
128 128
 
129
-			if ( ! empty( $properties ) ) {
129
+			if (!empty($properties)) {
130 130
 				$parsed_style .= $selector . '{';
131
-				foreach ( $properties as $property ) {
132
-					$parsed_style .= sprintf( '%1$s:%2$s;', $property['property'], $property['value'] );
131
+				foreach ($properties as $property) {
132
+					$parsed_style .= sprintf('%1$s:%2$s;', $property['property'], $property['value']);
133 133
 				}
134 134
 				$parsed_style .= '}';
135 135
 			}
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/ProductTagList.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,50 +6,50 @@
 block discarded – undo
6 6
  */
7 7
 class ProductTagList extends AbstractBlock {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-tag-list';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-tag-list';
15 15
 
16
-	/**
17
-	 * API version name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $api_version = '2';
16
+    /**
17
+     * API version name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $api_version = '2';
22 22
 
23 23
 
24
-	/**
25
-	 * Get block supports. Shared with the frontend.
26
-	 * IMPORTANT: If you change anything here, make sure to update the JS file too.
27
-	 *
28
-	 * @return array
29
-	 */
30
-	protected function get_block_type_supports() {
31
-		return array(
32
-			'color'                  =>
33
-			array(
34
-				'text'       => true,
35
-				'background' => false,
36
-				'link'       => true,
37
-			),
38
-			'typography'             =>
39
-			array(
40
-				'fontSize' => true,
41
-			),
42
-			'__experimentalSelector' => '.wc-block-components-product-tag-list',
43
-		);
44
-	}
24
+    /**
25
+     * Get block supports. Shared with the frontend.
26
+     * IMPORTANT: If you change anything here, make sure to update the JS file too.
27
+     *
28
+     * @return array
29
+     */
30
+    protected function get_block_type_supports() {
31
+        return array(
32
+            'color'                  =>
33
+            array(
34
+                'text'       => true,
35
+                'background' => false,
36
+                'link'       => true,
37
+            ),
38
+            'typography'             =>
39
+            array(
40
+                'fontSize' => true,
41
+            ),
42
+            '__experimentalSelector' => '.wc-block-components-product-tag-list',
43
+        );
44
+    }
45 45
 
46
-	/**
47
-	 * Register script and style assets for the block type before it is registered.
48
-	 *
49
-	 * This registers the scripts; it does not enqueue them.
50
-	 */
51
-	protected function register_block_type_assets() {
52
-		parent::register_block_type_assets();
53
-		$this->register_chunk_translations( [ $this->block_name ] );
54
-	}
46
+    /**
47
+     * Register script and style assets for the block type before it is registered.
48
+     *
49
+     * This registers the scripts; it does not enqueue them.
50
+     */
51
+    protected function register_block_type_assets() {
52
+        parent::register_block_type_assets();
53
+        $this->register_chunk_translations( [ $this->block_name ] );
54
+    }
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 */
52 52
 	protected function register_block_type_assets() {
53 53
 		parent::register_block_type_assets();
54
-		$this->register_chunk_translations( [ $this->block_name ] );
54
+		$this->register_chunk_translations([$this->block_name]);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/ProductSaleBadge.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -6,60 +6,60 @@
 block discarded – undo
6 6
  */
7 7
 class ProductSaleBadge extends AbstractBlock {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-sale-badge';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-sale-badge';
15 15
 
16
-	/**
17
-	 * API version name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $api_version = '2';
16
+    /**
17
+     * API version name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $api_version = '2';
22 22
 
23
-	/**
24
-	 * Get block attributes.
25
-	 *
26
-	 * @return array
27
-	 */
28
-	protected function get_block_type_supports() {
29
-		return array(
30
-			'color'                  =>
31
-			array(
32
-				'gradients'  => true,
33
-				'background' => true,
34
-				'link'       => true,
35
-			),
36
-			'typography'             =>
37
-			array(
38
-				'fontSize'   => true,
39
-				'lineHeight' => true,
40
-			),
41
-			'__experimentalBorder'   =>
42
-			array(
43
-				'color'  => true,
44
-				'radius' => true,
45
-				'width'  => true,
46
-			),
47
-			'spacing'                =>
48
-			array(
49
-				'padding'                         => true,
50
-				'__experimentalSkipSerialization' => true,
51
-			),
52
-			'__experimentalSelector' => '.wc-block-components-product-sale-badge',
53
-		);
54
-	}
23
+    /**
24
+     * Get block attributes.
25
+     *
26
+     * @return array
27
+     */
28
+    protected function get_block_type_supports() {
29
+        return array(
30
+            'color'                  =>
31
+            array(
32
+                'gradients'  => true,
33
+                'background' => true,
34
+                'link'       => true,
35
+            ),
36
+            'typography'             =>
37
+            array(
38
+                'fontSize'   => true,
39
+                'lineHeight' => true,
40
+            ),
41
+            '__experimentalBorder'   =>
42
+            array(
43
+                'color'  => true,
44
+                'radius' => true,
45
+                'width'  => true,
46
+            ),
47
+            'spacing'                =>
48
+            array(
49
+                'padding'                         => true,
50
+                '__experimentalSkipSerialization' => true,
51
+            ),
52
+            '__experimentalSelector' => '.wc-block-components-product-sale-badge',
53
+        );
54
+    }
55 55
 
56
-	/**
57
-	 * Register script and style assets for the block type before it is registered.
58
-	 *
59
-	 * This registers the scripts; it does not enqueue them.
60
-	 */
61
-	protected function register_block_type_assets() {
62
-		parent::register_block_type_assets();
63
-		$this->register_chunk_translations( [ $this->block_name ] );
64
-	}
56
+    /**
57
+     * Register script and style assets for the block type before it is registered.
58
+     *
59
+     * This registers the scripts; it does not enqueue them.
60
+     */
61
+    protected function register_block_type_assets() {
62
+        parent::register_block_type_assets();
63
+        $this->register_chunk_translations( [ $this->block_name ] );
64
+    }
65 65
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 */
52 52
 	protected function register_block_type_assets() {
53 53
 		parent::register_block_type_assets();
54
-		$this->register_chunk_translations( [ $this->block_name ] );
54
+		$this->register_chunk_translations([$this->block_name]);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/Cart.php 2 patches
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -11,98 +11,98 @@  discard block
 block discarded – undo
11 11
  * @internal
12 12
  */
13 13
 class Cart extends AbstractBlock {
14
-	/**
15
-	 * Block name.
16
-	 *
17
-	 * @var string
18
-	 */
19
-	protected $block_name = 'cart';
20
-
21
-	/**
22
-	 * Chunks build folder.
23
-	 *
24
-	 * @var string
25
-	 */
26
-	protected $chunks_folder = 'cart-blocks';
27
-
28
-	/**
29
-	 * Get the editor script handle for this block type.
30
-	 *
31
-	 * @param string $key Data to get, or default to everything.
32
-	 * @return array|string;
33
-	 */
34
-	protected function get_block_type_editor_script( $key = null ) {
35
-		$script = [
36
-			'handle'       => 'wc-' . $this->block_name . '-block',
37
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
38
-			'dependencies' => [ 'wc-blocks' ],
39
-		];
40
-		return $key ? $script[ $key ] : $script;
41
-	}
42
-
43
-	/**
44
-	 * Get the frontend script handle for this block type.
45
-	 *
46
-	 * @see $this->register_block_type()
47
-	 * @param string $key Data to get, or default to everything.
48
-	 * @return array|string
49
-	 */
50
-	protected function get_block_type_script( $key = null ) {
51
-		$script = [
52
-			'handle'       => 'wc-' . $this->block_name . '-block-frontend',
53
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ),
54
-			'dependencies' => [],
55
-		];
56
-		return $key ? $script[ $key ] : $script;
57
-	}
58
-
59
-	/**
60
-	 * Enqueue frontend assets for this block, just in time for rendering.
61
-	 *
62
-	 * @param array $attributes  Any attributes that currently are available from the block.
63
-	 */
64
-	protected function enqueue_assets( array $attributes ) {
65
-		/**
66
-		 * Fires before cart block scripts are enqueued.
67
-		 */
68
-		do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_before' );
69
-		parent::enqueue_assets( $attributes );
70
-		/**
71
-		 * Fires after cart block scripts are enqueued.
72
-		 */
73
-		do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after' );
74
-	}
75
-
76
-	/**
77
-	 * Append frontend scripts when rendering the Cart block.
78
-	 *
79
-	 * @param array  $attributes Block attributes.
80
-	 * @param string $content    Block content.
81
-	 * @return string Rendered block type output.
82
-	 */
83
-	protected function render( $attributes, $content ) {
84
-		// Deregister core cart scripts and styles.
85
-		wp_dequeue_script( 'wc-cart' );
86
-		wp_dequeue_script( 'wc-password-strength-meter' );
87
-		wp_dequeue_script( 'selectWoo' );
88
-		wp_dequeue_style( 'select2' );
89
-
90
-		/**
91
-		 * We need to check if $content has any templates from prior iterations of the block, in order to update to the latest iteration.
92
-		 * We test the iteration version by searching for new blocks brought in by it.
93
-		 * The blocks used for testing should be always available in the block (not removable by the user).
94
-		 */
95
-
96
-		$regex_for_filled_cart_block = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/filled-cart-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
97
-		// Filled Cart block was added in i2, so we search for it to see if we have a Cart i1 template.
98
-		$has_i1_template = ! preg_match( $regex_for_filled_cart_block, $content );
99
-
100
-		if ( $has_i1_template ) {
101
-			/**
102
-			 * This fallback structure needs to match the defaultTemplate variables defined in the block's edit.tsx files,
103
-			 * starting from the parent block and going down each inner block, in the order the blocks were registered.
104
-			 */
105
-			$inner_blocks_html = '$0
14
+    /**
15
+     * Block name.
16
+     *
17
+     * @var string
18
+     */
19
+    protected $block_name = 'cart';
20
+
21
+    /**
22
+     * Chunks build folder.
23
+     *
24
+     * @var string
25
+     */
26
+    protected $chunks_folder = 'cart-blocks';
27
+
28
+    /**
29
+     * Get the editor script handle for this block type.
30
+     *
31
+     * @param string $key Data to get, or default to everything.
32
+     * @return array|string;
33
+     */
34
+    protected function get_block_type_editor_script( $key = null ) {
35
+        $script = [
36
+            'handle'       => 'wc-' . $this->block_name . '-block',
37
+            'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
38
+            'dependencies' => [ 'wc-blocks' ],
39
+        ];
40
+        return $key ? $script[ $key ] : $script;
41
+    }
42
+
43
+    /**
44
+     * Get the frontend script handle for this block type.
45
+     *
46
+     * @see $this->register_block_type()
47
+     * @param string $key Data to get, or default to everything.
48
+     * @return array|string
49
+     */
50
+    protected function get_block_type_script( $key = null ) {
51
+        $script = [
52
+            'handle'       => 'wc-' . $this->block_name . '-block-frontend',
53
+            'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ),
54
+            'dependencies' => [],
55
+        ];
56
+        return $key ? $script[ $key ] : $script;
57
+    }
58
+
59
+    /**
60
+     * Enqueue frontend assets for this block, just in time for rendering.
61
+     *
62
+     * @param array $attributes  Any attributes that currently are available from the block.
63
+     */
64
+    protected function enqueue_assets( array $attributes ) {
65
+        /**
66
+         * Fires before cart block scripts are enqueued.
67
+         */
68
+        do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_before' );
69
+        parent::enqueue_assets( $attributes );
70
+        /**
71
+         * Fires after cart block scripts are enqueued.
72
+         */
73
+        do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after' );
74
+    }
75
+
76
+    /**
77
+     * Append frontend scripts when rendering the Cart block.
78
+     *
79
+     * @param array  $attributes Block attributes.
80
+     * @param string $content    Block content.
81
+     * @return string Rendered block type output.
82
+     */
83
+    protected function render( $attributes, $content ) {
84
+        // Deregister core cart scripts and styles.
85
+        wp_dequeue_script( 'wc-cart' );
86
+        wp_dequeue_script( 'wc-password-strength-meter' );
87
+        wp_dequeue_script( 'selectWoo' );
88
+        wp_dequeue_style( 'select2' );
89
+
90
+        /**
91
+         * We need to check if $content has any templates from prior iterations of the block, in order to update to the latest iteration.
92
+         * We test the iteration version by searching for new blocks brought in by it.
93
+         * The blocks used for testing should be always available in the block (not removable by the user).
94
+         */
95
+
96
+        $regex_for_filled_cart_block = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/filled-cart-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
97
+        // Filled Cart block was added in i2, so we search for it to see if we have a Cart i1 template.
98
+        $has_i1_template = ! preg_match( $regex_for_filled_cart_block, $content );
99
+
100
+        if ( $has_i1_template ) {
101
+            /**
102
+             * This fallback structure needs to match the defaultTemplate variables defined in the block's edit.tsx files,
103
+             * starting from the parent block and going down each inner block, in the order the blocks were registered.
104
+             */
105
+            $inner_blocks_html = '$0
106 106
 			<div data-block-name="woocommerce/filled-cart-block" class="wp-block-woocommerce-filled-cart-block">
107 107
 				<div data-block-name="woocommerce/cart-items-block" class="wp-block-woocommerce-cart-items-block">
108 108
 					<div data-block-name="woocommerce/cart-line-items-block" class="wp-block-woocommerce-cart-line-items-block"></div>
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
 			<div data-block-name="woocommerce/empty-cart-block" class="wp-block-woocommerce-empty-cart-block">
118 118
 			';
119 119
 
120
-			$content = preg_replace( '/<div class="[a-zA-Z0-9_\- ]*wp-block-woocommerce-cart[a-zA-Z0-9_\- ]*">/mi', $inner_blocks_html, $content );
121
-			$content = $content . '</div>';
122
-		}
120
+            $content = preg_replace( '/<div class="[a-zA-Z0-9_\- ]*wp-block-woocommerce-cart[a-zA-Z0-9_\- ]*">/mi', $inner_blocks_html, $content );
121
+            $content = $content . '</div>';
122
+        }
123 123
 
124
-		/**
125
-		 * Cart i3 added inner blocks for Order summary. We need to add them to Cart i2 templates.
126
-		 * The order needs to match the order in which these blocks were registered.
127
-		 */
128
-		$order_summary_with_inner_blocks = '$0
124
+        /**
125
+         * Cart i3 added inner blocks for Order summary. We need to add them to Cart i2 templates.
126
+         * The order needs to match the order in which these blocks were registered.
127
+         */
128
+        $order_summary_with_inner_blocks = '$0
129 129
 			<div data-block-name="woocommerce/cart-order-summary-heading-block" class="wp-block-woocommerce-cart-order-summary-heading-block"></div>
130 130
 			<div data-block-name="woocommerce/cart-order-summary-subtotal-block" class="wp-block-woocommerce-cart-order-summary-subtotal-block"></div>
131 131
 			<div data-block-name="woocommerce/cart-order-summary-fee-block" class="wp-block-woocommerce-cart-order-summary-fee-block"></div>
@@ -134,116 +134,116 @@  discard block
 block discarded – undo
134 134
 			<div data-block-name="woocommerce/cart-order-summary-shipping-form-block" class="wp-block-woocommerce-cart-order-summary-shipping-block"></div>
135 135
 			<div data-block-name="woocommerce/cart-order-summary-taxes-block" class="wp-block-woocommerce-cart-order-summary-taxes-block"></div>
136 136
 		';
137
-		// Order summary subtotal block was added in i3, so we search for it to see if we have a Cart i2 template.
138
-		$regex_for_order_summary_subtotal = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-subtotal-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
139
-		$regex_for_order_summary          = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
140
-		$has_i2_template                  = ! preg_match( $regex_for_order_summary_subtotal, $content );
141
-
142
-		if ( $has_i2_template ) {
143
-			$content = preg_replace( $regex_for_order_summary, $order_summary_with_inner_blocks, $content );
144
-		}
145
-
146
-		return $content;
147
-	}
148
-
149
-	/**
150
-	 * Extra data passed through from server to client for block.
151
-	 *
152
-	 * @param array $attributes  Any attributes that currently are available from the block.
153
-	 *                           Note, this will be empty in the editor context when the block is
154
-	 *                           not in the post content on editor load.
155
-	 */
156
-	protected function enqueue_data( array $attributes = [] ) {
157
-		parent::enqueue_data( $attributes );
158
-
159
-		$this->asset_data_registry->add(
160
-			'shippingCountries',
161
-			function() {
162
-				return $this->deep_sort_with_accents( WC()->countries->get_shipping_countries() );
163
-			},
164
-			true
165
-		);
166
-		$this->asset_data_registry->add(
167
-			'shippingStates',
168
-			function() {
169
-				return $this->deep_sort_with_accents( WC()->countries->get_shipping_country_states() );
170
-			},
171
-			true
172
-		);
173
-		$this->asset_data_registry->add(
174
-			'countryLocale',
175
-			function() {
176
-				// Merge country and state data to work around https://github.com/woocommerce/woocommerce/issues/28944.
177
-				$country_locale = wc()->countries->get_country_locale();
178
-				$states         = wc()->countries->get_states();
179
-
180
-				foreach ( $states as $country => $states ) {
181
-					if ( empty( $states ) ) {
182
-						$country_locale[ $country ]['state']['required'] = false;
183
-						$country_locale[ $country ]['state']['hidden']   = true;
184
-					}
185
-				}
186
-				return $country_locale;
187
-			},
188
-			true
189
-		);
190
-		$this->asset_data_registry->add( 'baseLocation', wc_get_base_location(), true );
191
-		$this->asset_data_registry->add( 'isShippingCalculatorEnabled', filter_var( get_option( 'woocommerce_enable_shipping_calc' ), FILTER_VALIDATE_BOOLEAN ), true );
192
-		$this->asset_data_registry->add( 'displayItemizedTaxes', 'itemized' === get_option( 'woocommerce_tax_total_display' ), true );
193
-		$this->asset_data_registry->add( 'displayCartPricesIncludingTax', 'incl' === get_option( 'woocommerce_tax_display_cart' ), true );
194
-		$this->asset_data_registry->add( 'taxesEnabled', wc_tax_enabled(), true );
195
-		$this->asset_data_registry->add( 'couponsEnabled', wc_coupons_enabled(), true );
196
-		$this->asset_data_registry->add( 'shippingEnabled', wc_shipping_enabled(), true );
197
-		$this->asset_data_registry->add( 'hasDarkEditorStyleSupport', current_theme_supports( 'dark-editor-style' ), true );
198
-		$this->asset_data_registry->register_page_id( isset( $attributes['checkoutPageId'] ) ? $attributes['checkoutPageId'] : 0 );
199
-
200
-		// Hydrate the following data depending on admin or frontend context.
201
-		if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
202
-			$this->hydrate_from_api();
203
-		}
204
-
205
-		/**
206
-		 * Fires after cart block data is registered.
207
-		 */
208
-		do_action( 'woocommerce_blocks_cart_enqueue_data' );
209
-	}
210
-
211
-	/**
212
-	 * Removes accents from an array of values, sorts by the values, then returns the original array values sorted.
213
-	 *
214
-	 * @param array $array Array of values to sort.
215
-	 * @return array Sorted array.
216
-	 */
217
-	protected function deep_sort_with_accents( $array ) {
218
-		if ( ! is_array( $array ) || empty( $array ) ) {
219
-			return $array;
220
-		}
221
-
222
-		if ( is_array( reset( $array ) ) ) {
223
-			return array_map( [ $this, 'deep_sort_with_accents' ], $array );
224
-		}
225
-
226
-		$array_without_accents = array_map( 'remove_accents', array_map( 'wc_strtolower', array_map( 'html_entity_decode', $array ) ) );
227
-		asort( $array_without_accents );
228
-		return array_replace( $array_without_accents, $array );
229
-	}
230
-
231
-	/**
232
-	 * Hydrate the cart block with data from the API.
233
-	 */
234
-	protected function hydrate_from_api() {
235
-		$this->asset_data_registry->hydrate_api_request( '/wc/store/v1/cart' );
236
-	}
237
-	/**
238
-	 * Register script and style assets for the block type before it is registered.
239
-	 *
240
-	 * This registers the scripts; it does not enqueue them.
241
-	 */
242
-	protected function register_block_type_assets() {
243
-		parent::register_block_type_assets();
244
-		$chunks        = $this->get_chunks_paths( $this->chunks_folder );
245
-		$vendor_chunks = $this->get_chunks_paths( 'vendors--cart-blocks' );
246
-
247
-		$this->register_chunk_translations( array_merge( $chunks, $vendor_chunks ) );
248
-	}
137
+        // Order summary subtotal block was added in i3, so we search for it to see if we have a Cart i2 template.
138
+        $regex_for_order_summary_subtotal = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-subtotal-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
139
+        $regex_for_order_summary          = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
140
+        $has_i2_template                  = ! preg_match( $regex_for_order_summary_subtotal, $content );
141
+
142
+        if ( $has_i2_template ) {
143
+            $content = preg_replace( $regex_for_order_summary, $order_summary_with_inner_blocks, $content );
144
+        }
145
+
146
+        return $content;
147
+    }
148
+
149
+    /**
150
+     * Extra data passed through from server to client for block.
151
+     *
152
+     * @param array $attributes  Any attributes that currently are available from the block.
153
+     *                           Note, this will be empty in the editor context when the block is
154
+     *                           not in the post content on editor load.
155
+     */
156
+    protected function enqueue_data( array $attributes = [] ) {
157
+        parent::enqueue_data( $attributes );
158
+
159
+        $this->asset_data_registry->add(
160
+            'shippingCountries',
161
+            function() {
162
+                return $this->deep_sort_with_accents( WC()->countries->get_shipping_countries() );
163
+            },
164
+            true
165
+        );
166
+        $this->asset_data_registry->add(
167
+            'shippingStates',
168
+            function() {
169
+                return $this->deep_sort_with_accents( WC()->countries->get_shipping_country_states() );
170
+            },
171
+            true
172
+        );
173
+        $this->asset_data_registry->add(
174
+            'countryLocale',
175
+            function() {
176
+                // Merge country and state data to work around https://github.com/woocommerce/woocommerce/issues/28944.
177
+                $country_locale = wc()->countries->get_country_locale();
178
+                $states         = wc()->countries->get_states();
179
+
180
+                foreach ( $states as $country => $states ) {
181
+                    if ( empty( $states ) ) {
182
+                        $country_locale[ $country ]['state']['required'] = false;
183
+                        $country_locale[ $country ]['state']['hidden']   = true;
184
+                    }
185
+                }
186
+                return $country_locale;
187
+            },
188
+            true
189
+        );
190
+        $this->asset_data_registry->add( 'baseLocation', wc_get_base_location(), true );
191
+        $this->asset_data_registry->add( 'isShippingCalculatorEnabled', filter_var( get_option( 'woocommerce_enable_shipping_calc' ), FILTER_VALIDATE_BOOLEAN ), true );
192
+        $this->asset_data_registry->add( 'displayItemizedTaxes', 'itemized' === get_option( 'woocommerce_tax_total_display' ), true );
193
+        $this->asset_data_registry->add( 'displayCartPricesIncludingTax', 'incl' === get_option( 'woocommerce_tax_display_cart' ), true );
194
+        $this->asset_data_registry->add( 'taxesEnabled', wc_tax_enabled(), true );
195
+        $this->asset_data_registry->add( 'couponsEnabled', wc_coupons_enabled(), true );
196
+        $this->asset_data_registry->add( 'shippingEnabled', wc_shipping_enabled(), true );
197
+        $this->asset_data_registry->add( 'hasDarkEditorStyleSupport', current_theme_supports( 'dark-editor-style' ), true );
198
+        $this->asset_data_registry->register_page_id( isset( $attributes['checkoutPageId'] ) ? $attributes['checkoutPageId'] : 0 );
199
+
200
+        // Hydrate the following data depending on admin or frontend context.
201
+        if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
202
+            $this->hydrate_from_api();
203
+        }
204
+
205
+        /**
206
+         * Fires after cart block data is registered.
207
+         */
208
+        do_action( 'woocommerce_blocks_cart_enqueue_data' );
209
+    }
210
+
211
+    /**
212
+     * Removes accents from an array of values, sorts by the values, then returns the original array values sorted.
213
+     *
214
+     * @param array $array Array of values to sort.
215
+     * @return array Sorted array.
216
+     */
217
+    protected function deep_sort_with_accents( $array ) {
218
+        if ( ! is_array( $array ) || empty( $array ) ) {
219
+            return $array;
220
+        }
221
+
222
+        if ( is_array( reset( $array ) ) ) {
223
+            return array_map( [ $this, 'deep_sort_with_accents' ], $array );
224
+        }
225
+
226
+        $array_without_accents = array_map( 'remove_accents', array_map( 'wc_strtolower', array_map( 'html_entity_decode', $array ) ) );
227
+        asort( $array_without_accents );
228
+        return array_replace( $array_without_accents, $array );
229
+    }
230
+
231
+    /**
232
+     * Hydrate the cart block with data from the API.
233
+     */
234
+    protected function hydrate_from_api() {
235
+        $this->asset_data_registry->hydrate_api_request( '/wc/store/v1/cart' );
236
+    }
237
+    /**
238
+     * Register script and style assets for the block type before it is registered.
239
+     *
240
+     * This registers the scripts; it does not enqueue them.
241
+     */
242
+    protected function register_block_type_assets() {
243
+        parent::register_block_type_assets();
244
+        $chunks        = $this->get_chunks_paths( $this->chunks_folder );
245
+        $vendor_chunks = $this->get_chunks_paths( 'vendors--cart-blocks' );
246
+
247
+        $this->register_chunk_translations( array_merge( $chunks, $vendor_chunks ) );
248
+    }
249 249
 }
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	 * @param string $key Data to get, or default to everything.
32 32
 	 * @return array|string;
33 33
 	 */
34
-	protected function get_block_type_editor_script( $key = null ) {
34
+	protected function get_block_type_editor_script($key = null) {
35 35
 		$script = [
36 36
 			'handle'       => 'wc-' . $this->block_name . '-block',
37
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name ),
38
-			'dependencies' => [ 'wc-blocks' ],
37
+			'path'         => $this->asset_api->get_block_asset_build_path($this->block_name),
38
+			'dependencies' => ['wc-blocks'],
39 39
 		];
40
-		return $key ? $script[ $key ] : $script;
40
+		return $key ? $script[$key] : $script;
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	 * @param string $key Data to get, or default to everything.
48 48
 	 * @return array|string
49 49
 	 */
50
-	protected function get_block_type_script( $key = null ) {
50
+	protected function get_block_type_script($key = null) {
51 51
 		$script = [
52 52
 			'handle'       => 'wc-' . $this->block_name . '-block-frontend',
53
-			'path'         => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ),
53
+			'path'         => $this->asset_api->get_block_asset_build_path($this->block_name . '-frontend'),
54 54
 			'dependencies' => [],
55 55
 		];
56
-		return $key ? $script[ $key ] : $script;
56
+		return $key ? $script[$key] : $script;
57 57
 	}
58 58
 
59 59
 	/**
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @param array $attributes  Any attributes that currently are available from the block.
63 63
 	 */
64
-	protected function enqueue_assets( array $attributes ) {
64
+	protected function enqueue_assets(array $attributes) {
65 65
 		/**
66 66
 		 * Fires before cart block scripts are enqueued.
67 67
 		 */
68
-		do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_before' );
69
-		parent::enqueue_assets( $attributes );
68
+		do_action('woocommerce_blocks_enqueue_cart_block_scripts_before');
69
+		parent::enqueue_assets($attributes);
70 70
 		/**
71 71
 		 * Fires after cart block scripts are enqueued.
72 72
 		 */
73
-		do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after' );
73
+		do_action('woocommerce_blocks_enqueue_cart_block_scripts_after');
74 74
 	}
75 75
 
76 76
 	/**
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 	 * @param string $content    Block content.
81 81
 	 * @return string Rendered block type output.
82 82
 	 */
83
-	protected function render( $attributes, $content ) {
83
+	protected function render($attributes, $content) {
84 84
 		// Deregister core cart scripts and styles.
85
-		wp_dequeue_script( 'wc-cart' );
86
-		wp_dequeue_script( 'wc-password-strength-meter' );
87
-		wp_dequeue_script( 'selectWoo' );
88
-		wp_dequeue_style( 'select2' );
85
+		wp_dequeue_script('wc-cart');
86
+		wp_dequeue_script('wc-password-strength-meter');
87
+		wp_dequeue_script('selectWoo');
88
+		wp_dequeue_style('select2');
89 89
 
90 90
 		/**
91 91
 		 * We need to check if $content has any templates from prior iterations of the block, in order to update to the latest iteration.
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 
96 96
 		$regex_for_filled_cart_block = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/filled-cart-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
97 97
 		// Filled Cart block was added in i2, so we search for it to see if we have a Cart i1 template.
98
-		$has_i1_template = ! preg_match( $regex_for_filled_cart_block, $content );
98
+		$has_i1_template = !preg_match($regex_for_filled_cart_block, $content);
99 99
 
100
-		if ( $has_i1_template ) {
100
+		if ($has_i1_template) {
101 101
 			/**
102 102
 			 * This fallback structure needs to match the defaultTemplate variables defined in the block's edit.tsx files,
103 103
 			 * starting from the parent block and going down each inner block, in the order the blocks were registered.
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 			<div data-block-name="woocommerce/empty-cart-block" class="wp-block-woocommerce-empty-cart-block">
118 118
 			';
119 119
 
120
-			$content = preg_replace( '/<div class="[a-zA-Z0-9_\- ]*wp-block-woocommerce-cart[a-zA-Z0-9_\- ]*">/mi', $inner_blocks_html, $content );
120
+			$content = preg_replace('/<div class="[a-zA-Z0-9_\- ]*wp-block-woocommerce-cart[a-zA-Z0-9_\- ]*">/mi', $inner_blocks_html, $content);
121 121
 			$content = $content . '</div>';
122 122
 		}
123 123
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 		// Order summary subtotal block was added in i3, so we search for it to see if we have a Cart i2 template.
138 138
 		$regex_for_order_summary_subtotal = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-subtotal-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
139 139
 		$regex_for_order_summary          = '/<div[\n\r\s\ta-zA-Z0-9_\-=\'"]*data-block-name="woocommerce\/cart-order-summary-block"[\n\r\s\ta-zA-Z0-9_\-=\'"]*>/mi';
140
-		$has_i2_template                  = ! preg_match( $regex_for_order_summary_subtotal, $content );
140
+		$has_i2_template                  = !preg_match($regex_for_order_summary_subtotal, $content);
141 141
 
142
-		if ( $has_i2_template ) {
143
-			$content = preg_replace( $regex_for_order_summary, $order_summary_with_inner_blocks, $content );
142
+		if ($has_i2_template) {
143
+			$content = preg_replace($regex_for_order_summary, $order_summary_with_inner_blocks, $content);
144 144
 		}
145 145
 
146 146
 		return $content;
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
 	 *                           Note, this will be empty in the editor context when the block is
154 154
 	 *                           not in the post content on editor load.
155 155
 	 */
156
-	protected function enqueue_data( array $attributes = [] ) {
157
-		parent::enqueue_data( $attributes );
156
+	protected function enqueue_data(array $attributes = []) {
157
+		parent::enqueue_data($attributes);
158 158
 
159 159
 		$this->asset_data_registry->add(
160 160
 			'shippingCountries',
161 161
 			function() {
162
-				return $this->deep_sort_with_accents( WC()->countries->get_shipping_countries() );
162
+				return $this->deep_sort_with_accents(WC()->countries->get_shipping_countries());
163 163
 			},
164 164
 			true
165 165
 		);
166 166
 		$this->asset_data_registry->add(
167 167
 			'shippingStates',
168 168
 			function() {
169
-				return $this->deep_sort_with_accents( WC()->countries->get_shipping_country_states() );
169
+				return $this->deep_sort_with_accents(WC()->countries->get_shipping_country_states());
170 170
 			},
171 171
 			true
172 172
 		);
@@ -177,35 +177,35 @@  discard block
 block discarded – undo
177 177
 				$country_locale = wc()->countries->get_country_locale();
178 178
 				$states         = wc()->countries->get_states();
179 179
 
180
-				foreach ( $states as $country => $states ) {
181
-					if ( empty( $states ) ) {
182
-						$country_locale[ $country ]['state']['required'] = false;
183
-						$country_locale[ $country ]['state']['hidden']   = true;
180
+				foreach ($states as $country => $states) {
181
+					if (empty($states)) {
182
+						$country_locale[$country]['state']['required'] = false;
183
+						$country_locale[$country]['state']['hidden']   = true;
184 184
 					}
185 185
 				}
186 186
 				return $country_locale;
187 187
 			},
188 188
 			true
189 189
 		);
190
-		$this->asset_data_registry->add( 'baseLocation', wc_get_base_location(), true );
191
-		$this->asset_data_registry->add( 'isShippingCalculatorEnabled', filter_var( get_option( 'woocommerce_enable_shipping_calc' ), FILTER_VALIDATE_BOOLEAN ), true );
192
-		$this->asset_data_registry->add( 'displayItemizedTaxes', 'itemized' === get_option( 'woocommerce_tax_total_display' ), true );
193
-		$this->asset_data_registry->add( 'displayCartPricesIncludingTax', 'incl' === get_option( 'woocommerce_tax_display_cart' ), true );
194
-		$this->asset_data_registry->add( 'taxesEnabled', wc_tax_enabled(), true );
195
-		$this->asset_data_registry->add( 'couponsEnabled', wc_coupons_enabled(), true );
196
-		$this->asset_data_registry->add( 'shippingEnabled', wc_shipping_enabled(), true );
197
-		$this->asset_data_registry->add( 'hasDarkEditorStyleSupport', current_theme_supports( 'dark-editor-style' ), true );
198
-		$this->asset_data_registry->register_page_id( isset( $attributes['checkoutPageId'] ) ? $attributes['checkoutPageId'] : 0 );
190
+		$this->asset_data_registry->add('baseLocation', wc_get_base_location(), true);
191
+		$this->asset_data_registry->add('isShippingCalculatorEnabled', filter_var(get_option('woocommerce_enable_shipping_calc'), FILTER_VALIDATE_BOOLEAN), true);
192
+		$this->asset_data_registry->add('displayItemizedTaxes', 'itemized' === get_option('woocommerce_tax_total_display'), true);
193
+		$this->asset_data_registry->add('displayCartPricesIncludingTax', 'incl' === get_option('woocommerce_tax_display_cart'), true);
194
+		$this->asset_data_registry->add('taxesEnabled', wc_tax_enabled(), true);
195
+		$this->asset_data_registry->add('couponsEnabled', wc_coupons_enabled(), true);
196
+		$this->asset_data_registry->add('shippingEnabled', wc_shipping_enabled(), true);
197
+		$this->asset_data_registry->add('hasDarkEditorStyleSupport', current_theme_supports('dark-editor-style'), true);
198
+		$this->asset_data_registry->register_page_id(isset($attributes['checkoutPageId']) ? $attributes['checkoutPageId'] : 0);
199 199
 
200 200
 		// Hydrate the following data depending on admin or frontend context.
201
-		if ( ! is_admin() && ! WC()->is_rest_api_request() ) {
201
+		if (!is_admin() && !WC()->is_rest_api_request()) {
202 202
 			$this->hydrate_from_api();
203 203
 		}
204 204
 
205 205
 		/**
206 206
 		 * Fires after cart block data is registered.
207 207
 		 */
208
-		do_action( 'woocommerce_blocks_cart_enqueue_data' );
208
+		do_action('woocommerce_blocks_cart_enqueue_data');
209 209
 	}
210 210
 
211 211
 	/**
@@ -214,25 +214,25 @@  discard block
 block discarded – undo
214 214
 	 * @param array $array Array of values to sort.
215 215
 	 * @return array Sorted array.
216 216
 	 */
217
-	protected function deep_sort_with_accents( $array ) {
218
-		if ( ! is_array( $array ) || empty( $array ) ) {
217
+	protected function deep_sort_with_accents($array) {
218
+		if (!is_array($array) || empty($array)) {
219 219
 			return $array;
220 220
 		}
221 221
 
222
-		if ( is_array( reset( $array ) ) ) {
223
-			return array_map( [ $this, 'deep_sort_with_accents' ], $array );
222
+		if (is_array(reset($array))) {
223
+			return array_map([$this, 'deep_sort_with_accents'], $array);
224 224
 		}
225 225
 
226
-		$array_without_accents = array_map( 'remove_accents', array_map( 'wc_strtolower', array_map( 'html_entity_decode', $array ) ) );
227
-		asort( $array_without_accents );
228
-		return array_replace( $array_without_accents, $array );
226
+		$array_without_accents = array_map('remove_accents', array_map('wc_strtolower', array_map('html_entity_decode', $array)));
227
+		asort($array_without_accents);
228
+		return array_replace($array_without_accents, $array);
229 229
 	}
230 230
 
231 231
 	/**
232 232
 	 * Hydrate the cart block with data from the API.
233 233
 	 */
234 234
 	protected function hydrate_from_api() {
235
-		$this->asset_data_registry->hydrate_api_request( '/wc/store/v1/cart' );
235
+		$this->asset_data_registry->hydrate_api_request('/wc/store/v1/cart');
236 236
 	}
237 237
 	/**
238 238
 	 * Register script and style assets for the block type before it is registered.
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	protected function register_block_type_assets() {
243 243
 		parent::register_block_type_assets();
244
-		$chunks        = $this->get_chunks_paths( $this->chunks_folder );
245
-		$vendor_chunks = $this->get_chunks_paths( 'vendors--cart-blocks' );
244
+		$chunks        = $this->get_chunks_paths($this->chunks_folder);
245
+		$vendor_chunks = $this->get_chunks_paths('vendors--cart-blocks');
246 246
 
247
-		$this->register_chunk_translations( array_merge( $chunks, $vendor_chunks ) );
247
+		$this->register_chunk_translations(array_merge($chunks, $vendor_chunks));
248 248
 	}
249 249
 }
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/ProductSummary.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,50 +6,50 @@
 block discarded – undo
6 6
  */
7 7
 class ProductSummary extends AbstractBlock {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-summary';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-summary';
15 15
 
16
-	/**
17
-	 * API version name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $api_version = '2';
16
+    /**
17
+     * API version name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $api_version = '2';
22 22
 
23 23
 
24
-	/**
25
-	 * Get block supports. Shared with the frontend.
26
-	 * IMPORTANT: If you change anything here, make sure to update the JS file too.
27
-	 *
28
-	 * @return array
29
-	 */
30
-	protected function get_block_type_supports() {
31
-		return array(
32
-			'color'                  =>
33
-			array(
34
-				'link'       => true,
35
-				'background' => false,
36
-				'text'       => true,
37
-			),
38
-			'typography'             =>
39
-			array(
40
-				'fontSize' => true,
41
-			),
42
-			'__experimentalSelector' => '.wc-block-components-product-summary',
43
-		);
44
-	}
24
+    /**
25
+     * Get block supports. Shared with the frontend.
26
+     * IMPORTANT: If you change anything here, make sure to update the JS file too.
27
+     *
28
+     * @return array
29
+     */
30
+    protected function get_block_type_supports() {
31
+        return array(
32
+            'color'                  =>
33
+            array(
34
+                'link'       => true,
35
+                'background' => false,
36
+                'text'       => true,
37
+            ),
38
+            'typography'             =>
39
+            array(
40
+                'fontSize' => true,
41
+            ),
42
+            '__experimentalSelector' => '.wc-block-components-product-summary',
43
+        );
44
+    }
45 45
 
46
-	/**
47
-	 * Register script and style assets for the block type before it is registered.
48
-	 *
49
-	 * This registers the scripts; it does not enqueue them.
50
-	 */
51
-	protected function register_block_type_assets() {
52
-		parent::register_block_type_assets();
53
-		$this->register_chunk_translations( [ $this->block_name ] );
54
-	}
46
+    /**
47
+     * Register script and style assets for the block type before it is registered.
48
+     *
49
+     * This registers the scripts; it does not enqueue them.
50
+     */
51
+    protected function register_block_type_assets() {
52
+        parent::register_block_type_assets();
53
+        $this->register_chunk_translations( [ $this->block_name ] );
54
+    }
55 55
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 */
52 52
 	protected function register_block_type_assets() {
53 53
 		parent::register_block_type_assets();
54
-		$this->register_chunk_translations( [ $this->block_name ] );
54
+		$this->register_chunk_translations([$this->block_name]);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.
packages/woocommerce-blocks/src/BlockTypes/ProductsByAttribute.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -6,70 +6,70 @@
 block discarded – undo
6 6
  */
7 7
 class ProductsByAttribute extends AbstractProductGrid {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'products-by-attribute';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'products-by-attribute';
15 15
 
16
-	/**
17
-	 * Set args specific to this block
18
-	 *
19
-	 * @param array $query_args Query args.
20
-	 */
21
-	protected function set_block_query_args( &$query_args ) {
22
-		if ( ! empty( $this->attributes['attributes'] ) ) {
23
-			$taxonomy = sanitize_title( $this->attributes['attributes'][0]['attr_slug'] );
24
-			$terms    = wp_list_pluck( $this->attributes['attributes'], 'id' );
16
+    /**
17
+     * Set args specific to this block
18
+     *
19
+     * @param array $query_args Query args.
20
+     */
21
+    protected function set_block_query_args( &$query_args ) {
22
+        if ( ! empty( $this->attributes['attributes'] ) ) {
23
+            $taxonomy = sanitize_title( $this->attributes['attributes'][0]['attr_slug'] );
24
+            $terms    = wp_list_pluck( $this->attributes['attributes'], 'id' );
25 25
 
26
-			$query_args['tax_query'][] = array(
27
-				'taxonomy' => $taxonomy,
28
-				'terms'    => array_map( 'absint', $terms ),
29
-				'field'    => 'term_id',
30
-				'operator' => 'all' === $this->attributes['attrOperator'] ? 'AND' : 'IN',
31
-			);
32
-		}
33
-	}
26
+            $query_args['tax_query'][] = array(
27
+                'taxonomy' => $taxonomy,
28
+                'terms'    => array_map( 'absint', $terms ),
29
+                'field'    => 'term_id',
30
+                'operator' => 'all' === $this->attributes['attrOperator'] ? 'AND' : 'IN',
31
+            );
32
+        }
33
+    }
34 34
 
35
-	/**
36
-	 * Get block attributes.
37
-	 *
38
-	 * @return array
39
-	 */
40
-	protected function get_block_type_attributes() {
41
-		return array(
42
-			'align'             => $this->get_schema_align(),
43
-			'alignButtons'      => $this->get_schema_boolean( false ),
44
-			'attributes'        => array(
45
-				'type'    => 'array',
46
-				'items'   => array(
47
-					'type'       => 'object',
48
-					'properties' => array(
49
-						'id'        => array(
50
-							'type' => 'number',
51
-						),
52
-						'attr_slug' => array(
53
-							'type' => 'string',
54
-						),
55
-					),
56
-				),
57
-				'default' => array(),
58
-			),
59
-			'attrOperator'      => array(
60
-				'type'    => 'string',
61
-				'default' => 'any',
62
-			),
63
-			'className'         => $this->get_schema_string(),
64
-			'columns'           => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_columns', 3 ) ),
65
-			'contentVisibility' => $this->get_schema_content_visibility(),
66
-			'orderby'           => $this->get_schema_orderby(),
67
-			'rows'              => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_rows', 3 ) ),
68
-			'isPreview'         => $this->get_schema_boolean( false ),
69
-			'stockStatus'       => array(
70
-				'type'    => 'array',
71
-				'default' => array_keys( wc_get_product_stock_status_options() ),
72
-			),
73
-		);
74
-	}
35
+    /**
36
+     * Get block attributes.
37
+     *
38
+     * @return array
39
+     */
40
+    protected function get_block_type_attributes() {
41
+        return array(
42
+            'align'             => $this->get_schema_align(),
43
+            'alignButtons'      => $this->get_schema_boolean( false ),
44
+            'attributes'        => array(
45
+                'type'    => 'array',
46
+                'items'   => array(
47
+                    'type'       => 'object',
48
+                    'properties' => array(
49
+                        'id'        => array(
50
+                            'type' => 'number',
51
+                        ),
52
+                        'attr_slug' => array(
53
+                            'type' => 'string',
54
+                        ),
55
+                    ),
56
+                ),
57
+                'default' => array(),
58
+            ),
59
+            'attrOperator'      => array(
60
+                'type'    => 'string',
61
+                'default' => 'any',
62
+            ),
63
+            'className'         => $this->get_schema_string(),
64
+            'columns'           => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_columns', 3 ) ),
65
+            'contentVisibility' => $this->get_schema_content_visibility(),
66
+            'orderby'           => $this->get_schema_orderby(),
67
+            'rows'              => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_rows', 3 ) ),
68
+            'isPreview'         => $this->get_schema_boolean( false ),
69
+            'stockStatus'       => array(
70
+                'type'    => 'array',
71
+                'default' => array_keys( wc_get_product_stock_status_options() ),
72
+            ),
73
+        );
74
+    }
75 75
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @param array $query_args Query args.
20 20
 	 */
21
-	protected function set_block_query_args( &$query_args ) {
22
-		if ( ! empty( $this->attributes['attributes'] ) ) {
23
-			$taxonomy = sanitize_title( $this->attributes['attributes'][0]['attr_slug'] );
24
-			$terms    = wp_list_pluck( $this->attributes['attributes'], 'id' );
21
+	protected function set_block_query_args(&$query_args) {
22
+		if (!empty($this->attributes['attributes'])) {
23
+			$taxonomy = sanitize_title($this->attributes['attributes'][0]['attr_slug']);
24
+			$terms    = wp_list_pluck($this->attributes['attributes'], 'id');
25 25
 
26 26
 			$query_args['tax_query'][] = array(
27 27
 				'taxonomy' => $taxonomy,
28
-				'terms'    => array_map( 'absint', $terms ),
28
+				'terms'    => array_map('absint', $terms),
29 29
 				'field'    => 'term_id',
30 30
 				'operator' => 'all' === $this->attributes['attrOperator'] ? 'AND' : 'IN',
31 31
 			);
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	protected function get_block_type_attributes() {
41 41
 		return array(
42 42
 			'align'             => $this->get_schema_align(),
43
-			'alignButtons'      => $this->get_schema_boolean( false ),
43
+			'alignButtons'      => $this->get_schema_boolean(false),
44 44
 			'attributes'        => array(
45 45
 				'type'    => 'array',
46 46
 				'items'   => array(
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 				'default' => 'any',
62 62
 			),
63 63
 			'className'         => $this->get_schema_string(),
64
-			'columns'           => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_columns', 3 ) ),
64
+			'columns'           => $this->get_schema_number(wc_get_theme_support('product_blocks::default_columns', 3)),
65 65
 			'contentVisibility' => $this->get_schema_content_visibility(),
66 66
 			'orderby'           => $this->get_schema_orderby(),
67
-			'rows'              => $this->get_schema_number( wc_get_theme_support( 'product_blocks::default_rows', 3 ) ),
68
-			'isPreview'         => $this->get_schema_boolean( false ),
67
+			'rows'              => $this->get_schema_number(wc_get_theme_support('product_blocks::default_rows', 3)),
68
+			'isPreview'         => $this->get_schema_boolean(false),
69 69
 			'stockStatus'       => array(
70 70
 				'type'    => 'array',
71
-				'default' => array_keys( wc_get_product_stock_status_options() ),
71
+				'default' => array_keys(wc_get_product_stock_status_options()),
72 72
 			),
73 73
 		);
74 74
 	}
Please login to merge, or discard this patch.
woocommerce/packages/woocommerce-blocks/src/BlockTypes/ProductRating.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -6,56 +6,56 @@
 block discarded – undo
6 6
  */
7 7
 class ProductRating extends AbstractBlock {
8 8
 
9
-	/**
10
-	 * Block name.
11
-	 *
12
-	 * @var string
13
-	 */
14
-	protected $block_name = 'product-rating';
9
+    /**
10
+     * Block name.
11
+     *
12
+     * @var string
13
+     */
14
+    protected $block_name = 'product-rating';
15 15
 
16
-	/**
17
-	 * API version name.
18
-	 *
19
-	 * @var string
20
-	 */
21
-	protected $api_version = '2';
16
+    /**
17
+     * API version name.
18
+     *
19
+     * @var string
20
+     */
21
+    protected $api_version = '2';
22 22
 
23
-	/**
24
-	 * Get block supports. Shared with the frontend.
25
-	 * IMPORTANT: If you change anything here, make sure to update the JS file too.
26
-	 *
27
-	 * @return array
28
-	 */
29
-	protected function get_block_type_supports() {
30
-		return array(
31
-			'color'                  =>
32
-			array(
33
-				'text'                            => true,
34
-				'background'                      => false,
35
-				'link'                            => false,
36
-				'__experimentalSkipSerialization' => true,
37
-			),
38
-			'typography'             =>
39
-			array(
40
-				'fontSize'                        => true,
41
-				'__experimentalSkipSerialization' => true,
42
-			),
43
-			'spacing'                =>
44
-			array(
45
-				'margin'                          => true,
46
-				'__experimentalSkipSerialization' => true,
47
-			),
48
-			'__experimentalSelector' => '.wc-block-components-product-rating',
49
-		);
50
-	}
23
+    /**
24
+     * Get block supports. Shared with the frontend.
25
+     * IMPORTANT: If you change anything here, make sure to update the JS file too.
26
+     *
27
+     * @return array
28
+     */
29
+    protected function get_block_type_supports() {
30
+        return array(
31
+            'color'                  =>
32
+            array(
33
+                'text'                            => true,
34
+                'background'                      => false,
35
+                'link'                            => false,
36
+                '__experimentalSkipSerialization' => true,
37
+            ),
38
+            'typography'             =>
39
+            array(
40
+                'fontSize'                        => true,
41
+                '__experimentalSkipSerialization' => true,
42
+            ),
43
+            'spacing'                =>
44
+            array(
45
+                'margin'                          => true,
46
+                '__experimentalSkipSerialization' => true,
47
+            ),
48
+            '__experimentalSelector' => '.wc-block-components-product-rating',
49
+        );
50
+    }
51 51
 
52
-	/**
53
-	 * Register script and style assets for the block type before it is registered.
54
-	 *
55
-	 * This registers the scripts; it does not enqueue them.
56
-	 */
57
-	protected function register_block_type_assets() {
58
-		parent::register_block_type_assets();
59
-		$this->register_chunk_translations( [ $this->block_name ] );
60
-	}
52
+    /**
53
+     * Register script and style assets for the block type before it is registered.
54
+     *
55
+     * This registers the scripts; it does not enqueue them.
56
+     */
57
+    protected function register_block_type_assets() {
58
+        parent::register_block_type_assets();
59
+        $this->register_chunk_translations( [ $this->block_name ] );
60
+    }
61 61
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,6 +51,6 @@
 block discarded – undo
51 51
 	 */
52 52
 	protected function register_block_type_assets() {
53 53
 		parent::register_block_type_assets();
54
-		$this->register_chunk_translations( [ $this->block_name ] );
54
+		$this->register_chunk_translations([$this->block_name]);
55 55
 	}
56 56
 }
Please login to merge, or discard this patch.