src/WPametu/AutoLoader.php
public function scan_post_type() {
		$flg = false;
		foreach ( $this->namespaces as $ns => $dir ) {
			$dir = $dir . '/' . $ns . '/ThePost';
			if ( is_dir( $dir ) ) {
				foreach ( scandir( $dir ) as $file ) {
					if ( ! preg_match( '/^\./u', $file ) ) {
						$base_class = str_replace( '.php', '', $file );
						$class_name = $ns . '\\ThePost\\' . $base_class;
						if ( class_exists( $class_name ) && $this->is_sub_class_of( $class_name, PostHelper::class ) ) {
							$this->post_type_to_override[ $this->str->camel_to_hyphen( $base_class ) ] = $class_name;
							$flg                                                                       = true;
						}
					}
				}
			}
		}
		if ( $flg ) {
			add_action( 'the_post', [ $this, 'the_post' ] );
		}
	}
public function scan_post_type() {
		$flg = false;
		foreach ( $this->namespaces as $ns => $dir ) {
			$dir = $dir . '/' . $ns . '/ThePost';
			if ( is_dir( $dir ) ) {
				foreach ( scandir( $dir ) as $file ) {
					if ( ! preg_match( '/^\./u', $file ) ) {
						$base_class = str_replace( '.php', '', $file );
						$class_name = $ns . '\\ThePost\\' . $base_class;
						if ( class_exists( $class_name ) && $this->is_sub_class_of( $class_name, PostHelper::class ) ) {
							$this->post_type_to_override[ $this->str->camel_to_hyphen( $base_class ) ] = $class_name;
							$flg                                                                       = true;
						}
					}
				}
			}
		}
		if ( $flg ) {
			add_action( 'the_post', [ $this, 'the_post' ] );
		}
	}
public function scan_post_type ( ) { $ flg = false ; foreach ( $ this -> namespaces as $ ns => $ dir ) { $ dir = $ dir . '/' . $ ns . '/ThePost' ; if ( is_dir ( $ dir ) ) { foreach ( scandir ( $ dir ) as $ file ) { if ( ! preg_match ( '/^\./u' , $ file ) ) { $ base_class = str_replace ( '.php' , '' , $ file ) ; $ class_name = $ ns . '\\ThePost\\' . $ base_class ; if ( class_exists ( $ class_name ) && $ this -> is_sub_class_of ( $ class_name , PostHelper :: class ) ) { $ this -> post_type_to_override [ $ this -> str -> camel_to_hyphen ( $ base_class ) ] = $ class_name ; $ flg = true ; } } } } } if ( $ flg ) { add_action ( 'the_post' , [ $ this , 'the_post' ] ) ; } }
Scan original post type to override
Scan original post type to override