コード例 #1
0
 function createTmp($name, $ref = null)
 {
     $f = new Service($name, $this);
     $this->tmpserv[] = $f;
     $this->all[] = $f;
     $f->type = 'tmp';
     $f->addReference($ref);
     $this->fast[$f->name()] = $f;
     $this->fastMemToIndex[spl_object_hash($f)] = lastIndex($this->all);
     return $f;
 }
コード例 #2
0
 /**
  * @param Rule $rule
  * @param bool $inPost
  * @return bool
  */
 public function addRule($rule, $inPost = false)
 {
     if (!is_object($rule)) {
         derr('this function only accepts Rule class objects');
     }
     if ($rule->owner !== null) {
         derr('Trying to add a rule that has a owner already !');
     }
     $ser = spl_object_hash($rule);
     if ($inPost !== true) {
         if (!isset($this->fastMemToIndex[$ser])) {
             $rule->owner = $this;
             $this->rules[] = $rule;
             $index = lastIndex($this->rules);
             $this->fastMemToIndex[$ser] = $index;
             $this->fastNameToIndex[$rule->name()] = $index;
             $this->xmlroot->appendChild($rule->xmlroot);
             return true;
         } else {
             derr('You cannot add a Rule that is already here :)');
         }
     } else {
         if (!isset($this->fastMemToIndex_forPost[$ser])) {
             $rule->owner = $this;
             $this->postRules[] = $rule;
             $index = lastIndex($this->postRules);
             $this->fastMemToIndex_forPost[$ser] = $index;
             $this->fastNameToIndex_forPost[$rule->name()] = $index;
             $this->postRulesRoot->appendChild($rule->xmlroot);
             return true;
         } else {
             derr('You cannot add a Rule that is already here :)');
         }
     }
     return false;
 }