Merge remote-tracking branch 'color/master'
This commit is contained in:
commit
9578caab10
|
@ -43,6 +43,7 @@ class Configuration implements ConfigurationInterface
|
||||||
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
||||||
->scalarNode('interpolation')->defaultValue(true)->end()
|
->scalarNode('interpolation')->defaultValue(true)->end()
|
||||||
->arrayNode('background_color')->prototype('scalar')->end()
|
->arrayNode('background_color')->prototype('scalar')->end()
|
||||||
|
->arrayNode('text_color')->prototype('scalar')->end()
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,18 @@ class CaptchaGenerator
|
||||||
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
||||||
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
||||||
|
|
||||||
if ($options['background_color'] != array()) {
|
|
||||||
if (count($options['background_color'])!=3) {
|
if (isset($options['text_color'])) {
|
||||||
|
if (count($options['text_color']) !== 3) {
|
||||||
|
throw new \RuntimeException('text_color should be an array of r, g and b');
|
||||||
|
}
|
||||||
|
|
||||||
|
$color = $options['text_color'];
|
||||||
|
$this->builder->setTextColor($color[0], $color[1], $color[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($options['background_color'])) {
|
||||||
|
if (count($options['background_color']) !== 3) {
|
||||||
throw new \RuntimeException('background_color should be an array of r, g and b');
|
throw new \RuntimeException('background_color should be an array of r, g and b');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue