src/WPametu/Tool/BatchProcessor.php
protected function register_batches(){
		static $batch_registered = false;
		if( !$batch_registered ){
			// Register Batches
			/** @var AutoLoader $auto_loader */
			$auto_loader = AutoLoader::get_instance();
			$root = $auto_loader->namespace_root;
			$namespace = $auto_loader->namespace;
			if( $namespace && $root && is_dir($root.'/Batches') ){
				// Scan directory and find batch children
				foreach( scandir($root.'/Batches') as $file ){
					if( preg_match('/\.php$/', $file) ){
						$class_name = $namespace.'\\Batches\\'.str_replace('.php', '', $file);
						if( class_exists($class_name) && $this->is_sub_class_of($class_name, Batch::class) ){
							$this->batches[] = $class_name;
						}
					}
				}
			}
			$batch_registered = true;
		}
	}
protected function register_batches(){
		static $batch_registered = false;
		if( !$batch_registered ){
			// Register Batches
			/** @var AutoLoader $auto_loader */
			$auto_loader = AutoLoader::get_instance();
			$root = $auto_loader->namespace_root;
			$namespace = $auto_loader->namespace;
			if( $namespace && $root && is_dir($root.'/Batches') ){
				// Scan directory and find batch children
				foreach( scandir($root.'/Batches') as $file ){
					if( preg_match('/\.php$/', $file) ){
						$class_name = $namespace.'\\Batches\\'.str_replace('.php', '', $file);
						if( class_exists($class_name) && $this->is_sub_class_of($class_name, Batch::class) ){
							$this->batches[] = $class_name;
						}
					}
				}
			}
			$batch_registered = true;
		}
	}
protected function register_batches ( ) { static $ batch_registered = false ; if ( ! $ batch_registered ) { // Register Batches /** @var AutoLoader $auto_loader */ $ auto_loader = AutoLoader :: get_instance ( ) ; $ root = $ auto_loader -> namespace_root ; $ namespace = $ auto_loader -> namespace ; if ( $ namespace && $ root && is_dir ( $ root . '/Batches' ) ) { // Scan directory and find batch children foreach ( scandir ( $ root . '/Batches' ) as $ file ) { if ( preg_match ( '/\.php$/' , $ file ) ) { $ class_name = $ namespace . '\\Batches\\' . str_replace ( '.php' , '' , $ file ) ; if ( class_exists ( $ class_name ) && $ this -> is_sub_class_of ( $ class_name , Batch :: class ) ) { $ this -> batches [ ] = $ class_name ; } } } } $ batch_registered = true ; } }
Register Batch classes
Register Batch classes