UpdateServiceProvider
extends ServiceProvider
in package
Table of Contents
Constants
- DEFAULT_REPOSITORY_URL = 'https://www.a-blogcms.jp/api/update.json'
- system_update_repository が未設定・空・非文字列の場合のフォールバック先。 config.system.default.yaml の既定値と同じ値にしている。
Methods
- init() : void
- initialize service
- register() : void
- register service
- resolveRepositoryUrl() : string
- system_update_repository の設定値を取得する。
Constants
DEFAULT_REPOSITORY_URL
system_update_repository が未設定・空・非文字列の場合のフォールバック先。 config.system.default.yaml の既定値と同じ値にしている。
private
mixed
DEFAULT_REPOSITORY_URL
= 'https://www.a-blogcms.jp/api/update.json'
Methods
init()
initialize service
public
init() : void
register()
register service
public
register(Container $container) : void
Parameters
- $container : Container
resolveRepositoryUrl()
system_update_repository の設定値を取得する。
private
resolveRepositoryUrl() : string
Why not: config.system.default.yaml の既定値を https に変えるだけでは済ませられない。 private/config.system.yaml(差し替え対象外)や DB コンフィグにすでに http:// の値が 保存されている環境には既定値の変更が反映されないため、ここで読み替える。
Why not: config() の第2引数(デフォルト値)に self::DEFAULT_REPOSITORY_URL を渡している。 Field::get() は該当キーが未設定・空文字・型不正のいずれでも渡した既定値を採用したうえで 必ず string にキャストして返す実装のため、is_string() による分岐は不要(分岐を書くと config() の PHPDoc 型(文字列キーでは string に縮退)により PHPStan には常に true と 判定され静的解析の抑制コメントが要る。この既定値渡しならその抑制自体が要らない)。