X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FSectionStorage%2FSectionStorageDefinition.php;fp=web%2Fcore%2Fmodules%2Flayout_builder%2Fsrc%2FSectionStorage%2FSectionStorageDefinition.php;h=61b975a471825d53af63e6804d6696bf578f905b;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php b/web/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php new file mode 100644 index 000000000..61b975a47 --- /dev/null +++ b/web/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php @@ -0,0 +1,75 @@ + $value) { + $this->set($property, $value); + } + } + + /** + * Gets any arbitrary property. + * + * @param string $property + * The property to retrieve. + * + * @return mixed + * The value for that property, or NULL if the property does not exist. + */ + public function get($property) { + if (property_exists($this, $property)) { + $value = isset($this->{$property}) ? $this->{$property} : NULL; + } + else { + $value = isset($this->additional[$property]) ? $this->additional[$property] : NULL; + } + return $value; + } + + /** + * Sets a value to an arbitrary property. + * + * @param string $property + * The property to use for the value. + * @param mixed $value + * The value to set. + * + * @return $this + */ + public function set($property, $value) { + if (property_exists($this, $property)) { + $this->{$property} = $value; + } + else { + $this->additional[$property] = $value; + } + return $this; + } + +}