コード例 #1
0
ファイル: DescriptorTest.php プロジェクト: codeblanche/depend
 public function testSetGetIsCloneable()
 {
     $this->descriptor->setIsCloneable(false);
     $this->assertFalse($this->descriptor->isCloneable());
     $this->descriptor->setIsCloneable(true);
     $this->assertTrue($this->descriptor->isCloneable());
 }
コード例 #2
0
ファイル: Descriptor.php プロジェクト: codeblanche/depend
 /**
  * @return boolean
  */
 public function isCloneable()
 {
     if (!$this->isCloneable) {
         return false;
     }
     if ($this->parent && !$this->parent->isCloneable()) {
         return false;
     }
     if (is_array($this->interfaces)) {
         /** @var $interface Descriptor */
         foreach ($this->interfaces as $interface) {
             if ($interface->getName() === $this->getName()) {
                 continue;
             }
             if (!$interface->isCloneable()) {
                 return false;
             }
         }
     }
     return true;
 }