You are here

function moopapi_object in Module Object Oriented Programming API 6.2

Same name and namespace in other branches
  1. 6 moopapi.module \moopapi_object()
  2. 7.2 moopapi.module \moopapi_object()
  3. 7 moopapi.module \moopapi_object()

Central pool of all of existent and loaded oop module objects.

File

./moopapi.module, line 125

Code

function moopapi_object($app) {
  static $objects = array();
  $app_lower = strtolower($app);
  $new_object = ComponentFactory::get($app, Component::TYPE_CONTROLLER, Component::ID_APPLICATION, unserialize(variable_get("{$app_lower}_decorators", serialize(array()))));

  // @todo Implement caching per decorator.
  if (!isset($objects[$app]) || get_class($objects[$app]) != get_class($new_object)) {
    $objects[$app] = $new_object;
  }
  return $objects[$app];
}