Get defined properties for the given class or object Reflector.

@param bool       $showAll   Include private and protected properties
@param \Reflector $reflector
@param bool       $noInherit Exclude inherited properties

@return array
191551
protected function getProperties($showAll, \Reflector $reflector, $noInherit = false)
    {
        $className = $reflector->getName();

        $properties = [];
        foreach ($reflector->getProperties() as $property) {
            if ($noInherit && $property->getDeclaringClass()->getName() !== $className) {
                continue;
            }

            if ($showAll || $property->isPublic()) {
                $properties[$property->getName()] = $property;
            }
        }

        \ksort($properties, SORT_NATURAL | SORT_FLAG_CASE);

        return $properties;
    }
20904
private function resolveMethodDependencies(\ReflectionFunctionAbstract $reflector)
    {
        $parameters = [];
        foreach ($reflector->getParameters() as $key => $parameter) {
            $class = $parameter->getClass();
            if ($class) {
                //Request
                $instance = app()->make($class->name);

                if ($instance instanceof FormRequest) {
                    if ($instance->authorize()) {
                        $instance->validate();
                    } else {
                        $instance->forbiddenResponse();
                    }
                }

                array_splice(
                    $parameters, $key, 0, [$instance]
                );
            }
        }

        return $parameters;
    }
656120
public function attributes( ?array $only = null, ?array $except = null, ?bool $schemaOnly = false )
	{
		$names = array_keys( static::getTableSchema()->columns );
		
		if( !$schemaOnly ) {
			
			$class = new \ReflectionClass( $this );
			
			foreach( $class->getProperties( \ReflectionProperty::IS_PUBLIC ) as $property ) {
				if( !$property->isStatic() ) {
					$names[] = $property->getName();
				}
			}
			
		}
		
		$names = array_unique( $names );
		
		if( $only ) {
			$names = array_intersect( $only, $names );
		}
		
		if( $except ) {
			$names = array_diff( $names, $except );
		}
		
		return $names;
	}
914688
public function getSorts(\ReflectionClass $reflectionClass)
    {
        if ($this->isProduction()) {
            $this->grid->getSort()->getFields();
        }

        $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED);
        /** @var \ReflectionProperty $property */
        foreach ($properties as $property) {
            $propertyAnnotations = $this->extractorFactory->extract($property, Extractor::PROPERTY_ANNOTATION);
            foreach ($propertyAnnotations as $annotation) {
                if ($annotation instanceof Sort) {
                    $fields[] = $property->getName();
                }
            }
        }

        return !empty($fields) ? $fields : $this->grid->getSort()->getFields();
    }
363421
public static function reflectorFactory(Reflector $reflector) {
    $args = func_get_args();
    $g = new static($args[1]);
    $g->elevate($args[0]);
    return $g;
  }
821379
protected function fromReflector(\Reflector $reflector, $single = '', \Reflector $context = null){

    // @todo: test this
    $hash = var_export(func_get_args(), true);

    if($this->fmt->didCache($hash))
      return;

    $items = array($reflector);

    if(($single === '') && ($reflector instanceof \ReflectionClass))
      $items = static::getParentClasses($reflector);

    $first = true;
    foreach($items as $item){

      if(!$first)
        $this->fmt->sep(' :: ');

      $first    = false;
      $name     = ($single !== '') ? $single : $item->getName();
      $comments = $item->isInternal() ? array() : static::parseComment($item->getDocComment());
      $meta     = array('sub' => array());
      $bubbles  = array();

      if($item->isInternal()){
        $extension = $item->getExtension();
        $meta['title'] = ($extension instanceof \ReflectionExtension) ? sprintf('Internal - part of %s (%s)', $extension->getName(), $extension->getVersion()) : 'Internal';

      }else{
        $comments = static::parseComment($item->getDocComment());

        if($comments)
          $meta += $comments;

        $meta['sub'][] = array('Defined in', basename($item->getFileName()) . ':' . $item->getStartLine());
      }

      if(($item instanceof \ReflectionFunction) || ($item instanceof \ReflectionMethod)){
        if(($context !== null) && ($context->getShortName() !== $item->getDeclaringClass()->getShortName()))
          $meta['sub'][] = array('Inherited from', $item->getDeclaringClass()->getShortName());

        if($item instanceof \ReflectionMethod){
          try{
            $proto = $item->getPrototype();
            $meta['sub'][] = array('Prototype defined by', $proto->class);
          }catch(\Exception $e){}
        }

        $this->fmt->text('name', $name, $meta, $this->linkify($item));
        continue;
      }

      // @todo: maybe - list interface methods
      if(!($item->isInterface() || ($this->env['is54'] && $item->isTrait()))){

        if($item->isAbstract())
          $bubbles[] = array('A', 'Abstract');

        if($item->isFinal())
          $bubbles[] = array('F', 'Final');

        // php 5.4+ only
        if($this->env['is54'] && $item->isCloneable())
          $bubbles[] = array('C', 'Cloneable');

        if($item->isIterateable())
          $bubbles[] = array('X', 'Iterateable');

      }

      if($item->isInterface() && $single !== '')
        $bubbles[] = array('I', 'Interface');

      if($bubbles)
        $this->fmt->bubbles($bubbles);

      if($item->isInterface() && $single === '')
        $name .= sprintf(' (%d)', count($item->getMethods()));

      $this->fmt->text('name', $name, $meta, $this->linkify($item));
    }

    $this->fmt->cacheLock($hash);
  }
392718
protected static function getVisibility(\Reflector $reflector): string
    {
        if (
            !$reflector instanceof \ReflectionMethod &&
            !$reflector instanceof \ReflectionProperty
        ) {
            throw new InvalidArgumentException(
                sprintf(
                    'Reflector must be an instance of "%s" or "%s", "%s" given',
                    \ReflectionMethod::class,
                    \ReflectionProperty::class,
                    \get_class($reflector)
                )
            );
        }

        foreach (['Public', 'Protected', 'Private'] as $visibility) {
            if ($reflector->{'is' . $visibility}()) {
                return strtolower($visibility);
            }
        }

        throw new \RuntimeException('Witness me!');
    }
261662
public function properties(): SetInterface
    {
        $refl = new \ReflectionClass($this->class);
        $properties = Set::of('string');

        foreach ($refl->getProperties() as $property) {
            $properties = $properties->add($property->getName());
        }

        return $properties;
    }
1176474
public function __findSerialisablePropertyAccessors() {

        // Grab the class name first.
        $className = get_class($this);

        // If no accessor map has been previously cached for this class type, cache it now.
        if (!isset (self::$__accessorMaps [$className])) {


            $reflectionClass = new \ReflectionClass ($className);

            // Create the accessors array for storing all possible accessors.
            $accessors = array();

            // Loop through all methods, checking for public get and set accessors first.
            $methods = $reflectionClass->getMethods();
            foreach ($methods as $method) {

                if ($method->isStatic())
                    continue;

                if ((substr($method->getName(), 0, 3) == "get") && ($method->getNumberOfRequiredParameters() == 0)) {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["get"] = $method;
                } else if (substr($method->getName(), 0, 3) == "set") {
                    $propertyName = strtolower(substr($method->getName(), 3));
                    if (!isset ($accessors [$propertyName])) {
                        $accessors [$propertyName] = array();
                    }
                    $accessors [$propertyName] ["set"] = $method;
                }
            }

            // Now loop through all properties, checking for any public / protected ones
            $properties = $reflectionClass->getProperties();
            foreach ($properties as $property) {

                if ($property->isStatic())
                    continue;

                $propertyName = strtolower($property->getName());

                if (!isset ($accessors [$propertyName])) {
                    $accessors [$propertyName] = array();
                }
                if (!isset ($accessors [$propertyName] ["get"]))
                    $accessors [$propertyName] ["get"] = $property;
                if (!isset ($accessors [$propertyName] ["set"]))
                    $accessors [$propertyName] ["set"] = $property;

            }

            self::$__accessorMaps [$className] = $accessors;

        }

        return self::$__accessorMaps [$className];
    }
349566
public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null)
    {
        $this->filter->bind($input);

        return $this->listItems($input, $reflector, $target);
    }
738980
private function convertReflectionPropertyAnnotationsToProperty(
        ReflectionProperty $reflectionProperty,
        array $propertyAnnotations,
        Mapping\ClassMetadata $classMetadata
    ) {
        // Field can only be annotated with one of:
        // @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany, @Embedded
        switch (true) {
            case isset($propertyAnnotations[Annotation\Column::class]):
                return $this->convertReflectionPropertyToFieldMetadata(
                    $reflectionProperty,
                    $propertyAnnotations,
                    $classMetadata
                );
            case isset($propertyAnnotations[Annotation\OneToOne::class]):
                return $this->convertReflectionPropertyToOneToOneAssociationMetadata(
                    $reflectionProperty,
                    $propertyAnnotations,
                    $classMetadata
                );
            case isset($propertyAnnotations[Annotation\ManyToOne::class]):
                return $this->convertReflectionPropertyToManyToOneAssociationMetadata(
                    $reflectionProperty,
                    $propertyAnnotations,
                    $classMetadata
                );
            case isset($propertyAnnotations[Annotation\OneToMany::class]):
                return $this->convertReflectionPropertyToOneToManyAssociationMetadata(
                    $reflectionProperty,
                    $propertyAnnotations,
                    $classMetadata
                );
            case isset($propertyAnnotations[Annotation\ManyToMany::class]):
                return $this->convertReflectionPropertyToManyToManyAssociationMetadata(
                    $reflectionProperty,
                    $propertyAnnotations,
                    $classMetadata
                );
            case isset($propertyAnnotations[Annotation\Embedded::class]):
                // @todo guilhermeblanco Implement later... =)
                break;

            default:
                return new Mapping\TransientMetadata($reflectionProperty->getName());
        }
    }
370841
final public function getAllValues() {
        $subClass = get_called_class();

        // Subclass has already been registered
        if(isset($this->_cachedEnums[$subClass])) {
            return FALSE;
        }

        $reflection = new \ReflectionClass($subClass);

        return $reflection->getConstants();
    }
743473
private function getConstructorArgs()
    {
        $reflector = $this->getReflector();
        $constructor = $reflector->getConstructor();
        if ($constructor !== null) {
            return $constructor->getParameters();
        }
        return array();
    }
743622
private static function getPropertyValueByParentClasses($source, string $property): array
    {
        $properties = self::getProperties($source, null, true);

        if (empty($properties)) {
            return [
                null,
                false,
            ];
        }

        foreach ($properties as $reflectionProperty) {
            if ($reflectionProperty->getName() === $property) {
                $byReflectionProperty = self::getPropertyValueByReflectionProperty(
                    $source,
                    $property,
                    $reflectionProperty
                );

                return [
                    $byReflectionProperty[0],
                    true,
                ];
            }
        }

        return [
            null,
            false,
        ];
    }
1154135
public function getPrivateVisibleFacets()
    {
        $visibleFacets = $this->getVisibleFacets();
        $visibleByOwner = $this->om->getRepository('ClarolineCoreBundle:Facet\Facet')
            ->findBy(array('isVisibleByOwner' => true));
        $private = [];

        foreach ($visibleByOwner as $visible) {
            $private[$visible->getPosition()] = array(
                'position' => $visible->getPosition(),
                'id' => $visible->getId(),
                'name' => $visible->getName(),
                'canOpen' => true,
                'panels' => $visible->getPanelFacets()
            );
        }

        $data = [];

        //merge both array and set canOpen to true when needed
        foreach ($private as $el) {
            $found = false;

            foreach ($visibleFacets as $facet) {
                if ($el['id'] === $facet['id']) {
                    $canOpen = $facet['canOpen'] | $el['canOpen'];
                    $data[] = array(
                        'position' => $facet['position'],
                        'id' => $facet['id'],
                        'name' => $facet['name'],
                        'canOpen' => $canOpen,
                        'panels' => $facet['panels']
                    );
                    $found = true;
                }
            }

            if (!$found) {
                $data[$el['position']] = $el;
            }
        }

        $array = $data + $visibleFacets;
        ksort($array);

        return $array;
    }
170741
protected function mapReflectorToDescriptor(Method $reflector, MethodDescriptor $descriptor): void
    {
        $descriptor->setFullyQualifiedStructuralElementName($reflector->getFqsen());
        $descriptor->setName($reflector->getName());
        $descriptor->setVisibility((string) $reflector->getVisibility() ?: 'public');
        $descriptor->setFinal($reflector->isFinal());
        $descriptor->setAbstract($reflector->isAbstract());
        $descriptor->setStatic($reflector->isStatic());
        $descriptor->setLine($reflector->getLocation()->getLineNumber());
        $descriptor->setReturnType($reflector->getReturnType());
    }
606807
public static function getAllProperties($class, $blacklist = [])
    {
        $classReflection = new \ReflectionClass($class);

        $properties = $classReflection->getProperties();

        if ($parentClass = $classReflection->getParentClass()) {
            $parentProps = self::getAllProperties($parentClass->getName(), $blacklist);
            if (!empty($parentProps)) {
                $properties = array_merge($parentProps, $properties);
            }
        }
        if (empty($blacklist)) {
            return $properties;
        }

        return array_filter(
            $properties,
            function (\ReflectionProperty $property) use ($blacklist) {
                return !$property->isStatic() && !in_array($property->name, $blacklist);
            }
        );
    }