Esempio n. 1
0
 protected function boot()
 {
     $default = null;
     $reference = false;
     $optional = false;
     $typeHint = null;
     try {
         $class = $this->reflection->getClass();
         if ($class) {
             $typeHint = Doc::factory('\\' . $class->getName(), true)->toArray();
         } elseif ($this->reflection->isArray() === true) {
             $typeHint = 'array';
         }
     } catch (ReflectionException $e) {
     }
     if ($this->reflection->isDefaultValueAvailable()) {
         $default = Helper::varExport($this->reflection->getDefaultValue());
     }
     if ($this->reflection->isPassedByReference()) {
         $reference = true;
     }
     if ($this->reflection->isOptional()) {
         $optional = true;
     }
     $this->attributes = ['name' => $this->reflection->getName(), 'position' => $this->reflection->getPosition(), 'typeHint' => $typeHint, 'default' => $default, 'reference' => $reference, 'optional' => $optional];
     return $this;
 }
Esempio n. 2
0
 protected function getMethods()
 {
     $collect = [];
     $data = $this->reflection->getMethods();
     foreach ($data as $value) {
         $collect[] = Method::factory($value);
     }
     $collect = Helper::sortByModifiers($collect);
     return $collect;
 }
Esempio n. 3
0
 public function findClasses()
 {
     $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
     if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
         $extraTypes .= '|enum';
     }
     $classes = [];
     $iterator = Finder::create()->files()->exclude('Tests')->name('/\\.(php|inc|hh)$/')->in($this->autoloads);
     foreach ($iterator as $file) {
         $findClasses = Helper::findClasses($file);
         if (count($findClasses) > 0) {
             foreach ($findClasses as $class) {
                 $split = explode('\\', $class);
                 if (count($split) == 1) {
                     $namespace = $split[0];
                 } else {
                     $namespace = implode('\\', [$split[0], $split[1]]);
                 }
                 $classes[trim($namespace, '\\')][] = $class;
             }
         }
     }
     return $classes;
 }