Table of Contents

nsObject

Synopsis

Description

nsObject is a class to extend class properties. It allows defining hidden getters/setters using overloading functionality of PHP 5.

Getters and setters

By default all properties that will have public access should be defined as public. If you need to add getter or setter for a property you need to change visibility to privage/protected and define these public methods:

// Default befaviour of getters. Declare your own if you need to change something.
public function getPropertyName(){
  return $this->propertyName;
}
 
// Default befaviour of setters. Declare your own if you need to change something.
public function setPropertyName($value){
  $this->propertyName := $value;
}
// Optional - it is already declared. Override only if your property is with different name or it does not exist as a property. 
public function hasField($field) {
  return isset($this->$field);
}