There was an error while loading. Please reload this page.
1 parent e11d476 commit 84dfd33Copy full SHA for 84dfd33
1 file changed
src/Billing.php
@@ -41,6 +41,31 @@ public function __construct($config = [])
41
}
42
43
44
+ /**
45
+ * Get the billing config, or one key from it
46
+ *
47
+ * @param string|null $key Dot-notation key, eg `connections.stripe.currency`
48
+ * @return mixed
49
+ */
50
+ public function config(?string $key = null)
51
+ {
52
+ if ($key === null) {
53
+ return $this->config;
54
+ }
55
+
56
+ $value = $this->config;
57
58
+ foreach (explode('.', $key) as $segment) {
59
+ if (!is_array($value) || !array_key_exists($segment, $value)) {
60
+ return null;
61
62
63
+ $value = $value[$segment];
64
65
66
+ return $value;
67
68
69
/**
70
* Get a billing provider via name in config
71
*
0 commit comments