From 3f64e064d3a86d4e5b13304777ca4454c098769b Mon Sep 17 00:00:00 2001 From: Gregwar Date: Wed, 7 Aug 2013 11:18:16 +0200 Subject: [PATCH] Mergin & fixing text_color & background_color (fixes #57) --- DependencyInjection/Configuration.php | 4 ++-- Generator/CaptchaGenerator.php | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index cf87657..9f9fbd5 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -42,8 +42,8 @@ class Configuration implements ConfigurationInterface ->scalarNode('max_front_lines')->defaultValue(null)->end() ->scalarNode('max_behind_lines')->defaultValue(null)->end() ->scalarNode('interpolation')->defaultValue(true)->end() - ->arrayNode('background_color')->prototype('scalar')->end() - ->arrayNode('text_color')->prototype('scalar')->end() + ->arrayNode('text_color')->prototype('scalar')->end()->end() + ->arrayNode('background_color')->prototype('scalar')->end()->end() ->end() ; diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index d4440fa..60db59b 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -98,8 +98,7 @@ class CaptchaGenerator $this->builder->setMaxFrontLines($options['max_front_lines']); $this->builder->setMaxBehindLines($options['max_behind_lines']); - - if (isset($options['text_color'])) { + if (isset($options['text_color']) && $options['text_color']) { if (count($options['text_color']) !== 3) { throw new \RuntimeException('text_color should be an array of r, g and b'); } @@ -108,7 +107,7 @@ class CaptchaGenerator $this->builder->setTextColor($color[0], $color[1], $color[2]); } - if (isset($options['background_color'])) { + if (isset($options['background_color']) && $options['background_color']) { if (count($options['background_color']) !== 3) { throw new \RuntimeException('background_color should be an array of r, g and b'); }