>): mixed $handler */ public function add( string $path, string $method, callable $handler ): void { register_rest_route( self::ROUTE_NAMESPACE, $path, array( 'methods' => $method, 'callback' => $handler, 'permission_callback' => array( $this, 'is_allowed' ), ) ); } public function is_allowed(): bool { return current_user_can( self::CAPABILITY ); } }