本文整理汇总了PHP中Object::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::get方法的具体用法?PHP Object::get怎么用?PHP Object::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __get
/**
* Uses the static method approach if our DI var is null
*
* @return Object
* @author Dan Cox
*/
public function __get($service)
{
if (is_null($this->DI)) {
return DI::get($service);
}
return $this->DI->get($service);
}
示例2: display
function display($tpl = null)
{
$this->state = $this->get('State');
$this->form = $this->get('Form');
//check if user access level allows view
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$access = isset($this->form->frontendaccess) && in_array($this->form->frontendaccess, $groups) ? true : false;
if ($access == false) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
// get params from menu
$this->menu_params = $this->state->get('params');
if ($this->menu_params['menu-meta_description']) {
$this->document->setDescription($this->menu_params['menu-meta_description']);
}
if ($this->menu_params['menu-meta_keywords']) {
$this->document->setMetadata('keywords', $this->menu_params['menu-meta_keywords']);
}
//get Item id d
$this->itemid = $this->state->get('itemid', '0');
//get form id
$this->id = JFactory::getApplication()->input->getInt('id', -1);
if ($this->_layout == "detail") {
// Get data from the model
$this->item = $this->get('Detail');
}
// Get data from the model
$this->form = $this->get('Form');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->fields = $this->get('Datafields');
parent::display($tpl);
}
示例3: addToolbar
/**
* Display the toolbar.
*
* @return void
*
* @since 2.5
*/
protected function addToolbar()
{
Request::setVar('hidemainmenu', 1);
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
$canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
Toolbar::apply('note.apply');
Toolbar::save('note.save');
}
if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
Toolbar::save2new('note.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
Toolbar::save2copy('note.save2copy');
}
if (empty($this->item->id)) {
Toolbar::cancel('note.cancel');
} else {
Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
}
Toolbar::divider();
Toolbar::help('note');
}
示例4: test_returnAllOnNullName
/**
* Test that the collection returns all on a NULL name
*
* @return void
* @author Dan Cox
*/
public function test_returnAllOnNullName()
{
$collections = $this->collection->get();
$this->assertTrue(array_key_exists('question', $collections));
$this->assertTrue(array_key_exists('comment', $collections));
$this->assertTrue(array_key_exists('error', $collections));
}
示例5: get
/**
* Returns a service, if a mock is specified for it, it will return the mock instead
*
* @return Object
* @author Dan Cox
*/
public static function get($service)
{
if (array_key_exists($service, static::$mocks)) {
return static::$mocks[$service];
}
return static::$container->get($service);
}
示例6: read
/**
* @see \herosphp\session\interfaces\ISession::read().
*/
public static function read($sessionId)
{
if (self::$handler == NULL) {
return '';
}
$data = self::$handler->get($sessionId);
return $data;
}
示例7: __construct
/**
* Set up the helper class
*
* @return void
*/
public function __construct($di = null)
{
if (!is_null($di)) {
$this->di = $di;
$this->output = $this->di->get('output');
$this->input = $this->di->get('input');
}
}
示例8: read
/**
* 获得缓存数据
* @param string $sid
* @return void
*/
function read($sid)
{
$m_data = $this->memcache->get($sid);
if (!isset($m_data['card'])) {
return array();
}
return $m_data['card'] === $this->card ? $m_data['Data'] : array();
}
示例9: test_compileAndRegister
/**
* Register the compiler pass and compile the DI
*
* @return void
* @author Dan Cox
*/
public function test_compileAndRegister()
{
$mock = new ServiceMockery('service');
$mock->add();
$this->DI->addCompilerPass(new MockeryPass());
$this->DI->compile();
$this->DI->get('service')->shouldReceive('test')->andReturn(true);
$this->assertTrue($this->DI->get('service')->test());
}
示例10: read
/**
* 获得缓存数据
* @param string $sid
* @return void
*/
function read($sid)
{
$data = $this->redis->get($sid);
if ($data) {
$values = explode("|#|", $data);
return $values[0] === $this->card ? $values[1] : '';
}
return $data;
}
示例11: test_replacementOfMaskValue
/**
* Test that when loading an existing mask, it overwrites current values
*
* @return void
* @author Dan Cox
*/
public function test_replacementOfMaskValue()
{
// Add a single mask
$this->masks->addMask('test', 'value');
// Replace this by adding a single mask with the same name
$this->masks->addMask('test', 'different');
$this->assertEquals('different', $this->masks->get('test'));
// Replace this again by adding an array
$this->masks->addMasks(array('test' => 'foo'));
$this->assertEquals('foo', $this->masks->get('test'));
}
示例12: get
/**
* 获取数据
*
* @param String $key 键值
* @return Mixed
*/
public function get($key)
{
$val = $this->mObject->get($key);
$unserialize_val = unserialize($val);
if (is_array($unserialize_val)) {
return $unserialize_val;
} else {
return $val;
}
return $val;
}
示例13: format
/**
* Checks a string for format codes and replaces it with its background/foreground color codes
*
* @return String
*/
public static function format($str)
{
preg_match('/<[A-Za-z0-9]+?>/', $str, $matches);
foreach ($matches as $match) {
$keyword = str_replace(array('<', '>'), '', $match);
$format = static::$collection->get(strtolower($keyword));
if (!empty($format)) {
$foreground = !isset($format['foreground']) ? '' : "[" . $format['foreground'] . "m";
$background = !isset($format['background']) ? '' : "[" . $format['background'] . "m";
$str = str_replace(array('<' . $keyword . '>', '</' . $keyword . '>'), array($foreground . $background, "[0m"), $str);
}
}
return $str;
}
示例14: get_tmp_dir_path
/**
* 從MD5取得檔案路徑
*
* @param Object $f3
* @param String $md5
* @return string
* @author Pulipuli Chen <pulipuli.chen@gmail.com>
* @version 20140908
*/
public static function get_tmp_dir_path($f3, $md5)
{
$path1 = substr($md5, 0, 2);
$path2 = substr($md5, 2, 2);
if ($f3->get("DEBUG.use_sys_tmp") === TRUE) {
$file_dir = sys_get_temp_dir() . "/";
} else {
$file_dir = $f3->get("UPLOADS") . "tmp/";
}
$file_dir .= "PFH/" . $path1 . "/" . $path2 . "/";
if (is_dir($file_dir) === FALSE) {
mkdir($file_dir, 0700, true);
}
return $file_dir;
}
示例15: get
/**
* 获得缓存数据
* @access public
* @param string $name 缓存KEY
* @return boolean
*/
public function get($name, $ctime = null)
{
//缓存KEY
$name = $this->options['prefix'] . $name;
$data = $this->memcacheObj->get($name);
return $data !== false ? $data : NULL;
}