Пример #1
0
 public function test_factory_shouldNotFindAComponent_IfPluginIsLoadedButNotActivated()
 {
     PluginManager::getInstance()->loadPlugin('ExampleReport');
     $module = 'ExampleReport';
     $action = 'GetExampleReport';
     $report = ComponentFactory::factory($module, $action, self::REPORT_CLASS_NAME);
     $this->assertNull($report);
 }
Пример #2
0
 /**
  * Get an instance of a specific report belonging to the given module and having the given action.
  * @param  string $module
  * @param  string $action
  * @return null|\Piwik\Plugin\Report
  * @api
  */
 public static function factory($module, $action)
 {
     return ComponentFactory::factory($module, ucfirst($action), __CLASS__);
 }
Пример #3
0
 /**
  * Creates a Dimension instance from a string ID (see {@link getId()}).
  *
  * @param string $dimensionId See {@link getId()}.
  * @return Dimension|null The created instance or null if there is no Dimension for
  *                        $dimensionId or if the plugin that contains the Dimension is
  *                        not loaded.
  * @api
  */
 public static function factory($dimensionId)
 {
     list($module, $dimension) = explode('.', $dimensionId);
     return ComponentFactory::factory($module, $dimension, __CLASS__);
 }