コード例 #1
0
ファイル: Completer.php プロジェクト: tsufeki/phpcmplr
 /**
  * @param Type $objectType
  *
  * @return ClassConst[]
  */
 protected function findClassConsts(Type $objectType)
 {
     $consts = [];
     if ($objectType instanceof AlternativesType) {
         foreach ($objectType->getAlternatives() as $altType) {
             $consts = array_merge($consts, $this->findClassConsts($altType));
         }
     } elseif ($objectType instanceof ObjectType) {
         foreach ($this->reflection->findAllClassConsts($objectType->getClass()) as $const) {
             $consts[] = $const;
         }
     }
     return $consts;
 }
コード例 #2
0
 /**
  * @param Type   $objectType
  * @param string $propertyName
  * @param bool   $staticContext
  *
  * @return Property[]
  */
 protected function findProperties(Type $objectType, $propertyName, $staticContext = false)
 {
     $properties = [];
     if ($objectType instanceof AlternativesType) {
         foreach ($objectType->getAlternatives() as $altType) {
             $properties = array_merge($properties, $this->findProperties($altType, $propertyName, $staticContext));
         }
     } elseif ($objectType instanceof ObjectType) {
         $property = $this->reflection->findProperty($objectType->getClass(), $propertyName);
         if ($property !== null && $staticContext === $property->isStatic()) {
             $properties[] = $property;
         }
     }
     return $properties;
 }