Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

(no description)

File Size: 297 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Google_Model:: (19 methods):
  __construct()
  __get()
  mapTypes()
  gapiInit()
  toSimpleObject()
  getSimpleValue()
  nullPlaceholderCheck()
  getMappedName()
  isAssociativeArray()
  createObjectFromName()
  assertIsArray()
  offsetExists()
  offsetGet()
  offsetSet()
  offsetUnset()
  keyType()
  dataType()
  __isset()
  __unset()


Class: Google_Model  - X-Ref

This class defines attributes, valid values, and usage which is generated
from a given json schema.
http://tools.ietf.org/html/draft-zyp-json-schema-03#section-5

__construct()   X-Ref
Polymorphic - accepts a variable number of arguments dependent
on the type of the model subclass.


__get($key)   X-Ref
Getter that handles passthrough access to the data array, and lazy object creation.

param: string $key Property name.
return: mixed The value if any, or null.

mapTypes($array)   X-Ref
Initialize this object's properties from an array.

param: array $array Used to seed this object's properties.
return: void

gapiInit()   X-Ref
Blank initialiser to be used in subclasses to do  post-construction initialisation - this
avoids the need for subclasses to have to implement the variadics handling in their
constructors.


toSimpleObject()   X-Ref
Create a simplified object suitable for straightforward
conversion to JSON. This is relatively expensive
due to the usage of reflection, but shouldn't be called
a whole lot, and is the most straightforward way to filter.


getSimpleValue($value)   X-Ref
Handle different types of values, primarily
other objects and map and array data types.


nullPlaceholderCheck($value)   X-Ref
Check whether the value is the null placeholder and return true null.


getMappedName($key)   X-Ref
If there is an internal name mapping, use that.


isAssociativeArray($array)   X-Ref
Returns true only if the array is associative.

param: array $array
return: bool True if the array is associative.

createObjectFromName($name, $item)   X-Ref
Given a variable name, discover its type.

param: $name
param: $item
return: object The object from the item.

assertIsArray($obj, $method)   X-Ref
Verify if $obj is an array.

param: array $obj Items that should be validated.
param: string $method Method expecting an array as an argument.

offsetExists($offset)   X-Ref
No description

offsetGet($offset)   X-Ref
No description

offsetSet($offset, $value)   X-Ref
No description

offsetUnset($offset)   X-Ref
No description

keyType($key)   X-Ref
No description

dataType($key)   X-Ref
No description

__isset($key)   X-Ref
No description

__unset($key)   X-Ref
No description