You are here

function moopapi_object in Module Object Oriented Programming API 7.2

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

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

1 call to moopapi_object()
moopapi_wrap in ./moopapi.module
Api function that will create function wrapper to a class method

File

./moopapi.module, line 183

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];
}