11<?php
2+
3+ // phpcs:disable PEAR.NamingConventions.ValidClassName.StartWithCapital,PEAR.NamingConventions.ValidClassName.Invalid
24/**
35 * phpstorm follows symlinks when indexing, which creates an infinite loop of indexing.
46 * The inclusion of the vendor folders is mostly the problem
57 */
6-
78class phpstorm_exclude_recursive_folders {
89
910 public static function init () {
@@ -74,7 +75,7 @@ protected static function has_project_iml() {
7475 */
7576 protected static function get_project_name () {
7677 $ pwd = getcwd ();
77- $ project_name = substr ( $ pwd , strrpos ( $ pwd , " / " ) + 1 );
78+ $ project_name = substr ( $ pwd , strrpos ( $ pwd , ' / ' ) + 1 );
7879
7980 return $ project_name ;
8081 }
@@ -87,8 +88,8 @@ protected static function get_project_iml_path() {
8788 $ modules_xml = new DOMDocument ();
8889 $ modules_xml ->load ( '.idea/modules.xml ' );
8990 $ iml_file_path = $ modules_xml ->getElementsByTagName ( 'component ' )->item ( 0 )
90- ->getElementsByTagName ( 'modules ' )->item ( 0 )
91- ->getElementsByTagName ( 'module ' )->item ( 0 )->getAttribute ( 'filepath ' );
91+ ->getElementsByTagName ( 'modules ' )->item ( 0 )
92+ ->getElementsByTagName ( 'module ' )->item ( 0 )->getAttribute ( 'filepath ' );
9293 $ iml_file_path = str_replace ( '$PROJECT_DIR$/ ' , '' , $ iml_file_path );
9394
9495 return $ iml_file_path ;
@@ -120,13 +121,15 @@ protected static function get_exclude_dir_list() {
120121 * Add the folders to exclude in the iml file.
121122 */
122123 protected static function set_exclude_in_project_iml () {
123- $ folders_to_exclude = self ::get_exclude_dir_list ();
124- $ iml_xml = new DOMDocument ();
124+ $ folders_to_exclude = self ::get_exclude_dir_list ();
125+ $ iml_xml = new DOMDocument ();
126+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
125127 $ iml_xml ->preserveWhiteSpace = false ;
126- $ iml_xml ->formatOutput = true ;
128+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
129+ $ iml_xml ->formatOutput = true ;
127130 $ iml_xml ->load ( self ::get_project_iml_path () );
128131 $ iml_xml_content_node = $ iml_xml ->getElementsByTagName ( 'component ' )->item ( 0 )
129- ->getElementsByTagName ( 'content ' )->item ( 0 );
132+ ->getElementsByTagName ( 'content ' )->item ( 0 );
130133 $ xpath = new DomXpath ( $ iml_xml );
131134
132135 foreach ( $ folders_to_exclude as $ folder ) {
@@ -144,8 +147,10 @@ protected static function set_exclude_in_project_iml() {
144147 $ iml_xml_content_node ->appendChild ( $ exclude_node );
145148 }
146149
150+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
147151 $ iml_xml ->preserveWhiteSpace = false ;
148- $ iml_xml ->formatOutput = true ;
152+ // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase
153+ $ iml_xml ->formatOutput = true ;
149154 $ iml_xml ->save ( self ::get_project_iml_path () );
150155 }
151156}
0 commit comments