Advertisement
fruffl

Find logic errors by using shorthand

Sep 28th, 2015
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.48 KB | None | 0 0
  1. // symfony likes complicated fuzzy code
  2.  
  3. // original from
  4. // https://raw.githubusercontent.com/symfony/symfony/master/src/Symfony/Component/Finder/Glob.php
  5. if ($firstByte) {
  6.     if ($strictLeadingDot && '.' !== $car) {
  7.         $regex .= '(?=[^\.])';
  8.     }
  9.  
  10.     $firstByte = false;
  11. }
  12.  
  13. if ('/' === $car) {
  14.     $firstByte = true;
  15. }
  16. ...
  17.  
  18.  
  19. // same as
  20. if(TRUE === $strictLeadingDot
  21. && TRUE === $firstByte
  22. && '.' !== $car)
  23.     $regex .= '(?=[^\.])';
  24.  
  25. $firstByte = '/' === $car;
  26.  
  27.  
  28. # think about it!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement