@param string $handle
@param array  $pluginInfo

@return array
191949
private function getPluginDefinition(string $handle, array $pluginInfo): array
    {
        $settings = null;
        $plugin = Craft::$app->plugins->getPlugin($handle);
        if ($plugin) {
            $settings = $plugin->getSettings();
        }

        return [
          'isEnabled' => $pluginInfo['isEnabled'],
          'isInstalled' => $pluginInfo['isInstalled'],
          'settings' => $settings ? $settings->attributes : [],
        ];
    }
918981
public function getPluginViewDefinitionsByPluginNodeType(NodeType $pluginNodeType)
    {
        $viewDefinitions = [];
        foreach ($this->getPluginViewConfigurationsByPluginNodeType($pluginNodeType) as $pluginViewName => $pluginViewConfiguration) {
            $viewDefinitions[] = new PluginViewDefinition($pluginNodeType, $pluginViewName, $pluginViewConfiguration);
        }
        return $viewDefinitions;
    }
178919
public function get_all_handlers() {
        $sitepolicyhandlers = [];
        foreach (\core_component::get_plugin_types() as $ptype => $unused) {
            $plugins = \core_component::get_plugin_list_with_class($ptype, 'privacy\local\sitepolicy\handler') +
                \core_component::get_plugin_list_with_class($ptype, 'privacy_local_sitepolicy_handler');
            // Allow plugins to have the class either with namespace or without (useful for unittest).
            foreach ($plugins as $pname => $class) {
                $sitepolicyhandlers[$pname] = $class;
            }
        }
        return $sitepolicyhandlers;
    }
1189937
public function getOption($handle)
    {
        return isset($this->options[$handle]) ? $this->options[$handle] : null;
    }
19214
protected function getPluginTypes($pattern, $plugin_path)
    {
        $types = [];
        $project_root = ProjectX::projectRoot();

        foreach ($this->getInstalledPluginNamespaces() as $name => $namespace) {
            $plugin_dir = "$project_root/vendor/$name";

            if (!file_exists($plugin_dir)) {
                continue;
            }
            $plugin_dir = "$plugin_dir/src";

            if (isset($plugin_path)) {
                $plugin_dir = "$plugin_dir/$plugin_path";
            }

            if (!file_exists($plugin_dir)) {
                continue;
            }

            $classes = (new PhpClassDiscovery)
                ->setSearchPattern($pattern)
                ->addSearchLocation($plugin_dir)
                ->discover();

            foreach ($classes as $classname) {
                if (!class_exists($classname)) {
                    continue;
                }

                $types[$classname::getTypeId()] = $classname;
            }
        }

        return $types;
    }
552088
protected function validatePluginEvents(PluginInterface $plugin)
    {
        $events = $plugin->getSubscribedEvents();
        if (!is_array($events)) {
            throw new \RuntimeException(
                'Plugin of class ' . get_class($plugin) .
                    ' has getSubscribedEvents() implementation' .
                    ' that does not return an array'
            );
        }
        foreach ($events as $event => $callback) {
            if (!is_string($event)
                || !is_callable([ $plugin, $callback ])
                && !is_callable($callback)) {
                throw new \RuntimeException(
                    'Plugin of class ' . get_class($plugin) .
                        ' returns non-string event name or invalid callback' .
                        ' for event "' . $event . '"'
                );
            }
        }
    }
907869
protected function readNext($handle, $chunkSize)
    {
        if (feof($handle)) {
            return null;
        }

        $line = $this->readLine($handle, $chunkSize);

        return $line === '' ? $this->readNext($handle, $chunkSize) : $line;
    }
789729
public function getPluginInfo($plugin)
    {
        $zipArchive = $this->openZipArchive($plugin);

        if ($path = $this->searchForPluginJson($zipArchive)) {
            $jsonString = $this->getFileFromZip($path, $zipArchive);
            return json_decode($jsonString, true);
        } elseif ($path = $this->searchForPluginXml($zipArchive)) {
            $xmlString = $this->getFileFromZip($path, $zipArchive);
            return $this->readXml($xmlString);
        } else {
            throw new \RuntimeException('Plugin info file not found in zip (plugin.json or plugin.xml)');
        }
    }
937810
public static function var_names_from_context($classname, $pluginname = '') {
        $pluginname = trim($pluginname);
        if (!empty($pluginname)) {
            $categoryvar = $classname . '_' . $pluginname . '_category';
            $purposevar = $classname . '_' . $pluginname . '_purpose';
        } else {
            $categoryvar = $classname . '_category';
            $purposevar = $classname . '_purpose';
        }
        return [
            $purposevar,
            $categoryvar
        ];
    }
15799
public function getPlaceHolderText($handle)
    {
        $pageValues = $this->getAvailablePageValues();
        if (in_array($handle, array_keys($pageValues))) {
            $placeHolder = $pageValues[$handle];
        } else {
            $attributeKey = CollectionAttributeKey::getByHandle($handle);
            if (is_object($attributeKey)) {
                $placeHolder = $attributeKey->getAttributeKeyName();
            }
        }

        return "[" . $placeHolder . "]";
    }
31108
public static function getNeoBlockType($handle, $fieldId)
    {
        $neo = Craft::$app->plugins->getPlugin('neo');
        $blockTypes = $neo->blockTypes->getByFieldId($fieldId);
        foreach ($blockTypes as $block) {
            if ($block->handle == $handle) {
                return $block;
            }
        }

        return false;
    }
1029910
public function listNewVersions($plugin)
    {
        $code = is_string($plugin) ? $plugin : $this->pluginManager->getIdentifier($plugin);

        if (!$this->hasVersionFile($code)) {
            return [];
        }

        $databaseVersion = $this->getDatabaseVersion($code);
        return $this->getNewFileVersions($code, $databaseVersion);
    }
1331272
private function _getProviderRecordByHandle($handle)
    {
        $providerRecord = Oauth_ProviderInfosRecord::model()->find(

            // conditions
            'class=:provider',

            // params
            array(
                ':provider' => $handle
            )
        );

        if($providerRecord)
        {
            return $providerRecord;
        }

        return null;
    }
1315224
public function affectedRows($handle, $type)
    {
        switch ($type) {
            case 1:
                return $handle->getInsertedCount();
                break;
            case 2:
                return $handle->getModifiedCount();
                break;
            case 3:
                return $handle->getDeletedCount();
                break;
            default:
                return false;
        }
    }
296408
protected function _processPlugins($root, array $plugins = [])
    {
        foreach ($plugins as $plugin) {
            $controllers = $this->getControllerList($plugin);
            $pluginAlias = $this->_pluginAlias($plugin);
            $path = [
                $this->rootNode,
                $pluginAlias
            ];
            $path = implode('/', Hash::filter($path));
            
            if(!in_array($path, $this->ignorePaths) && !in_array($path, $this->ignoreActions)) {
                
                $pathNode = $this->_checkNode($path, $pluginAlias, $root->id);
                $this->foundACOs[$root->id][] = $pluginAlias;
                
                if (isset($this->foundACOs[$pathNode->id])) {
                    $this->foundACOs[$pathNode->id] += $this->_updateControllers($pathNode, $controllers, $plugin);
                } else {
                    $this->foundACOs[$pathNode->id] = $this->_updateControllers($pathNode, $controllers, $plugin);
                }

                if (isset($this->pluginPrefixes[$plugin])) {
                    foreach (array_keys($this->pluginPrefixes[$plugin]) as $prefix) {
                        $path = [
                            $this->rootNode,
                            $pluginAlias
                        ];
                        $path = implode('/', Hash::filter($path));
                        $pluginNode = $this->_checkNode($path, $pluginAlias, $root->id);
                        $this->foundACOs[$root->id][] = $pluginAlias;

                        $path = [
                            $this->rootNode,
                            $pluginAlias,
                            $prefix,
                        ];
                        $path = implode('/', Hash::filter($path));
                        $pathNode = $this->_checkNode($path, $prefix, $pluginNode->id);
                        $this->foundACOs[$pluginNode->id][] = $prefix;

                        $controllers = $this->getControllerList($plugin, $prefix);
                        if (isset($this->foundACOs[$pathNode->id])) {
                            $this->foundACOs[$pathNode->id] += $this->_updateControllers($pathNode, $controllers, $pluginAlias, $prefix);
                        } else {
                            $this->foundACOs[$pathNode->id] = $this->_updateControllers($pathNode, $controllers, $pluginAlias, $prefix);
                        }
                    }
                }
            }
        }
    }
1211139
protected function processNestedArray($parentIdentifier, array $nestedArray, \Closure $handler = null)
    {
        $identifier = 'a' . Algorithms::generateRandomString(23);
        $data = [
            'multivalue' => true,
            'value' => $this->processArray($nestedArray, $parentIdentifier)
        ];
        if ($handler instanceof \Closure) {
            $handler($parentIdentifier, $identifier, $data);
        }
        return $identifier;
    }
662216
protected function _getCallbacks($className, $pluginPath = null, $prefixPath = null)
    {
        $callbacks = [];
        $namespace = $this->_getNamespace($className, $pluginPath, $prefixPath);
        $reflection = new \ReflectionClass($namespace);
        if ($reflection->isAbstract()) {
            return $callbacks;
        }
        try {
            $method = $reflection->getMethod('implementedEvents');
        } catch (ReflectionException $e) {
            return $callbacks;
        }
        if (version_compare(phpversion(), '5.4', '>=')) {
            $object = $reflection->newInstanceWithoutConstructor();
        } else {
            $object = unserialize(
                sprintf('O:%d:"%s":0:{}', strlen($className), $className)
            );
        }
        $implementedEvents = $method->invoke($object);
        foreach ($implementedEvents as $event => $callable) {
            if (is_string($callable)) {
                $callbacks[] = $callable;
            }
            if (is_array($callable) && isset($callable['callable'])) {
                $callbacks[] = $callable['callable'];
            }
        }

        return $callbacks;
    }