PHP Class Knp\Bundle\KnpBundlesBundle\Badge\BadgeGenerator

Datei anzeigen Open project: KnpLabs/KnpBundles

Protected Properties

Property Type Description
$cacheDir string Get app cache dir
$font string Get default font
$position array Determine score points position
$rootDir string Get app root dir
$type array Get badge type

Public Methods

Method Description
__construct ( Imagine\Image\ImagineInterface $imagine, null | Symfony\Component\Filesystem\Filesystem $filesystem = null ) Constructor
generate ( Bundle $bundle ) Generate Badge images
setCacheDir ( string $cacheDir )
setRootDir ( string $rootDir )
show ( Bundle $bundle, string $type = 'long', boolean $regenerate = false ) : string

Protected Methods

Method Description
createBadgesDir ( ) Check and create a dir for uploaded badges
getBadgeFile ( Bundle $bundle, string $type = self::LONG ) : string Get badge image full path
getPositionByType ( integer | string $score, string $type ) : Imagine\Image\Point Get score points position x:y
getResourceDir ( ) : string
setFont ( Imagine\Image\ImagineInterface $imagine, string $font, integer $size, string $color = 'ffffff' ) : string Return full font path
shorten ( string $name, integer $length ) : string Trim long bundle name

Method Details

__construct() public method

Constructor
public __construct ( Imagine\Image\ImagineInterface $imagine, null | Symfony\Component\Filesystem\Filesystem $filesystem = null )
$imagine Imagine\Image\ImagineInterface
$filesystem null | Symfony\Component\Filesystem\Filesystem

createBadgesDir() protected method

Check and create a dir for uploaded badges
protected createBadgesDir ( )

generate() public method

Generate Badge images
public generate ( Bundle $bundle )
$bundle Knp\Bundle\KnpBundlesBundle\Entity\Bundle

getBadgeFile() protected method

Get badge image full path
protected getBadgeFile ( Bundle $bundle, string $type = self::LONG ) : string
$bundle Knp\Bundle\KnpBundlesBundle\Entity\Bundle
$type string
return string

getPositionByType() protected method

Get score points position x:y
protected getPositionByType ( integer | string $score, string $type ) : Imagine\Image\Point
$score integer | string
$type string
return Imagine\Image\Point

getResourceDir() protected method

protected getResourceDir ( ) : string
return string

setCacheDir() public method

public setCacheDir ( string $cacheDir )
$cacheDir string

setFont() protected method

Return full font path
protected setFont ( Imagine\Image\ImagineInterface $imagine, string $font, integer $size, string $color = 'ffffff' ) : string
$imagine Imagine\Image\ImagineInterface
$font string
$size integer
$color string
return string

setRootDir() public method

public setRootDir ( string $rootDir )
$rootDir string

shorten() protected method

Trim long bundle name
protected shorten ( string $name, integer $length ) : string
$name string
$length integer symbol count from the end
return string

show() public method

public show ( Bundle $bundle, string $type = 'long', boolean $regenerate = false ) : string
$bundle Knp\Bundle\KnpBundlesBundle\Entity\Bundle
$type string
$regenerate boolean
return string

Property Details

$cacheDir protected_oe property

Get app cache dir
protected string $cacheDir
return string

$font protected_oe property

Get default font
protected string $font
return string

$position protected_oe property

Determine score points position
protected array $position
return array

$rootDir protected_oe property

Get app root dir
protected string $rootDir
return string

$type protected_oe property

Get badge type
protected array $type
return array