Skip to content

Commit d0d3498

Browse files
committed
Add S3Options::getValue()
1 parent 52e51de commit d0d3498

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/S3/S3Options.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace WP2Static\S3;
44

5+
use WP2Static\Options;
56
use WP2Static\OptionSpec;
67

78
/*
@@ -121,4 +122,15 @@ public static function optionSpecs(): array {
121122
self::$cached_option_specs = $ret;
122123
return $ret;
123124
}
125+
126+
public static function getValue( string $slug ): string {
127+
$name = self::getName( $slug );
128+
$option_spec = self::optionSpecs()[ $name ];
129+
130+
if ( ! $option_spec ) {
131+
throw WsLog::ex( "Unknown option: $name" );
132+
}
133+
134+
return Options::getSpecValue( $option_spec );
135+
}
124136
}

0 commit comments

Comments
 (0)