Пример #1
0
 /**
  * Visits a property node.
  *
  * @param PHP_Depend_Code_Property $property The property class node.
  *
  * @return void
  * @see PHP_Depend_VisitorI::visitProperty()
  */
 public function visitProperty(PHP_Depend_Code_Property $property)
 {
     $this->visits[] = $property->getName();
     parent::visitProperty($property);
 }
Пример #2
0
 /**
  * Returns all properties for this class.
  *
  * @return PHP_Depend_Code_NodeIterator
  */
 public function getProperties()
 {
     if ($this->properties === null) {
         $this->properties = array();
         $declarations = $this->findChildrenOfType(PHP_Depend_Code_ASTFieldDeclaration::CLAZZ);
         foreach ($declarations as $declaration) {
             $declarators = $declaration->findChildrenOfType(PHP_Depend_Code_ASTVariableDeclarator::CLAZZ);
             foreach ($declarators as $declarator) {
                 $property = new PHP_Depend_Code_Property($declaration, $declarator);
                 $property->setDeclaringClass($this);
                 $property->setSourceFile($this->getSourceFile());
                 $this->properties[] = $property;
             }
         }
     }
     return new PHP_Depend_Code_NodeIterator($this->properties);
 }
Пример #3
0
 /**
  * Tests that the <b>setValue()</b> method throws an unsupported method
  * exception.
  *
  * @return void
  * @covers PHP_Depend_Code_Property
  * @group pdepend
  * @group pdepend::code
  * @group unittest
  */
 public function testSetValueThrowsExceptionBecauseThisFeatureIsNotSupported()
 {
     $property = new PHP_Depend_Code_Property($this->getMock('PHP_Depend_Code_ASTFieldDeclaration'), $this->getMock('PHP_Depend_Code_ASTVariableDeclarator', array(), array(null)));
     $this->setExpectedException('ReflectionException', 'PHP_Depend_Code_Property::setValue() is not supported.');
     $property->setValue(new stdClass(), 42);
 }