本文整理汇总了PHP中ArrayAdapter::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayAdapter::getData方法的具体用法?PHP ArrayAdapter::getData怎么用?PHP ArrayAdapter::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayAdapter
的用法示例。
在下文中一共展示了ArrayAdapter::getData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public final function init(ArrayAdapter $params)
{
//Стандартные параметры
$this->name = $params->str('name', 'Акция');
$this->isActive = $params->bool('active', true);
$this->isByDate = $params->hasNoEmpty('to');
if ($this->isByDate) {
$this->secondsLeft = strtotime($params->str('to')) - time();
$this->isActive = $this->isActive && $this->secondsLeft > 0;
}
//Параметры акции (только те, что начинаются с data_)
$this->params = ArrayAdapter::inst($params->getByKeyPrefix('data_', true));
//Полный идентификатор акции
$this->stockIdent = $this->sign($this->params->getData());
//Вызовем инициализацию класса-наследника
$this->onInit($this->params);
}
示例2: getPluginContent
public function getPluginContent($content, ArrayAdapter $params, PluginFetchingContext $ctxt)
{
$id = $params->int('id');
$name = $params->str('test_name');
$minutes = $params->int('time');
$tasksCnt = $ctxt->getTasksCount();
$result = null;
$testing = null;
if ($id) {
$testing = TestingBean::inst()->updateTestingState($id, $name, $tasksCnt, $minutes);
$result = TestingManager::getInstance()->getTestingResults($testing->getTestingId());
}
$tplData = $params->getData();
$tplData['testing'] = $testing;
$tplData['tasks'] = $content;
$tplData['results'] = $result;
$tplData['tasks_cnt'] = $tasksCnt;
$content = $this->getFoldedEntity()->fetchTpl($tplData);
$data = $testing ? $testing->getTestingId() : null;
return new PluginContent($content, $data);
}
示例3: makeNewFolding
/**
* Метод создаёт новый фолдинг
*/
public function makeNewFolding(ArrayAdapter $adapter)
{
$ifaces = $adapter->arr('ifaces');
$rtypes = $adapter->arr('rtypes');
$type = lowertrim($adapter->str('FoldingType'));
$subtype = lowertrim($adapter->str('FoldingSubType'));
$group = $adapter->str('FoldingGroup');
$classPrefix = $adapter->str('FoldingClassPrefix');
check_condition($type, 'Не передан тип фолдинга');
check_condition($group, 'Не передана группа для фолдинга');
check_condition($classPrefix, 'Не передан префикс для классов фолдинга');
//TODO - определять директорию для воздания менеджера фолдингов.
die('Folding dir is not deffined.');
$classesDi = DirItem::inst(array('sdk/kit', 'folded'), $group);
check_condition(!$classesDi->isDir(), "Директория {$classesDi} уже существует");
check_condition(!$classesDi->isFile(), "Элемент {$classesDi} не может быть файлом");
$rtypes = array_intersect(array_keys(PsUtil::getClassConsts('FoldedResources', 'RTYPE_')), $rtypes);
$rtypesArr = trim(implode(', self::', $rtypes));
$rtypesArr = $rtypesArr ? "self::{$rtypesArr}" : '';
$hasPhp = in_array('RTYPE_PHP', $rtypes);
$classesDm = DirManager::inst($classesDi->getRelPath())->makePath();
$resourcesPatternDmTo = DirManager::resources(array('folded', $group, FoldedResources::PATTERN_NAME));
check_condition(!$resourcesPatternDmTo->isDir(), "Целевая директория {$resourcesPatternDmTo} существует");
$resourcesPatternDmFrom = DirManager::resources(array('folded', FoldedResources::PATTERN_NAME));
check_condition($resourcesPatternDmFrom->isDir(), "Некорректна директория-источник {$resourcesPatternDmFrom}");
$interfaces = array();
foreach ($this->getFoldedInterfaces($ifaces) as $name => $ifaceClass) {
$ctt = $ifaceClass->getClassBody();
if ($ctt) {
$interfaces[] = "/****************\n\t * {$name}\n\t ****************/\n" . $ctt;
}
}
$smParams = $adapter->getData();
$smParams['rtypes'] = $rtypesArr;
$smParams['funique'] = FoldedResources::unique($type, $subtype);
$smParams['BaseClass'] = 'Base' . $classPrefix;
$smParams['ManagerClass'] = $classPrefix . 'Manager';
$smParams['ResourcesClass'] = $classPrefix . 'Resources';
$smParams['implements'] = $ifaces ? 'implements ' . implode(', ', $ifaces) . ' ' : '';
$smParams['interfaces'] = $interfaces ? implode("\n\n\t", $interfaces) : '';
try {
//КЛАССЫ
//Resources
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'resources.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['ResourcesClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
//Manager
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'manager.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['ManagerClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
if ($hasPhp) {
//BaseClass
$tpl = PSSmarty::template(DirItem::inst(array(__DIR__, 'tpls'), 'baseclass.tpl'), $smParams);
$di = $classesDm->getDirItem(null, $smParams['BaseClass'], 'php');
$di->writeToFile(trim($tpl->fetch()), true);
}
//ШАБЛОН ДЛЯ СУЩНОСТЕЙ
$resourcesPatternDmTo->makePath();
foreach ($rtypes as $rtype) {
$ext = FoldedResources::resourceTypeToExt(PsUtil::newReflectionClass('FoldedResources')->getConstant($rtype));
$diTo = $resourcesPatternDmTo->getDirItem(null, FoldedResources::PATTERN_NAME, $ext);
$diFrom = $resourcesPatternDmFrom->getDirItem(null, FoldedResources::PATTERN_NAME, $ext);
if ($ext == PsConst::EXT_PHP) {
$diTo->writeToFile(str_replace('eclassnamebase', $smParams['BaseClass'], $diFrom->getFileContents()));
continue;
}
$diFrom->copyTo($diTo);
}
} catch (Exception $ex) {
$classesDm->clearDir(null, true);
$resourcesPatternDmTo->clearDir(null, true);
throw $ex;
}
}
示例4: __toString
public function __toString()
{
return __CLASS__ . ' ' . array_to_string($this->params->getData(), false);
}