当前位置: 首页>>代码示例>>PHP>>正文


PHP SplSubject类代码示例

本文整理汇总了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());
 }
开发者ID:jiangyu7408,项目名称:Statemachine,代码行数:12,代码来源:Command.php

示例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);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:27,代码来源:ConstructPatternMenuObserver.php

示例3: update

 public function update(\SplSubject $obj)
 {
     if ($this->dev == true) {
         $content = $obj->getFormatedException();
         require 'view.php';
     }
 }
开发者ID:damdamd,项目名称:ddfram,代码行数:7,代码来源:ScreenPrinter.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);
     }
 }
开发者ID:Nordic-T,项目名称:vanilla-plugins,代码行数:31,代码来源:class.widget.main.php

示例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);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:33,代码来源:GroupsObserver.php

示例6: update

 public function update(\SplSubject $obj)
 {
     if ($this->dev == true) {
         $content = $obj->getFormatedError();
         require __DIR__ . '/../../../../app/templates/errors.php';
     }
 }
开发者ID:DamdamD,项目名称:Website,代码行数:7,代码来源:ScreenPrinter.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();
 }
开发者ID:damdamd,项目名称:ddfram,代码行数:7,代码来源:BDDWriter.php

示例8: update

 public function update(\SplSubject $subject)
 {
     $queue = Queue::declareQueue($this->queueName);
     $producer = new \MicroQueue\Producer($queue);
     $message = $subject->getData();
     $producer->publish($message);
 }
开发者ID:marcusesa,项目名称:microqueue,代码行数:7,代码来源:RequeueListener.php

示例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));
     }
 }
开发者ID:arielZusman,项目名称:www.chat.io,代码行数:7,代码来源:Observer.php

示例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);
 }
开发者ID:remicollet,项目名称:php-compat-info,代码行数:14,代码来源:Console.php

示例11: update

 public function update(\SplSubject $obj)
 {
     if ($this->dev == true) {
         $content = $obj->getFormatedError();
         require '/home/rousseauzx/www/app/templates/errors.php';
     }
 }
开发者ID:damdamd,项目名称:ddfram,代码行数:7,代码来源:ScreenPrinter.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;
     //        }
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:34,代码来源:FillJoinsObserver.php

示例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);
 }
开发者ID:modelframework,项目名称:modelframework,代码行数:7,代码来源:InitObserver.php

示例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;
 }
开发者ID:metabor,项目名称:statemachine,代码行数:12,代码来源:OnEnterObserver.php

示例15: update

 /**
  * @see SplObserver::update()
  */
 public function update(\SplSubject $stateMachine)
 {
     if ($stateMachine instanceof StatemachineInterface) {
         if ($stateMachine->getCurrentState()->hasEvent($this->eventName)) {
             $stateMachine->triggerEvent($this->eventName);
         }
     }
 }
开发者ID:jiangyu7408,项目名称:Statemachine,代码行数:11,代码来源:OnEnterObserver.php


注:本文中的SplSubject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。