本文整理汇总了PHP中SplSubject类的典型用法代码示例。如果您正苦于以下问题:PHP SplSubject类的具体用法?PHP SplSubject怎么用?PHP SplSubject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SplSubject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* @param \SplSubject $subject
*
* @throws \InvalidArgumentException
*/
public function update(\SplSubject $subject)
{
if (!$subject instanceof EventInterface) {
throw new \InvalidArgumentException('Command can only be attached to an event!');
}
call_user_func_array($this, $subject->getInvokeArgs());
}
示例2: update
public function update(\SplSubject $subject)
{
$this->allow_models[] = 'Account';
$this->allow_models[] = 'Order';
$this->allow_models[] = 'OrderDetail';
$this->allow_models[] = 'Lead';
$this->allow_models[] = 'Patient';
$this->allow_models[] = 'User';
$Recipient_id = $subject->getParam('recipient', 0);
if ($Recipient_id) {
$dataModel = $subject->getGatewayServiceVerify()->get('Email')->findOne(['model_id' => $Recipient_id]);
if ($dataModel) {
$this->allow_models[] = ucfirst($dataModel->data);
}
}
if (!is_array($this->allow_models)) {
return;
}
foreach ($this->allow_models as $model) {
$visibleFields['pattern_items'][$model] = $subject->getAclServiceVerify()->getVisibleFields($model);
}
/* Copy current recipient data to array 'Contacts' */
if (isset($dataModel)) {
$visibleFields['pattern_items']['Contacts'] = $visibleFields['pattern_items'][ucfirst($dataModel->data)];
}
$subject->setData($visibleFields);
}
示例3: update
public function update(\SplSubject $obj)
{
if ($this->dev == true) {
$content = $obj->getFormatedException();
require 'view.php';
}
}
示例4: Update
public function Update(SplSubject $Subject)
{
$Status = $Subject->getStatus();
//retrieve status array
$Results = $Status['Results'];
$Sender = $Status['Sender'];
if (isset($Results[$this->Name])) {
if (isset($Results[$this->Name]['matches'])) {
$Sanitized = $this->ValidateInputs();
//get offset
$Matches = $this->GetSQLData($Sanitized['ResultFormat'], $Results[$this->Name]['matches']);
// $Matches = $this->HighLightResults($Matches, $Results[$this->Name]['query'], $this->Settings['Admin']->BuildExcerptsTitleEnable, $this->Settings['Admin']->BuildExcerptsBodyEnable);
$Matches = $this->HighLightResults($Matches, $Results[$this->Name]['query'], true, true);
// Highlighting is ALWAYS enabled
$Results[$this->Name]['matches'] = $Matches;
}
$Sender->SetData($this->Name, $Results[$this->Name]);
//still set the data even if no total found
if (!isset($Results[$this->Name]['total_found'])) {
$Total = 0;
} else {
$Total = $Results[$this->Name]['total_found'];
}
if ($Total > $this->Settings['Admin']->MaxMatches) {
$Total = $this->Settings['Admin']->MaxMatches;
}
//total_found is applied BEFORE setLimits and maxmatches take affect. We want to limit
//pagination results to the max matches that sphinx will return...or else some pages will have a blank result set
$this->BuildPager($Sender, $Total);
}
}
示例5: update
public function update(\SplSubject $subject)
{
/** @var FormConfigParser $subject */
$modelConfig = $subject->getModelConfigVerify();
$config = [];
// process groups
foreach ($modelConfig->groups as $_grp => $_fls) {
$parsedFSConfig = $this->setParsedFormConfig()->getParsedFormConfigVerify();
if (is_numeric($_grp)) {
$_grp = $_fls;
$_baseFieldSet = $_grp == 'fields';
$_label = $modelConfig->model;
} else {
$_baseFieldSet = isset($_fls['base']) && $_fls['base'] == true;
if (!isset($_fls['label'])) {
$_label = $modelConfig->model;
} else {
$_label = $_fls['label'];
}
}
$parsedFSConfig->name = $modelConfig->model . 'Fieldset';
$parsedFSConfig->group = $_grp;
$parsedFSConfig->type = 'fieldset';
$parsedFSConfig->options = ['label' => $_label];
$parsedFSConfig->attributes = ['name' => $_grp, 'class' => 'table'];
$config['fieldsets'][$_grp] = ['type' => $modelConfig->model . 'Fieldset', 'options' => ['label' => $_label]];
if ($_baseFieldSet == true) {
$config['fieldsets'][$_grp]['options']['use_as_base_fieldset'] = true;
}
$config['fieldsets_configs'][$_grp] = $parsedFSConfig;
}
$subject->addParsedConfig($config);
}
示例6: update
public function update(\SplSubject $obj)
{
if ($this->dev == true) {
$content = $obj->getFormatedError();
require __DIR__ . '/../../../../app/templates/errors.php';
}
}
示例7: update
public function update(\SplSubject $obj)
{
$q = $this->db->prepare('INSERT INTO exceptions SET message = :message, date = NOW()');
$q->bindValue(':message', $obj->getFormatedException());
$q->execute();
$q->closeCursor();
}
示例8: update
public function update(\SplSubject $subject)
{
$queue = Queue::declareQueue($this->queueName);
$producer = new \MicroQueue\Producer($queue);
$message = $subject->getData();
$producer->publish($message);
}
示例9: update
public function update(SplSubject $subject)
{
// looks for an observer method with the state name
if (method_exists($this, $subject->getState())) {
call_user_func_array(array($this, $subject->getState()), array($subject));
}
}
示例10: update
/**
* Receive update from subject
*
* @param SplSubject $subject Subject observed that contains event to write
*
* @return void
*/
public function update(SplSubject $subject)
{
$this->subject = $subject;
$event = $subject->getEvent();
// delegate to right event implementation
call_user_func(array($this, $event->getName()), $event);
}
示例11: update
public function update(\SplSubject $obj)
{
if ($this->dev == true) {
$content = $obj->getFormatedError();
require '/home/rousseauzx/www/app/templates/errors.php';
}
}
示例12: fillJoins
/**
* @param \SplSubject|Logic $subject
*/
protected function fillJoins($subject)
{
$models = $subject->getEventObject();
$modelConfig = $subject->getModelService()->getParsedModelConfig($subject->getModelName());
if (!(is_array($models) || $models instanceof ResultSetInterface)) {
$models = [$models];
}
$aModels = [];
foreach ($models as $_k => $aclModel) {
if ($aclModel instanceof AclDataModel) {
$mymodel = $aclModel->getDataModel();
} else {
$mymodel = $aclModel;
}
foreach ($modelConfig->joins as $_k => $join) {
if ($join['type'] == 'lookup') {
$this->fillLookup($join, $subject, $mymodel);
} elseif ($join['type'] == 'static_lookup') {
$this->fillStaticLookup($join, $subject, $mymodel);
}
}
$aModels[] = $mymodel->getArrayCopy();
}
if ($models instanceof ResultSetInterface) {
$models->initialize($aModels);
}
// else
// {
// $models = $aModels;
// }
}
示例13: update
public function update(\SplSubject $subject)
{
/** @var FormConfigParser $subject */
$modelConfig = $subject->getModelConfigVerify();
$formConfig = ['name' => $modelConfig->model . 'Form', 'group' => 'form', 'type' => 'form', 'options' => ['label' => $modelConfig->model . ' information'], 'attributes' => ['class' => 'validate apiform', 'method' => 'post', 'name' => $modelConfig->model . 'form', 'data-scope' => strtolower($modelConfig->model), 'data-id' => $subject->getDataModel()->id()], 'fieldsets' => [], 'elements' => [], 'filters' => [], 'validationGroup' => []];
$subject->addParsedConfig($formConfig);
}
示例14: getStateMachineContext
/**
* @param \SplSubject|StatemachineInterface|Statemachine $stateMachine
* @return \ArrayAccess|null
*/
private function getStateMachineContext($stateMachine)
{
$context = null;
if ($stateMachine instanceof Statemachine) {
$context = $stateMachine->getCurrentContext();
}
return $context;
}
示例15: update
/**
* @see SplObserver::update()
*/
public function update(\SplSubject $stateMachine)
{
if ($stateMachine instanceof StatemachineInterface) {
if ($stateMachine->getCurrentState()->hasEvent($this->eventName)) {
$stateMachine->triggerEvent($this->eventName);
}
}
}