Skip to content

Instantly share code, notes, and snippets.

@ayasuda
Created March 14, 2012 08:58
Show Gist options
  • Save ayasuda/2035225 to your computer and use it in GitHub Desktop.
Save ayasuda/2035225 to your computer and use it in GitHub Desktop.
<?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