<?php /** * @name Page Builder CK * @package com_pagebuilderck * @copyright Copyright (C) 2015. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @author Cedric Keiflin - https://www.template-creator.com - https://www.joomlack.fr */ // No direct access defined('_JEXEC') or die; Class PagebuilderckParams { protected $_attrs = array(); /** * Class constructor, overridden in descendant classes. * * @param mixed $properties Either and associative array or another * object to set the initial properties of the object. * * @since 11.1 */ public function __construct($properties = null) { if ($properties !== null) { $this->setProperties($properties); } } /** * Returns a property of the object or the default value if the property is not set. * * @param string $property The name of the property. * @param mixed $default The default value. * * @return mixed The value of the property. * * @since 11.1 * * @see JObject::getProperties() */ public function get($property, $default = null) { if (isset($this->$property)) { return $this->$property; } return $default; } /** * Modifies a property of the object, creating it if it does not already exist. * * @param string $property The name of the property. * @param mixed $value The value of the property to set. * * @return mixed Previous value of the property. * * @since 11.1 */ public function set($property, $value = null) { $previous = isset($this->$property) ? $this->$property : null; $this->$property = $value; return $previous; } /** * Set the object properties based on a named array/hash. * * @param mixed $properties Either an associative array or another object. * * @return boolean * * @since 11.1 * * @see JObject::set() */ public function setProperties($properties) { if (is_array($properties) || is_object($properties)) { foreach ((array) $properties as $k => $v) { // Use the set function which might be overridden. $this->set($k, $v); } return true; } return false; } }