/** * Retrieve generator extensions * * @param string|null $generator The generator to retrieve extensions for, or NULL to retrieve all generators * @return array */ public static function allExtensions($generator = NULL) { /* Fetching extensions for a specific generator or all generators? */ if ($generator === NULL) { $rawExtensions = array_merge(\IPS\Application::allExtensions('faker', static::NODES), \IPS\Application::allExtensions('faker', static::ITEMS), \IPS\Application::allExtensions('faker', static::COMMENTS), \IPS\Application::allExtensions('faker', static::ACTIVERECORDS)); } else { $rawExtensions = \IPS\Application::allExtensions('faker', $generator); } /* Update keys for extensions with explicitly defined apps */ $extensions = array(); foreach ($rawExtensions as $key => $extension) { if (property_exists($extension, 'app')) { $splitKey = explode('_', $key); $splitKey = array($extension::$app, end($splitKey)); $key = implode('_', $splitKey); } $extensions[$key] = $extension; } return $extensions; }