Exemplo n.º 1
0
 /**
  * Retrieve all traits by matching className
  *
  * @param string $className
  * @return TraitReflection[]
  */
 public function findByClass($className)
 {
     $result = [];
     foreach ($this->_traits as $trait) {
         if ($trait->matchClassName($className)) {
             $result[] = $trait;
         }
     }
     $result = SortUtils::sortReflections($result);
     return $result;
 }
Exemplo n.º 2
0
 /**
  * Find the best matching base/parent class for a className
  *
  * @param string $className
  * @return string
  */
 public function find($className)
 {
     if (empty($className)) {
         return BaseMock::class;
     }
     /** @var ClassReflection[] $result */
     $result = [];
     foreach ($this->_classes as $class) {
         if ($class->matchClassName($className)) {
             $result[] = $class;
         }
     }
     $result = SortUtils::sortReflections($result);
     if (count($result)) {
         return $result[0]->getName();
     }
     return BaseMock::class;
 }