@@ -120,55 +120,57 @@ public function run($depth, $ext, $path, $pathName, $name) {
120
120
$ patternStoreData ["breadcrumb " ] = array ("patternType " => $ patternTypeClean , "patternSubtype " => $ patternSubtypeClean );
121
121
}
122
122
123
- $ patternDataBase = array ();
124
- if (file_exists (Config::getOption ("patternSourceDir " ).DIRECTORY_SEPARATOR .$ path .DIRECTORY_SEPARATOR .$ patternBaseData )) {
125
- $ data = file_get_contents (Config::getOption ("patternSourceDir " ).DIRECTORY_SEPARATOR .$ path .DIRECTORY_SEPARATOR .$ patternBaseData );
123
+ $ patternBaseData = array ();
124
+ $ patternBaseFilePath = Config::getOption ("patternSourceDir " ).DIRECTORY_SEPARATOR .$ path .DIRECTORY_SEPARATOR .$ patternBaseData ;
125
+
126
+ if (file_exists ($ patternBaseFilePath )) {
127
+ $ patternBaseData = file_get_contents ($ patternBaseFilePath );
126
128
if ($ ext == "json " ) {
127
- $ patternDataBase = json_decode ($ data ,true );
129
+ $ patternBaseData = json_decode ($ patternBaseData ,true );
128
130
if ($ jsonErrorMessage = JSON ::hasError ()) {
129
- JSON ::lastErrorMsg ($ patternBaseJSON ,$ jsonErrorMessage ,$ data );
131
+ JSON ::lastErrorMsg ($ patternBaseFilePath ,$ jsonErrorMessage ,$ patternBaseData );
130
132
}
131
133
} else {
132
134
133
135
try {
134
- $ patternDataBase = YAML ::parse ($ data );
136
+ $ patternBaseData = YAML ::parse ($ patternBaseData );
135
137
} catch (ParseException $ e ) {
136
- printf ("unable to parse " .$ pathNameClean .": %s.. \n" , $ e ->getMessage ());
138
+ printf ("unable to parse " .$ patternBaseFilePath .": %s.. \n" , $ e ->getMessage ());
137
139
}
138
140
139
141
// single line of text won't throw a YAML error. returns as string
140
- if (gettype ($ patternDataBase ) == "string " ) {
141
- $ patternDataBase = array ();
142
+ if (gettype ($ patternBaseData ) == "string " ) {
143
+ $ patternBaseData = array ();
142
144
}
143
-
144
145
}
145
-
146
146
}
147
147
148
148
// get the data for the pseudo-pattern
149
- $ data = file_get_contents (Config::getOption ("patternSourceDir " ).DIRECTORY_SEPARATOR .$ pathName );
149
+ $ patternPsuedoFilePath = Config::getOption ("patternSourceDir " ).DIRECTORY_SEPARATOR .$ pathName ;
150
+ $ patternPsuedoData = file_get_contents ($ patternPsuedoFilePath );
151
+
150
152
if ($ ext == "json " ) {
151
- $ patternData = json_decode ($ data ,true );
153
+ $ patternPsuedoData = json_decode ($ patternPsuedoData ,true );
152
154
if ($ jsonErrorMessage = JSON ::hasError ()) {
153
- JSON ::lastErrorMsg ($ name ,$ jsonErrorMessage ,$ data );
155
+ JSON ::lastErrorMsg ($ patternPsuedoFilePath ,$ jsonErrorMessage ,$ patternPsuedoData );
154
156
}
155
157
} else {
156
158
157
159
try {
158
- $ patternData = YAML ::parse ($ data );
160
+ $ patternPsuedoData = YAML ::parse ($ patternPsuedoData );
159
161
} catch (ParseException $ e ) {
160
- printf ("unable to parse " .$ pathNameClean .": %s.. \n" , $ e ->getMessage ());
162
+ printf ("unable to parse " .$ patternPsuedoFilePath .": %s.. \n" , $ e ->getMessage ());
161
163
}
162
164
163
165
// single line of text won't throw a YAML error. returns as string
164
- if (gettype ($ patternData ) == "string " ) {
165
- $ patternData = array ();
166
+ if (gettype ($ patternPsuedoData ) == "string " ) {
167
+ $ patternPsuedoData = array ();
166
168
}
167
169
168
170
}
169
171
170
172
// make sure the pattern data is an array before merging the data
171
- $ patternStoreData ["data " ] = is_array ($ patternData ) ? array_replace_recursive ($ patternDataBase , $ patternData ) : $ patternDataBase ;
173
+ $ patternStoreData ["data " ] = is_array ($ patternPsuedoData ) ? array_replace_recursive ($ patternBaseData , $ patternPsuedoData ) : $ patternBaseData ;
172
174
173
175
// if the pattern data store already exists make sure it is merged and overwrites this data
174
176
if (PatternData::checkOption ($ patternStoreKey )) {
0 commit comments