How to make a shipping method availability dependent on a custom configuration value?

You can programmatically manage a shipping carrier’s, method’s, or rate’s availability by implementing the following methods: