BetterReflection\Reflection\ReflectionClass::getProperties PHP Method

getProperties() public method

Get the properties for this class.
public getProperties ( ) : ReflectionProperty[]
return ReflectionProperty[]
    public function getProperties()
    {
        if (null !== $this->cachedProperties) {
            return $this->cachedProperties;
        }
        $properties = [];
        foreach ($this->node->stmts as $stmt) {
            if ($stmt instanceof PropertyNode) {
                $prop = ReflectionProperty::createFromNode($this->reflector, $stmt, $this);
                $properties[$prop->getName()] = $prop;
            }
        }
        $this->cachedProperties = $properties;
        return $properties;
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function getProperties($filter = null)
 {
     $properties = $this->betterReflectionClass->getProperties();
     $wrappedProperties = [];
     foreach ($properties as $key => $property) {
         $wrappedProperties[$key] = new ReflectionProperty($property);
     }
     return $wrappedProperties;
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionClass::getProperties