Skip to content

Commit

Permalink
Merge pull request #12 from packaged/is_string
Browse files Browse the repository at this point in the history
Check if value is a string
  • Loading branch information
rgooding authored Aug 14, 2018
2 parents 0bcd114 + e15360f commit 141bad1
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/ValueAs.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ public static function bool($value, $default = false)
return $default;
}

if(strcasecmp($value, 'true') === 0)
if(is_string($value))
{
return true;
}
if(strcasecmp($value, 'true') === 0)
{
return true;
}

if(strcasecmp($value, 'false') === 0)
{
return false;
if(strcasecmp($value, 'false') === 0)
{
return false;
}
}

return (bool)$value;
Expand Down

0 comments on commit 141bad1

Please sign in to comment.