public static function getInstance() { if (self::$instance == false) { self::$instance = new Manager(); } return self::$instance; }
/** * Returns an instance of the manager factory object. * * @return Manager */ public static function getInstance() { if (!self::$instance) { $class = __CLASS__; self::$instance = new $class(array('application' => 'CApplicationManager', 'history' => 'CHistoryManager', 'httptest' => 'CHttpTestManager')); } return self::$instance; }
public function setUp() { $this->chainClass = 'Psc\\CSS\\Manager'; parent::setUp(); $this->manager = Manager::instance('test'); $this->manager->register('css/some/test.css'); $this->manager->enqueue('test'); }
public function run() { $menu = Menu::instance(); $manager = Manager::instance(); $settings = Settings::instance(); $attachment_edit = AttachmentEdit::instance(); $menu->set_manager($manager); $menu->set_settings($settings); $menu->init_pages(); add_action('wpod', array($menu, 'add_components')); add_action('admin_enqueue_scripts', array($attachment_edit, 'enqueue_scripts'), 10, 1); add_action('attachment_submitbox_misc_actions', array($attachment_edit, 'attachment_submitbox_misc_actions'), 100, 0); add_filter('map_meta_cap', array($this, 'map_meta_cap'), 10, 4); }
/** * @return JSManager */ public static function getManager() { return Manager::instance('default'); }
public function read() { $input = @fread($this->socket, 2048); if (!$input && feof($this->socket)) { Manager::instance()->quit($this); return ''; } return trim($input); }
require_once "limber_record.php"; describe("connection manager", function ($spec) { $spec->context("getting adapter", function ($spec) { $spec->it("should find a valid adapter", function ($spec) { $adapter = Manager::instance()->adapter("mysql"); $spec($adapter)->should_not->be(null); }); $spec->it("should throw a LimberRecord_InvalidAdapterException when trying to get a invalid adapter", function ($spec) { try { $adapter = Manager::instance()->adapter("invalid_adapter"); $spec(true)->should->be(false); } catch (InvalidAdapterException $e) { $spec(true)->should->be(true); } }); }); $spec->it("should connect to a valid database", function ($spec) { $connection = Manager::instance()->connect("mock", "host", "user", "password"); $spec($connection)->should_not->be(null); }); }); //mocks namespace LimberRecord\Adapters; class Mock { public function connect($host, $user, $password) { } }