Skip to content

Commit

Permalink
[yaml] refactored true and false value array so that the code is more…
Browse files Browse the repository at this point in the history
… obvious and a tiny bit faster (closes #7333)

git-svn-id: http://svn.symfony-project.com/components/yaml/trunk@22986 ee427ae8-e902-0410-961c-c3ed070cd9f9
  • Loading branch information
FabianLange authored and FabianLange committed Oct 13, 2009
1 parent db737f5 commit ab3f69b
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/sfYamlInline.php
Expand Up @@ -56,8 +56,16 @@ static public function load($value)
*/
static public function dump($value)
{
$trueValues = '1.1' == sfYaml::getSpecVersion() ? array('true', 'on', '+', 'yes', 'y') : array('true');
$falseValues = '1.1' == sfYaml::getSpecVersion() ? array('false', 'off', '-', 'no', 'n') : array('false');
if ('1.1' === sfYaml::getSpecVersion())
{
$trueValues = array('true', 'on', '+', 'yes', 'y');
$falseValues = array('false', 'off', '-', 'no', 'n');
}
else
{
$trueValues = array('true');
$falseValues = array('false');
}

switch (true)
{
Expand Down Expand Up @@ -364,8 +372,16 @@ static protected function evaluateScalar($scalar)
{
$scalar = trim($scalar);

$trueValues = '1.1' == sfYaml::getSpecVersion() ? array('true', 'on', '+', 'yes', 'y') : array('true');
$falseValues = '1.1' == sfYaml::getSpecVersion() ? array('false', 'off', '-', 'no', 'n') : array('false');
if ('1.1' === sfYaml::getSpecVersion())
{
$trueValues = array('true', 'on', '+', 'yes', 'y');
$falseValues = array('false', 'off', '-', 'no', 'n');
}
else
{
$trueValues = array('true');
$falseValues = array('false');
}

switch (true)
{
Expand Down

0 comments on commit ab3f69b

Please sign in to comment.