Ejemplo n.º 1
0
 public function testContains()
 {
     $item1 = 'item 1';
     $item2 = 'item 2';
     $item3 = 'item 3';
     $items = [$item1, $item2];
     $set = new Set($items);
     $this->assertTrue($set->contains($item2));
     $this->assertFalse($set->contains($item3));
 }
Ejemplo n.º 2
0
 /**
  * Checks whether an interface exists
  *
  * @param PhpInterface|string $interface interface name or instance
  * @return bool
  */
 public function hasInterface($interface)
 {
     if ($interface instanceof PhpInterface) {
         return $this->interfaces->contains($interface->getName()) || $this->interfaces->contains($interface->getQualifiedName());
     }
     return $this->hasInterface(new PhpInterface($interface));
 }
Ejemplo n.º 3
0
 public function calculateGeneration(Skill $skill)
 {
     if ($this->processedGenerationSkills->contains($skill)) {
         return;
     }
     $this->lineage = [];
     $generation = 1;
     $ancestors = $this->getAncestors($skill);
     if (count($ancestors)) {
         $root = $this->findRoot($ancestors);
         if ($root !== null) {
             $generation = $this->nextStep($root, $skill, $ancestors);
         }
     }
     $skill->setGeneration($generation);
     $skill->clearLineagesRelatedBySkillId();
     // set generations
     foreach ($this->lineage as $pos => $ancestor) {
         $lin = new Lineage();
         $lin->setSkill($skill);
         $lin->setAncestor($ancestor);
         $lin->setPosition($pos);
     }
     $this->modifiedSkills->add($skill);
     $this->processedGenerationSkills->add($skill);
     $this->processGenerationQueue();
 }
Ejemplo n.º 4
0
 public function hasAcl($group)
 {
     return $this->acl->contains($group);
 }
Ejemplo n.º 5
0
 public function isModifier(Token $token)
 {
     return $this->modifier->contains($token->type);
 }