/** * Static constructor. * * @param MiniGameId $gameId * @param PlayerId $playerId * @param PlayerOptions $playerOptions * @param Context $context * * @return JoinGameCommand */ public static function create(MiniGameId $gameId, PlayerId $playerId, PlayerOptions $playerOptions, Context $context = null) { $obj = new self(); $obj->init($gameId, $playerId, $context); $obj->playerOptions = $playerOptions; return $obj; }
/** * Get an instance of the columnconfig class. * * @param Node $node * @param string $id * @param bool $forceNew force new instance? * * @return ColumnConfig An instance of the columnconfig class */ public static function getConfig($node, $id = null, $forceNew = false) { static $s_instances = []; $sm = SessionManager::getInstance(); if ($id == null) { $id = $node->atkNodeUri(); } if (!isset($s_instances[$id]) || $forceNew) { $cc = new self(); $s_instances[$id] = $cc; $cc->setNode($node); $colcfg = $sm != null ? $sm->pageVar('atkcolcfg_' . $id) : null; if (!is_array($colcfg) || $forceNew) { // create new Tools::atkdebug('New colconfig initialising'); $cc->init(); } else { // inherit old config from session. Tools::atkdebug('Resuming colconfig from session'); $cc->m_colcfg =& $colcfg; } // See if there are any url params which influence this colcfg. $cc->doUrlCommands(); } if ($sm != null) { $sm->pageVar('atkcolcfg_' . $id, $s_instances[$id]->m_colcfg); } return $s_instances[$id]; }
/** * Static constructor. * * @param TwitterMessageId $id * @param TwitterUser $recipient * @param TwitterUser $sender * @param string $text * @param \DateTimeInterface $createdAt * @param TwitterEntities $entities * * @return TwitterDirectMessage */ public static function create(TwitterMessageId $id, TwitterUser $sender, TwitterUser $recipient, $text, \DateTimeInterface $createdAt, TwitterEntities $entities) { $obj = new self(); $obj->init($id, $sender, $text, $entities, $createdAt); $obj->recipient = $recipient; return $obj; }
public static function quickStart() { $Loader = new self(); $Loader->init(); $Loader->display(); return $Loader; }
/** * Construct * * @param MiniGameId $id * @param PlayerId $playerId * @param GameOptions $options * @param Context $origin * * @return CreateGameCommand */ public static function create(MiniGameId $id, PlayerId $playerId, GameOptions $options = null, Context $origin = null) { $obj = new self(); $obj->init($id, $playerId, $origin); $obj->options = $options; return $obj; }
/** * Build a migration file using a given table. * * @param Table $table * @return mixed */ public static function build(Table $table) { $squasher = new self($table); $squasher->content = $squasher->init(); $squasher->fillInTableData(); $squasher->content .= $squasher->close(); return str_replace("\n", PHP_EOL, $squasher->content); }
/** * * @param string $action * @param \CourseDescription\CourseDescription $description * @return \CourseDescription\CourseDescription */ static function create($action, $description = null) { $result = new self('course_description', 'post', $action); if ($description) { $result->init($description); } return $result; }
/** * * @param string $action * @param \Glossary\Glossary $item * @return \Glossary\GlossaryForm */ static function create($action, $item = null) { $result = new self('glossary', 'post', $action); if ($item) { $result->init($item); } return $result; }
/** * Constructor * * @param PlayerId $playerId * @param MiniGameId $gameId * @param string $name * @param int $lives * @param string $externalReference * * @return HangmanPlayerOptions */ public static function create(PlayerId $playerId, MiniGameId $gameId, $name, $lives, $externalReference = null) { $obj = new self(); $obj->init($playerId, $gameId, $name); $obj->lives = $lives; $obj->externalReference = $externalReference; return $obj; }
/** * No LSB in pre-5.3 PHP, to be refactored later */ public static function staticInit( Parser &$parser ) { global $egParserFunEnabledFunctions; if( in_array( 'parse', $egParserFunEnabledFunctions ) ) { // only register function if not disabled by configuration $instance = new self; $instance->init( $parser ); } return true; }
public static function getInstance(array $config) { if (self::$_instance === null) { $instance = new self(); $instance->init($config); self::$_instance = $instance; } return self::$_instance; }
/** * Singleton class instance * @return Login_Counter */ public static function get_instance() { static $instance; if (!isset($instance)) { $instance = new self(); $instance->init(); } return $instance; }
/** * 获取一个Cache_Memcache实例 * * @param integer $clusterId cluster id * @return object */ public static function getInstance($config_name = 'DefaultMemcacheServers') { if (empty(self::$_objList[$config_name])) { $obj = new self($config_name); $obj->init(); self::$_objList[$config_name] =& $obj; } return self::$_objList[$config_name]; }
public static function from($params = array()) { $client = new self(); foreach ($params as $key => $val) { $client->{$key} = $val; } $client->init(); return $client; }
/** * Instance factory * * @since 1.0.0 */ public static function instance() { static $instance = null; if (null === $instance) { $instance = new self(); $instance->init(); $instance->setup_actions(); } return $instance; }
public static function get_view() { $object = new self(); $object->init(); $object->check_authorizations(); $object->build_form(AppContext::get_request()); if ($object->submit_button->has_been_submited() && $object->form->validate()) { $id = $object->save(); AppContext::get_response()->redirect(GuestbookUrlBuilder::home($object->is_new_message ? 1 : $object->form->get_value('page'), $id)); } $object->view->put('FORM', GuestbookAuthorizationsService::check_authorizations()->write() && !AppContext::get_current_user()->is_readonly() ? $object->form->display() : ''); return $object->view; }
public static function withHdwLedId($db, $idLed, $serialHdw) { $instance = new self($db, null); $result = $instance->myDB->row($instance->SQL_SRV_GET_FROM_HDWLED, array('hdwSerial' => $serialHdw, 'hdwIdLed' => $idLed)); if ($result != null) { $instance->srvGlobalId = $result['id_service']; $instance->selectedLed = $result['id_led_service']; $instance->srvLocalId = $result['srvLocalId']; $instance->serialParentHdw = $serialHdw; $instance->init(); return $instance; } return null; }
protected static function all($condition) { $query = DBEntity::query('SELECT ' . self::$selector . ' FROM ' . static::table() . ' WHERE ' . $condition); if ($query == false) { return null; } $result = array(); while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) { $entity = new self(); $entity->init($row); array_push($result, $entity); } return $result; }
/** * @param $method * @param array $arguments * @return callable|void * @throws \Exception */ public static function __callStatic($method, $arguments = array()) { if ($method == 'instance' && !empty($arguments)) { $schema = new self($arguments[0], new Inflector()); if (is_callable(array($schema, 'init'))) { if ($arguments[1] instanceof Closure) { return $schema->init($arguments[1], $schema); } else { return $schema->init($schema); } } } else { throw new \Exception(sprintf('Oops, Undefined method called %s', 'Schema::' . $method)); } }
/** * No LSB in pre-5.3 PHP *sigh*. * This is to be refactored as soon as php >=5.3 becomes acceptable. */ public static function staticInit(Parser &$parser) { $instance = new self(); return $instance->init($parser); }
public static function get_view() { $object = new self(); $object->init(); $object->check_authorizations(); $object->build_view(); return $object->tpl; }
public static function getInfo() { $np = new self(); $np->init(); return $np->_info; }
/** * (non-PHPdoc) * @see Site/lib/models/SPDBObject#delete() * @param bool $childs - update child entries parent */ public function delete($childs = true) { parent::delete(); SPFactory::cache()->cleanSection(); SPFactory::cache()->deleteObj('category', $this->id); try { /* get all child cats and delete these too */ $childs = $this->getChilds('category', true); if (count($childs)) { foreach ($childs as $child) { $cat = new self(); $cat->init($child); $cat->delete(false); } } $childs[$this->id] = $this->id; SPFactory::db()->delete('spdb_category', array('id' => $this->id)); if ($childs) { SPFactory::db()->update('spdb_object', array('parent' => Sobi::Section()), array('parent' => $childs)); } } catch (SPException $x) { Sobi::Error($this->name(), SPLang::e('CANNOT_DELETE_CATEGORY_DB_ERR', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__); } }
/** * @param array $params * @return UTIL_Ftp */ public static function getConnection(array $params) { if (!function_exists('ftp_connect')) { throw new LogicException(self::ERROR_FTP_FUNCTION_IS_NOT_AVAILABLE); } if (empty($params['host'])) { throw new InvalidArgumentException(self::ERROR_EMPTY_HOST_PROVIDED); } if (empty($params['login']) || empty($params['password'])) { throw new InvalidArgumentException(self::ERROR_EMPTY_CREDENTIALS_PROVIDED); } $connection = new self(); if (!empty($params['timeout'])) { $connection->setTimeout((int) $params['timeout']); } if (!$connection->connect(trim($params['host']), !empty($params['port']) ? (int) $params['port'] : 21)) { throw new LogicException(self::ERROR_CANT_CONNECT_TO_HOST); } if (!$connection->login(trim($params['login']), trim($params['password']))) { throw new LogicException(self::ERROR_INVALID_CREDENTIALS_PROVIDED); } $connection->init(); return $connection; }
/** * Create a cache listener. * * @return Tribe__Events__Cache_Listener */ private static function create_listener() { $listener = new self(); $listener->init(); return $listener; }
/** * @param Config $config * @param LoggerInterface $logger * @param MetricsInterface $metrics * @return DeferredQueue */ public static function factory(Config $config, LoggerInterface $logger, MetricsInterface $metrics) { $server = new self($config, $logger, $metrics); $server->init(); return $server; }
public static function get_view() { $object = new self(); $object->check_authorizations(); $object->init(); $object->build_form(AppContext::get_request()); return $object->view; }
/** * @param $method * @param array $arguments * @return callable|void * @throws \Exception */ public static function __callStatic($method, $arguments = []) { if ($method == 'make' && !empty($arguments)) { $schema = new self($arguments[0]); if (is_callable([$schema, 'init'])) { if (isset($arguments[1]) && $arguments[1] instanceof Closure) { return $schema->init($arguments[1], $schema); } return $schema->init($schema); } } throw new \Exception(sprintf('Oops, Undefined method called %s', 'Schema::' . $method)); }
/** * Static constructor. * * @param TwitterMessageId $id * @param TwitterUser $sender * @param string $text * @param string $lang * @param \DateTimeInterface $createdAt * @param TwitterEntities $entities * @param TwitterCoordinates $coordinates * @param TwitterPlace $place * @param int $inReplyToStatusId * @param int $inReplyToUserId * @param string $inReplyToScreenName * @param bool $retweeted * @param int $retweetCount * @param bool $favorited * @param int $favoriteCount * @param bool $truncated * @param null $source * @param Tweet $retweetedStatus * * @return Tweet */ public static function create(TwitterMessageId $id, TwitterUser $sender, $text, $lang, \DateTimeInterface $createdAt, TwitterEntities $entities, TwitterCoordinates $coordinates = null, TwitterPlace $place = null, $inReplyToStatusId = null, $inReplyToUserId = null, $inReplyToScreenName = null, $retweeted = false, $retweetCount = 0, $favorited = false, $favoriteCount = 0, $truncated = false, $source = null, Tweet $retweetedStatus = null) { $obj = new self(); $obj->init($id, $sender, $text, $entities, $createdAt); $obj->lang = $lang; $obj->coordinates = $coordinates; $obj->place = $place; $obj->inReplyToStatusId = $inReplyToStatusId; $obj->inReplyToUserId = $inReplyToUserId; $obj->inReplyToScreenName = $inReplyToScreenName; $obj->retweeted = $retweeted; $obj->retweetCount = $retweetCount; $obj->favorited = $favorited; $obj->favoriteCount = $favoriteCount; $obj->truncated = $truncated; $obj->source = $source; $obj->retweetedStatus = $retweetedStatus; return $obj; }
/** * @return $this */ public static function factory() { $self = new self(); return $self->init(); }