What was refused; empty when everything registered. */ public function register( Registry $registry ): array { $currency = new StoreCurrency(); $labeler = new WcLabeler(); $answers = array( 'route classifier' => $registry->add_route_classifier( self::ID, WcRouteClassifier::ROUTE_PATTERN, new WcRouteClassifier() ), 'ability classifier' => $registry->add_ability_classifier( self::ID, WcAbilityClassifier::PREFIX, new WcAbilityClassifier() ), 'batch expander' => $registry->add_batch_expander( self::ID, WcBatchExpander::ROUTE_PATTERN, new WcBatchExpander() ), 'default rules' => $registry->add_default_rules( self::ID, WcDefaultRules::rules() ), 'refund facts' => $registry->add_fact_provider( self::ID, RefundFacts::declarations( $currency ), new RefundFacts( $currency ), array( 'refund' ) ), 'order facts' => $registry->add_fact_provider( self::ID, OrderFacts::declarations( $currency ), new OrderFacts( $currency ), array( 'order' ) ), 'money facts' => $registry->add_fact_provider( self::ID, MoneyFacts::declarations(), new MoneyFacts( $currency ), array( 'refund', 'order' ) ), 'product facts' => $registry->add_fact_provider( self::ID, ProductFacts::declarations( $currency ), new ProductFacts( $currency ), array( 'product', 'product_variation' ) ), 'coupon facts' => $registry->add_fact_provider( self::ID, CouponFacts::declarations(), new CouponFacts( $currency ), array( 'coupon' ) ), 'refund drift' => $registry->add_entity_provider( self::ID, 'refund', new RefundProvider() ), 'refund replay' => $registry->add_replay_provider( self::ID, RefundGuard::PROVIDER_ID, new RefundReplay() ), 'object replay' => $registry->add_replay_provider( self::ID, CrudBackstop::PROVIDER_ID, new ObjectReplay() ), 'meta replay' => $registry->add_replay_provider( self::ID, MetaBackstop::PROVIDER_ID, new MetaReplay() ), 'payment replay' => $registry->add_replay_provider( self::ID, CrudBackstop::PAYMENT_PROVIDER_ID, new PaymentReplay() ), 'order undo' => $registry->add_entity_provider( self::ID, 'order', new OrderProvider() ), 'product undo' => $registry->add_entity_provider( self::ID, 'product', new ProductProvider() ), 'variation undo' => $registry->add_entity_provider( self::ID, 'product_variation', new ProductProvider() ), 'coupon undo' => $registry->add_entity_provider( self::ID, 'coupon', new CouponProvider() ), 'setting undo' => $registry->add_entity_provider( self::ID, 'wc_setting', new SettingProvider() ), ); foreach ( array( 'order_note', 'shipping', 'tax', 'payment_gateway' ) as $entity_type ) { $answers[ 'reversibility of ' . $entity_type ] = $registry->add_entity_provider( self::ID, $entity_type, new NoUndoProvider( $entity_type ) ); } foreach ( self::SHOP_TYPES as $entity_type ) { $answers[ 'approval of ' . $entity_type ] = $registry->add_approval_capability( self::ID, $entity_type, 'manage_woocommerce' ); } // Money leaving through the gateway needs the refund capability; // an unknown answer, an administrator (the parent's rule). $answers['approval of refund'] = $registry->add_approval_capability( self::ID, 'refund', 'manage_woocommerce', array( array( 'when' => array( array( 'fact' => 'refund.via_gateway', 'op' => 'eq', 'value' => true, ), ), 'capability' => self::REFUND_CAPABILITY, ), ) ); foreach ( self::LABELED_TYPES as $entity_type ) { $answers[ 'label for ' . $entity_type ] = $registry->add_labeler( self::ID, $entity_type, $labeler ); } $answers['MCP plugin scan check'] = $registry->add_scan_check( self::ID, new UncoveredMcpPluginCheck() ); if ( null !== $this->gate ) { $tools = new ToolClassifier( $this->gate ); foreach ( str_split( ToolClassifier::PREFIXES ) as $prefix ) { $answers[ 'MCP tool classifier ' . $prefix ] = $registry->add_ability_classifier( self::ID, $prefix, $tools ); } } return array_keys( array_filter( $answers, static fn( bool $accepted ): bool => ! $accepted ) ); } }