@param  ClassLikeStorage $storage
@param  array            $dependent_classlikes

@return void
429961
private function populateClassLikeStorage(ClassLikeStorage $storage, array $dependent_classlikes = [])
    {
        if ($storage->populated) {
            return;
        }

        $fq_classlike_name_lc = strtolower($storage->name);

        if (isset($dependent_classlikes[$fq_classlike_name_lc])) {
            if ($storage->location && IssueBuffer::accepts(
                new CircularReference(
                    'Circular reference discovered when loading ' . $storage->name,
                    $storage->location
                )
            )) {
                // fall through
            }

            return;
        }

        $storage_provider = $this->classlike_storage_provider;

        $this->populateDataFromTraits($storage, $storage_provider, $dependent_classlikes);

        $dependent_classlikes[$fq_classlike_name_lc] = true;

        if ($storage->parent_classes) {
            $this->populateDataFromParentClass($storage, $storage_provider, $dependent_classlikes);
        }

        if (!strpos($fq_classlike_name_lc, '\\')
            && !isset($storage->methods['__construct'])
            && isset($storage->methods[$fq_classlike_name_lc])
            && !$storage->is_interface
            && !$storage->is_trait
        ) {
            $storage->methods['__construct'] = $storage->methods[$fq_classlike_name_lc];
        }

        $this->populateInterfaceDataFromParentInterfaces($storage, $storage_provider, $dependent_classlikes);

        $this->populateDataFromImplementedInterfaces($storage, $storage_provider, $dependent_classlikes);

        if ($storage->location) {
            $file_path = $storage->location->file_path;

            foreach ($storage->parent_interfaces as $parent_interface_lc) {
                $this->file_reference_provider->addFileInheritanceToClass($file_path, $parent_interface_lc);
            }

            foreach ($storage->parent_classes as $parent_class_lc => $_) {
                $this->file_reference_provider->addFileInheritanceToClass($file_path, $parent_class_lc);
            }

            foreach ($storage->class_implements as $implemented_interface) {
                $this->file_reference_provider->addFileInheritanceToClass(
                    $file_path,
                    strtolower($implemented_interface)
                );
            }

            foreach ($storage->used_traits as $used_trait_lc => $_) {
                $this->file_reference_provider->addFileInheritanceToClass($file_path, $used_trait_lc);
            }
        }

        if ($storage->internal
            && !$storage->is_interface
            && !$storage->is_trait
        ) {
            foreach ($storage->methods as $method) {
                $method->internal = true;
            }

            foreach ($storage->properties as $property) {
                $property->internal = true;
            }
        }

        $this->populateOverriddenMethods($storage);

        if ($this->debug_output) {
            echo 'Have populated ' . $storage->name . "\n";
        }

        $storage->populated = true;
    }
61642
private function inheritPropertiesFromParent(ClassLikeStorage $storage, ClassLikeStorage $parent_storage)
    {
        // register where they appear (can never be in a trait)
        foreach ($parent_storage->appearing_property_ids as $property_name => $appearing_property_id) {
            if (isset($storage->appearing_property_ids[$property_name])) {
                continue;
            }

            if (!$parent_storage->is_trait
                && isset($parent_storage->properties[$property_name])
                && $parent_storage->properties[$property_name]->visibility === ClassLikeAnalyzer::VISIBILITY_PRIVATE
            ) {
                continue;
            }

            $implemented_property_id = $storage->name . '::$' . $property_name;

            $storage->appearing_property_ids[$property_name] =
                $parent_storage->is_trait ? $implemented_property_id : $appearing_property_id;
        }

        // register where they're declared
        foreach ($parent_storage->declaring_property_ids as $property_name => $declaring_property_class) {
            if (isset($storage->declaring_property_ids[$property_name])) {
                continue;
            }

            if (!$parent_storage->is_trait
                && isset($parent_storage->properties[$property_name])
                && $parent_storage->properties[$property_name]->visibility === ClassLikeAnalyzer::VISIBILITY_PRIVATE
            ) {
                continue;
            }

            $storage->declaring_property_ids[$property_name] = $declaring_property_class;
        }

        // register where they're declared
        foreach ($parent_storage->inheritable_property_ids as $property_name => $inheritable_property_id) {
            if (!$parent_storage->is_trait
                && isset($parent_storage->properties[$property_name])
                && $parent_storage->properties[$property_name]->visibility === ClassLikeAnalyzer::VISIBILITY_PRIVATE
            ) {
                continue;
            }

            if (!$parent_storage->is_trait) {
                $storage->overridden_property_ids[$property_name][] = $inheritable_property_id;
            }

            $storage->inheritable_property_ids[$property_name] = $inheritable_property_id;
        }
    }
327686
public function run(Storage $storage)
    {
        parent::run($storage);

        $components = $this->getParametersWithoutNamespace();

        foreach ($components as $namespace => $component) {
            $this->loadComponent($namespace, $component);
        }
    }
765824
public void setDependentStateListener(BaseListener dependentStateListener)
    {
        if (!(dependentStateListener instanceof FieldListener))
            dependentStateListener = null;
        else if ((this.getOwner() == null)
            || (((FieldListener)dependentStateListener).getOwner() == null)
            || (this.getOwner().getRecord() != ((FieldListener)dependentStateListener).getOwner().getRecord()))
                dependentStateListener = null;
        super.setDependentStateListener(dependentStateListener);
    }
1246859
public function setDependencies(Container $container)
    {
        parent::setDependencies($container);

        $this->basePath = $container['config']['base_path'];
        $this->publicPath = $container['config']['public_path'];

        $this->setElfinderConfig($container['elfinder/config']);
        $this->setPropertyFactory($container['property/factory']);
        $this->setCallableResolver($container['callableResolver']);

        /** @see \Charcoal\App\ServiceProvide\FilesystemServiceProvider */
        $this->filesystemConfig = $container['filesystem/config'];
        $this->filesystems = $container['filesystems'];
    }
505508
private function loadFromCache($fq_classlike_name_lc, $file_path)
    {
        $cache_location = $this->getCacheLocationForClass($fq_classlike_name_lc, $file_path);

        if (file_exists($cache_location)) {
            if ($this->config->use_igbinary) {
                $storage = igbinary_unserialize((string)file_get_contents($cache_location));

                if ($storage instanceof ClassLikeStorage) {
                    return $storage;
                }

                return null;
            }

            $storage = unserialize((string)file_get_contents($cache_location));

            if ($storage instanceof ClassLikeStorage) {
                return $storage;
            }

            return null;
        }

        return null;
    }
91473
protected function mergeStorage(StorageInterface $storage)
    {
        foreach ($storage->all() as $id => $object) {
            $this->stack->getScope('global')->add($object);
        }
    }
598345
function Provider(storage) {
  Object.defineProperties(this, {

    /**
     * The provider storage.
     *
     * @property storage
     * @type Storage
     * @final
     */
    storage: {value: storage}

  });

  if (!(this.storage instanceof Storage))
    throw new TypeError('storage must be of type Storage');
}
3264
private function precheckStorage($storage)
    {
        if (is_string($storage)) {
            switch ($storage) {
                case self::OSS_STORAGE_ARCHIVE:
                    return;
                case self::OSS_STORAGE_IA:
                    return;
                case self::OSS_STORAGE_STANDARD:
                    return;
                default:
                    break;
            }
        }
        throw new OssException('storage name is invalid');
    }
528325
private function populateFileStorage(FileStorage $storage, array $dependent_file_paths = [])
    {
        if ($storage->populated) {
            return;
        }

        $file_path_lc = strtolower($storage->file_path);

        if (isset($dependent_file_paths[$file_path_lc])) {
            return;
        }

        $dependent_file_paths[$file_path_lc] = true;

        $all_required_file_paths = $storage->required_file_paths;

        foreach ($storage->required_file_paths as $included_file_path => $_) {
            try {
                $included_file_storage = $this->file_storage_provider->get($included_file_path);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            $this->populateFileStorage($included_file_storage, $dependent_file_paths);

            $all_required_file_paths = $all_required_file_paths + $included_file_storage->required_file_paths;
        }

        foreach ($all_required_file_paths as $included_file_path => $_) {
            try {
                $included_file_storage = $this->file_storage_provider->get($included_file_path);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            $storage->declaring_function_ids = array_merge(
                $included_file_storage->declaring_function_ids,
                $storage->declaring_function_ids
            );

            $storage->declaring_constants = array_merge(
                $included_file_storage->declaring_constants,
                $storage->declaring_constants
            );
        }

        foreach ($storage->referenced_classlikes as $fq_class_name) {
            try {
                $classlike_storage = $this->classlike_storage_provider->get($fq_class_name);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            if (!$classlike_storage->location) {
                continue;
            }

            try {
                $included_file_storage = $this->file_storage_provider->get($classlike_storage->location->file_path);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            $storage->declaring_function_ids = array_merge(
                $included_file_storage->declaring_function_ids,
                $storage->declaring_function_ids
            );
        }

        $storage->required_file_paths = $all_required_file_paths;

        foreach ($all_required_file_paths as $required_file_path) {
            try {
                $required_file_storage = $this->file_storage_provider->get($required_file_path);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            $required_file_storage->required_by_file_paths += [$file_path_lc => $storage->file_path];
        }

        foreach ($storage->required_classes as $required_classlike) {
            try {
                $classlike_storage = $this->classlike_storage_provider->get($required_classlike);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            if (!$classlike_storage->location) {
                continue;
            }

            try {
                $required_file_storage = $this->file_storage_provider->get($classlike_storage->location->file_path);
            } catch (\InvalidArgumentException $e) {
                continue;
            }

            $required_file_storage->required_by_file_paths += [$file_path_lc => $storage->file_path];
        }

        $storage->populated = true;
    }
802342
private function fileExistsForClassLike(ClassLikes $classlikes, $fq_class_name)
    {
        $fq_class_name_lc = strtolower($fq_class_name);

        if (isset($this->classlike_files[$fq_class_name_lc])) {
            return true;
        }

        if ($fq_class_name === 'self') {
            return false;
        }

        if (isset($this->existing_classlikes_lc[$fq_class_name_lc])) {
            throw new \InvalidArgumentException('Why are you asking about a builtin class?');
        }

        $composer_file_path = $this->config->getComposerFilePathForClassLike($fq_class_name);

        if ($composer_file_path && file_exists($composer_file_path)) {
            if ($this->debug_output) {
                echo 'Using composer to locate file for ' . $fq_class_name . "\n";
            }

            $classlikes->addFullyQualifiedClassLikeName(
                $fq_class_name_lc,
                realpath($composer_file_path)
            );

            return true;
        }

        $old_level = error_reporting();

        if (!$this->debug_output) {
            error_reporting(E_ERROR);
        }

        try {
            if ($this->debug_output) {
                echo 'Using reflection to locate file for ' . $fq_class_name . "\n";
            }

            /** @psalm-suppress TypeCoercion */
            $reflected_class = new \ReflectionClass($fq_class_name);
        } catch (\Throwable $e) {
            error_reporting($old_level);

            // do not cache any results here (as case-sensitive filenames can screw things up)

            return false;
        }

        error_reporting($old_level);

        /** @psalm-suppress MixedMethodCall due to Reflection class weirdness */
        $file_path = (string)$reflected_class->getFileName();

        // if the file was autoloaded but exists in evaled code only, return false
        if (!file_exists($file_path)) {
            return false;
        }

        $new_fq_class_name = $reflected_class->getName();

        if (strtolower($new_fq_class_name) !== strtolower($fq_class_name)) {
            $classlikes->addClassAlias($new_fq_class_name, strtolower($fq_class_name));
            $fq_class_name_lc = strtolower($new_fq_class_name);
        }

        $fq_class_name = $new_fq_class_name;
        $classlikes->addFullyQualifiedClassLikeName($fq_class_name_lc);

        if ($reflected_class->isInterface()) {
            $classlikes->addFullyQualifiedInterfaceName($fq_class_name, $file_path);
        } elseif ($reflected_class->isTrait()) {
            $classlikes->addFullyQualifiedTraitName($fq_class_name, $file_path);
        } else {
            $classlikes->addFullyQualifiedClassName($fq_class_name, $file_path);
        }

        return true;
    }
782567
public function setPGTStorage($storage)
    {
    	// Sequence validation
        $this->ensureIsProxy();

        // check that the storage has not already been set
        if ( is_object($this->_pgt_storage) ) {
            phpCAS::error('PGT storage already defined');
        }

        // check to make sure a valid storage object was specified
        if ( !($storage instanceof CAS_PGTStorage_AbstractStorage) )
            throw new CAS_TypeMismatchException($storage, '$storage', 'CAS_PGTStorage_AbstractStorage object');

        // store the PGTStorage object
        $this->_pgt_storage = $storage;
    }
1326717
public function add($name, $dependencyUnit, $arguments = array()) {
        if (is_object($dependencyUnit)) {
            $dependencyClass = get_class($dependencyUnit);
        } else {
            $dependencyClass = $dependencyUnit;
        }
        if (!is_array($arguments)) $arguments = array('arguments' => $arguments);

        $this->_dependencies[$name] = array_merge($arguments, array(
            'className' => $dependencyClass,
            'object'    => !empty($arguments['object']) ? $arguments['object'] : null
        ));
    }
1299960
public void setDependentStateListener(BaseListener dependentStateListener)
    {
        if (!(dependentStateListener instanceof FileListener))
            dependentStateListener = null;
        else if (this.getOwner() != ((FileListener)dependentStateListener).getOwner())
            dependentStateListener = null;
        super.setDependentStateListener(dependentStateListener);
    }
544581
function onFileReady( id, cb ) {
			var Class = classDependent[id];
			if (Class && 'classObj' in Class) {
				cb(id, Class);
			}else{
				classDependent[id] = classDependent[id] || [];
				classDependent[id].push(cb);
			}
		}
643654
private function resolveClassLike(ClassLikeWithDependencies $clwd): void
    {
        if (isset($this->resolvedClassLikes[$clwd->fullyQualifiedName])) {
            // Already resolved.
            return;
        }
        $this->resolvedClassLikes[$clwd->fullyQualifiedName] = true;

        foreach ($clwd->dependencies as $dependencyName) {
            if (isset($this->classLikes[$dependencyName])) {
                $this->resolveClassLike($this->classLikes[$dependencyName]);
            }
        }

        if (!$this->currentClassLikeNamespace) {
            $namespaceMatches = false;
        } elseif ($this->currentClassLikeNamespace->name) {
            $namespaceMatches = $this->currentClassLikeNamespace->name->toString() === $clwd->namespace;
        } else {
            $namespaceMatches = !$clwd->namespace;
        }

        // Reduntant check to make Psalm happy.
        if ($this->currentClassLikeNamespace && $namespaceMatches) {
            $this->currentClassLikeNamespace->stmts[] = $clwd->node;
        } else {
            $name = $clwd->namespace ? new Name($clwd->namespace) : null;
            $this->currentClassLikeNamespace = new Namespace_($name, [$clwd->node]);
            $this->classLikeNamespaces[] = $this->currentClassLikeNamespace;
        }
    }
1089276
private function getClassLikeAttributeProperties($classLike, $classLikeAttributeAttributes, $varName)
    {
        $r = '';

        foreach ($classLikeAttributeAttributes as $attribute) {
            $attributeProperties = (array)$attribute;
            $attributeProperties = $attributeProperties['@attributes'];

            if (isset( $attributeProperties['inherited'] )) {
                $this->checkMandatoryAttributes('Attributes ' . $classLike, $attributeProperties, ['id']);

                $r .= 'var a = new InheritedAttribute(\'' . $attributeProperties['id'] . '\');' . PHP_EOL;

                $r .= $varName . '.addInheritedAttribute(a);' . PHP_EOL;
            } else {
                $this->checkMandatoryAttributes('Attributes ' . $classLike, $attributeProperties, ['id', 'name']);

                $r .= 'var a = new Attribute(\'' . $attributeProperties['name'] . '\',\'' . $attributeProperties['id'] . '\');' . PHP_EOL;
                if (isset( $attributeProperties['type'] )) {
                    $r .= 'a.setType(\'' . $attributeProperties['type'] . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['subtype'] )) {
                    $r .= 'a.setSubtype(\'' . str_replace(
                        '\\',
                        '\\\\',
                        $attributeProperties['subtype']
                    ) . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['size'] )) {
                    $r .= 'a.setSize(\'' . $attributeProperties['size'] . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['null'] )) {
                    $r .= 'a.setNull(' . $attributeProperties['null'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['primary'] )) {
                    $r .= 'a.setPrimary(' . $attributeProperties['primary'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['foreign'] )) {
                    $r .= 'a.setForeign(' . $attributeProperties['foreign'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['autoincrement'] )) {
                    $r .= 'a.setAutoincrement(' . $attributeProperties['autoincrement'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['unique'] )) {
                    $r .= 'a.setUnique(' . $attributeProperties['unique'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['default'] )) {
                    $r .= 'a.setDefault(\'' . str_replace(
                        '\'',
                        '\\\'',
                        $attributeProperties['default']
                    ) . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['description'] )) {
                    $r .= 'a.setDescription(\'' . str_replace('\'', '\\\'', $attributeProperties['description']) . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['getter'] )) {
                    $r .= 'a.setGetter(' . $attributeProperties['getter'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['setter'] )) {
                    $r .= 'a.setSetter(' . $attributeProperties['setter'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['minSize'] )) {
                    $r .= 'a.setMinSize(\'' . $attributeProperties['minSize'] . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['email'] )) {
                    $r .= 'a.setEmail(' . $attributeProperties['email'] . ');' . PHP_EOL;
                }
                if (isset( $attributeProperties['min'] )) {
                    $r .= 'a.setMin(\'' . $attributeProperties['min'] . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['max'] )) {
                    $r .= 'a.setMax(\'' . $attributeProperties['max'] . '\');' . PHP_EOL;
                }
                if (isset( $attributeProperties['static'] )) {
                    $r .= 'a.setStatic(\'' . $attributeProperties['static'] . '\');' . PHP_EOL;
                }

                $r .= $varName . '.addAttribute(a);' . PHP_EOL;
            }
        }

        return $r;
    }