PHP Class Piwik\Plugins\CoreConsole\Commands\GeneratePluginBase

Inheritance: extends Piwik\Plugin\ConsoleCommand
Show file Open project: piwik/piwik Class Usage Examples

Public Methods

Method Description
getPluginPath ( $pluginName )
isEnabled ( )

Protected Methods

Method Description
askPluginNameAndValidate ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, $pluginNames, $invalidArgumentException ) : array
checkAndUpdateRequiredPiwikVersion ( $pluginName, Symfony\Component\Console\Output\OutputInterface $output )
copyTemplateMethodToExisitingClass ( string $sourceClassName, string $methodName, array $replace ) Copies the given method and all needed use statements into an existing class. The target class name will be built based on the given $replace argument.
copyTemplateToPlugin ( string $templateFolder, string $pluginName, array $replace = [], array $whitelistFiles = [] )
createFileWithinPluginIfNotExists ( $pluginNameOrCore, $fileName, $content )
getPluginNames ( )
getPluginNamesHavingNotSpecificFile ( $filename )
makeTranslationIfPossible ( $pluginName, $translatedText ) : string Creates a lang/en.json within the plugin in case it does not exist yet and adds a translation for the given text.

Private Methods

Method Description
buildTranslationKey ( $translatedText )
createFolderWithinPluginIfNotExists ( $pluginNameOrCore, $folder )
getPathToCore ( )
getRelativePluginPath ( $pluginName )
removeNonJsonCompatibleCharacters ( $text )
replaceContent ( $replace, $contentToReplace )
toJson ( $value )

Method Details

askPluginNameAndValidate() protected method

protected askPluginNameAndValidate ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output, $pluginNames, $invalidArgumentException ) : array
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
return array

checkAndUpdateRequiredPiwikVersion() protected method

protected checkAndUpdateRequiredPiwikVersion ( $pluginName, Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

copyTemplateMethodToExisitingClass() protected method

Copies the given method and all needed use statements into an existing class. The target class name will be built based on the given $replace argument.
protected copyTemplateMethodToExisitingClass ( string $sourceClassName, string $methodName, array $replace )
$sourceClassName string
$methodName string
$replace array

copyTemplateToPlugin() protected method

protected copyTemplateToPlugin ( string $templateFolder, string $pluginName, array $replace = [], array $whitelistFiles = [] )
$templateFolder string full path like /home/...
$pluginName string
$replace array array(key => value) $key will be replaced by $value in all templates
$whitelistFiles array If not empty, only given files/directories will be copied. For instance array('/Controller.php', '/templates', '/templates/index.twig')

createFileWithinPluginIfNotExists() protected method

protected createFileWithinPluginIfNotExists ( $pluginNameOrCore, $fileName, $content )

getPluginNames() protected method

protected getPluginNames ( )

getPluginNamesHavingNotSpecificFile() protected method

protected getPluginNamesHavingNotSpecificFile ( $filename )

getPluginPath() public method

public getPluginPath ( $pluginName )

isEnabled() public method

public isEnabled ( )

makeTranslationIfPossible() protected method

Creates a lang/en.json within the plugin in case it does not exist yet and adds a translation for the given text.
protected makeTranslationIfPossible ( $pluginName, $translatedText ) : string
$pluginName
$translatedText
return string Either the generated translation key or the original text if a different translation for this generated translation key already exists.