/** * Returns class properties. * * @param integer $filter Properties filter * @return array */ public function getProperties($filter = null) { if (null === $this->properties) { $broker = $this->broker; $this->properties = array_map(function (InternalReflectionProperty $property) use($broker) { return ReflectionProperty::create($property, $broker); }, parent::getProperties()); } if (null === $filter) { return $this->properties; } return array_filter($this->properties, function (ReflectionProperty $property) use($filter) { return (bool) ($property->getModifiers() & $filter); }); }
/** * Sets a property to be accessible or not. * * @param boolean $accessible If the property should be accessible. */ public function setAccessible($accessible) { $this->accessible = (bool) $accessible; parent::setAccessible($accessible); }
/** * Tests an exception thrown when trying to create the reflection from a PHP internal reflection. * * @expectedException \TokenReflection\Exception\RuntimeException */ public function testInternalPropertyReflectionCreate() { Php\ReflectionProperty::create(new \ReflectionClass('Exception'), $this->getBroker()); }