Skip to content

Commit f0da928

Browse files
committed
adjust typing for SiteInfo
1 parent f824aef commit f0da928

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

src/SiteInfo.php

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,15 @@ public static function getPath( string $name ) : string {
9696
throw new WP2StaticException( $err );
9797
}
9898

99+
/**
100+
* @var string $original_path
101+
*/
102+
$original_path = self::$info[ $key ];
103+
99104
// Standardise all paths to use / (Windows support)
100-
$path = str_replace( '\\', '/', self::$info[ $key ] );
105+
$standardised_path = str_replace( '\\', '/', $original_path );
101106

102-
return $path;
107+
return $standardised_path;
103108
}
104109

105110
/**
@@ -120,7 +125,12 @@ public static function getUrl( string $name ) : string {
120125
throw new WP2StaticException( $err );
121126
}
122127

123-
return self::$info[ $key ];
128+
/**
129+
* @var string $url
130+
*/
131+
$url = self::$info[ $key ];
132+
133+
return $url;
124134
}
125135

126136
// TODO Use WP_Http 'curl_enabled' => $this->hasCurlSupport(),
@@ -138,7 +148,11 @@ public static function isUploadsWritable() : bool {
138148
self::$instance = new SiteInfo();
139149
}
140150

151+
/**
152+
* @var string $uploads_dir
153+
*/
141154
$uploads_dir = self::$info['uploads_path'];
155+
142156
return file_exists( $uploads_dir ) && is_writeable( $uploads_dir );
143157
}
144158

@@ -147,6 +161,9 @@ public static function permalinksAreCompatible() : bool {
147161
self::$instance = new SiteInfo();
148162
}
149163

164+
/**
165+
* @var string $structure
166+
*/
150167
$structure = get_option( 'permalink_structure' );
151168

152169
return strlen( $structure ) && 0 === strcmp( $structure[-1], '/' );
@@ -157,7 +174,12 @@ public static function getPermalinks() : string {
157174
self::$instance = new SiteInfo();
158175
}
159176

160-
return get_option( 'permalink_structure' );
177+
/**
178+
* @var string $permalink_structure
179+
*/
180+
$permalink_structure = get_option( 'permalink_structure' );
181+
182+
return $permalink_structure;
161183
}
162184

163185
/**
@@ -170,7 +192,12 @@ public static function getSiteURLHost() : string {
170192
self::$instance = new SiteInfo();
171193
}
172194

173-
$url_host = parse_url( self::$info['site_url'], PHP_URL_HOST );
195+
/**
196+
* @var string $site_url
197+
*/
198+
$site_url = self::$info['site_url'];
199+
200+
$url_host = parse_url( $site_url, PHP_URL_HOST );
174201

175202
if ( ! is_string( $url_host ) ) {
176203
$err = 'Failed to get hostname from Site URL';

0 commit comments

Comments
 (0)