src/Plugin/FileSystemPluginLocator.php
protected function searchPluginFactoryClass($pluginDirectory) {
        foreach ($this->internalPluginStructure as $pluginStructure) {
            $path = $pluginDirectory.'/'.$pluginStructure.'/';
            if ( ($directoryHandle = opendir($path)) == true ) {
                while (($fileOrDir = readdir( $directoryHandle )) !== false) {
                    if (is_file($path. $fileOrDir) && $this->isPhpFile($path.$fileOrDir)) {
                        $classImplementation = $this->haveTheFileImplementationOf($path. $fileOrDir);
                        if ($classImplementation) {
                            return $classImplementation;
                        }
                    }
                }
            } else {
                throw new PluginException('Invalid plugin structure path, check the main config.ini file');
            }
        }

        return null;

    }
protected function searchPluginFactoryClass($pluginDirectory) {
        foreach ($this->internalPluginStructure as $pluginStructure) {
            $path = $pluginDirectory.'/'.$pluginStructure.'/';
            if ( ($directoryHandle = opendir($path)) == true ) {
                while (($fileOrDir = readdir( $directoryHandle )) !== false) {
                    if (is_file($path. $fileOrDir) && $this->isPhpFile($path.$fileOrDir)) {
                        $classImplementation = $this->haveTheFileImplementationOf($path. $fileOrDir);
                        if ($classImplementation) {
                            return $classImplementation;
                        }
                    }
                }
            } else {
                throw new PluginException('Invalid plugin structure path, check the main config.ini file');
            }
        }

        return null;

    }
Given the plugin directory it search, based on plugin structure, if
exists a pluginFactoryClass to call to get ready the plugin.

@param string $pluginDirectory

@return PluginInterface|null
@throws \PluginException