original_string: 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' ] );
  		}
  	}
code: 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' ] );
  		}
  	}
code_tokens: 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' ] ) ; } }
docstring: Scan original post type to override
docstring_tokens: Scan original post type to override