1: <?php
2:
3: namespace Charcoal\Source;
4:
5: use \InvalidArgumentException;
6:
7: // Dependency from 'charcoal-config'
8: use \Charcoal\Config\AbstractConfig as AbstractConfig;
9:
10: /**
11: * Source Config
12: */
13: class SourceConfig extends AbstractConfig
14: {
15: /**
16: * @var string $type
17: */
18: private $type;
19:
20: /**
21: * @return array
22: */
23: public function defaults()
24: {
25: return [
26: 'type' => ''
27: ];
28: }
29:
30: /**
31: * @param string $type The type of source.
32: * @throws InvalidArgumentException If parameter is not a string.
33: * @return SourceConfig Chainable
34: */
35: public function setType($type)
36: {
37: if (!is_string($type)) {
38: throw new InvalidArgumentException(
39: 'Source type must be a string.'
40: );
41: }
42: $this->type = $type;
43: return $this;
44: }
45:
46: /**
47: * @return string
48: */
49: public function type()
50: {
51: return $this->type;
52: }
53: }
54: