PluginProbe
MONEI Payments for WooCommerce / trunk
MONEI Payments for WooCommerce vtrunk
7.3.3 7.3.2 7.3.1 7.3.0 7.2.4 7.2.3 7.2.2 7.2.0 7.2.1 7.1.3 2.1.0 3.0.0 3.1.0 3.1.1 4.0.0 4.1.0 4.1.1 4.2.0 4.2.1 5.0 5.1.0 5.1.1 5.1.2 5.2.2 5.2.3 All 87 releases
monei / src / Services / BlockSupportService.php

BlockSupportService.php in MONEI Payments for WooCommerce trunk, at src/Services/BlockSupportService.php

32 lines 782 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Monei\Services;
4
5 class BlockSupportService {
6 private string $blocksPath;
7 private string $namespacePrefix;
8
9 public function __construct( string $blocksPath, string $namespacePrefix ) {
10 $this->blocksPath = $blocksPath;
11 $this->namespacePrefix = $namespacePrefix;
12 }
13
14 /**
15 * Discover and return all block support classes.
16 *
17 * @return string[] List of fully qualified class names.
18 */
19 public function getBlockSupportClasses(): array {
20 $blockSupportClasses = array();
21
22 foreach ( glob( $this->blocksPath . '/*BlocksSupport.php' ) as $file ) {
23 $className = $this->namespacePrefix . pathinfo( $file, PATHINFO_FILENAME );
24 if ( class_exists( $className ) ) {
25 $blockSupportClasses[] = $className;
26 }
27 }
28
29 return $blockSupportClasses;
30 }
31 }
32