Created
March 14, 2012 08:58
-
-
Save ayasuda/2035225 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class HogeController extend ParentController { | |
public function fuga() { | |
$filtered =SomeUtil::do_something($_GET["foo"]); | |
RefactoredUtil::refactored_func($filtered); | |
} | |
} | |
class RefactoredUtil { | |
public static function refactored_func($ary) { | |
$ary = array_filter($ary, function($a){ | |
if ($a==="") { | |
return FALSE; | |
} else { | |
return TRUE; | |
} | |
}); | |
$this->do_somethins($ary); | |
// Error occored!! | |
// Becase, $ary["piyo"] equal NULL !! | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment