Permalink
Browse files

[Finder] bypassed some code when possible

  • Loading branch information...
1 parent 9c84b62 commit bdef5dc407b7c258337f3a1d83ae6ade48404c65 @fabpot fabpot committed Nov 5, 2011
Showing with 25 additions and 23 deletions.
  1. +1 −1 Comparator/Comparator.php
  2. +1 −1 Comparator/DateComparator.php
  3. +23 −21 Comparator/NumberComparator.php
View
2 Comparator/Comparator.php
@@ -14,7 +14,7 @@
/**
* Comparator.
*
- * @author Fabien Potencier <fabien@symfony.com> PHP port
+ * @author Fabien Potencier <fabien@symfony.com>
*/
class Comparator
{
View
2 Comparator/DateComparator.php
@@ -14,7 +14,7 @@
/**
* DateCompare compiles date comparisons.
*
- * @author Fabien Potencier <fabien@symfony.com> PHP port
+ * @author Fabien Potencier <fabien@symfony.com>
*/
class DateComparator extends Comparator
{
View
44 Comparator/NumberComparator.php
@@ -25,7 +25,7 @@
*
* Based on the Perl Number::Compare module.
*
- * @author Fabien Potencier <fabien@symfony.com> PHP port
+ * @author Fabien Potencier <fabien@symfony.com> PHP port
* @author Richard Clamp <richardc@unixbeard.net> Perl version
* @copyright 2004-2005 Fabien Potencier <fabien@symfony.com>
* @copyright 2002 Richard Clamp <richardc@unixbeard.net>
@@ -47,26 +47,28 @@ public function __construct($test)
}
$target = $matches[2];
- $magnitude = strtolower(isset($matches[3]) ? $matches[3] : '');
- switch ($magnitude) {
- case 'k':
- $target *= 1000;
- break;
- case 'ki':
- $target *= 1024;
- break;
- case 'm':
- $target *= 1000000;
- break;
- case 'mi':
- $target *= 1024*1024;
- break;
- case 'g':
- $target *= 1000000000;
- break;
- case 'gi':
- $target *= 1024*1024*1024;
- break;
+ if (isset($matches[3])) {
+ // magnitude
+ switch (strtolower($matches[3])) {
+ case 'k':
+ $target *= 1000;
+ break;
+ case 'ki':
+ $target *= 1024;
+ break;
+ case 'm':
+ $target *= 1000000;
+ break;
+ case 'mi':
+ $target *= 1024*1024;
+ break;
+ case 'g':
+ $target *= 1000000000;
+ break;
+ case 'gi':
+ $target *= 1024*1024*1024;
+ break;
+ }
}
$this->setTarget($target);

0 comments on commit bdef5dc

Please sign in to comment.