@@ 41-58 (lines=18) @@ | ||
38 | * @throws \Flying\Struct\Exception |
|
39 | * @throws \RuntimeException |
|
40 | */ |
|
41 | public function __construct($value = null, array $config = null) |
|
42 | { |
|
43 | // No change notification is required during object construction |
|
44 | $flag = $this->skipNotify; |
|
45 | $this->skipNotify = true; |
|
46 | $this->bootstrapConfig(); |
|
47 | $this->setConfig($config); |
|
48 | // We must be sure that property value is always valid |
|
49 | // even if no value for the property is given explicitly |
|
50 | if ($value !== null) { |
|
51 | if (!$this->setValue($value)) { |
|
52 | $this->reset(); |
|
53 | } |
|
54 | } else { |
|
55 | $this->reset(); |
|
56 | } |
|
57 | $this->skipNotify = $flag; |
|
58 | } |
|
59 | ||
60 | /** |
|
61 | * Reset property to its default state |
@@ 71-82 (lines=12) @@ | ||
68 | * @throws \Flying\Struct\Exception |
|
69 | * @throws \RuntimeException |
|
70 | */ |
|
71 | public function __construct($contents = null, $config = null) |
|
72 | { |
|
73 | // No change notification is required during object construction |
|
74 | $flag = $this->skipNotify; |
|
75 | $this->skipNotify = true; |
|
76 | $this->setConfig($config); |
|
77 | if ($contents !== null) { |
|
78 | $this->setInitialContents($contents); |
|
79 | } |
|
80 | $this->createStruct($this->getMetadata()); |
|
81 | $this->skipNotify = $flag; |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * Create structure from given metadata information |