public function addClass(ClassReflection $class)
 {
     $name = $class->getName();
     $hash = $class->getHash();
     if (isset($this->classes[$name])) {
         unset($this->hashes[$this->classes[$name]][$name]);
         if (!$this->hashes[$this->classes[$name]]) {
             unset($this->hashes[$this->classes[$name]]);
         }
     }
     $this->hashes[$hash][$name] = true;
     $this->classes[$name] = $hash;
     $this->modified[] = $name;
     $this->visited[$hash] = true;
 }
Beispiel #2
0
 public function writeClass(Project $project, ClassReflection $class)
 {
     $this->classes[$class->getName()] = $class;
 }
 public function writeClass(Project $project, ClassReflection $class)
 {
     file_put_contents($this->getFilename($project, $class->getName()), json_encode($class->toArray(), self::JSON_PRETTY_PRINT));
 }
 private function isAnyPropertyAnApi(ClassReflection $class)
 {
     $rc = new \ReflectionClass($class->getName());
     $props = $rc->getProperties();
     foreach ($props as $prop) {
         $docComment = $prop->getDocComment();
         if (false !== strpos($docComment, '@api')) {
             return true;
         }
     }
     return false;
 }
Beispiel #5
0
 protected function updateCache(ClassReflection $class)
 {
     $name = $class->getName();
     $this->namespaces[$class->getNamespace()] = $class->getNamespace();
     // add sub-namespaces
     $namespace = $class->getNamespace();
     while ($namespace = substr($namespace, 0, strrpos($namespace, '\\'))) {
         $this->namespaces[$namespace] = $namespace;
     }
     if ($class->isException()) {
         $this->namespaceExceptions[$class->getNamespace()][$name] = $class;
     } elseif ($class->isInterface()) {
         $this->namespaceInterfaces[$class->getNamespace()][$name] = $class;
         $this->interfaces[$name] = $class;
     } else {
         $this->namespaceClasses[$class->getNamespace()][$name] = $class;
     }
     if ($this->getConfig('simulate_namespaces')) {
         if (false !== ($pos = strrpos($name, '_'))) {
             $this->simulatedNamespaces[$namespace = str_replace('_', '\\', substr($name, 0, $pos))][$name] = $class;
             // add sub-namespaces
             while ($namespace = substr($namespace, 0, strrpos($namespace, '\\'))) {
                 if (!isset($this->simulatedNamespaces[$namespace])) {
                     $this->simulatedNamespaces[$namespace] = array();
                 }
             }
         } else {
             $this->simulatedNamespaces[''][$name] = $class;
         }
     }
 }
 public function removeClass(ClassReflection $class)
 {
     unset($this->classes[$class->getName()]);
     unset($this->interfaces[$class->getName()]);
     unset($this->namespaceClasses[$class->getNamespace()][$class->getName()]);
     unset($this->namespaceInterfaces[$class->getNamespace()][$class->getName()]);
     unset($this->namespaceExceptions[$class->getNamespace()][$class->getName()]);
 }