/** * Get an appropriate Action subclass for the given action * @param $action String * @param $page Page * @param $context IContextSource * @return Action|false|null false if the action is disabled, null * if it is not recognised */ public static final function factory($action, Page $page, IContextSource $context = null) { $class = self::getClass($action, $page->getActionOverrides()); if ($class) { $obj = new $class($page, $context); return $obj; } return $class; }
/** * Get an appropriate Action subclass for the given action * @param $action String * @param $page Article * @return Action|false|null false if the action is disabled, null * if it is not recognised */ public static final function factory($action, Page $page) { $class = self::getClass($action, $page->getActionOverrides()); if ($class) { $obj = new $class($page); return $obj; } return $class; }
/** * Get an appropriate Action subclass for the given action * @param $action String * @param $page Page * @param $context IContextSource * @return Action|bool|null false if the action is disabled, null * if it is not recognised */ final public static function factory( $action, Page $page, IContextSource $context = null ) { $classOrCallable = self::getClass( $action, $page->getActionOverrides() ); if ( is_string( $classOrCallable ) ) { $obj = new $classOrCallable( $page, $context ); return $obj; } if ( is_callable( $classOrCallable ) ) { return call_user_func_array( $classOrCallable, array( $page, $context ) ); } return $classOrCallable; }