It seems like the GitHub access token used for retrieving details about this repository from
GitHub became invalid. This might prevent certain types of inspections from being run (in
particular,
everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
env uses the super-global variable $_ENV which is generally not recommended.
Instead of super-globals, we recommend to explicitly inject the dependencies
of your class. This makes your code less dependent on global state and it
becomes generally more testable:
// BadclassRouter{publicfunctiongenerate($path){return$_SERVER['HOST'].$path;}}// BetterclassRouter{private$host;publicfunction__construct($host){$this->host=$host;}publicfunctiongenerate($path){return$this->host.$path;}}classController{publicfunctionmyAction(Request$request){// Instead of$page=isset($_GET['page'])?intval($_GET['page']):1;// Better (assuming you use the Symfony2 request)$page=$request->query->get('page',1);}}
Loading history...
12
{
13
26
return $_ENV[$value];
14
}
15
}
16
17
if (!function_exists("Gbowo\\generateTransRef")) {
18
/**
19
* Generate a cryptographically secure random string
20
* @param int $length Defaults to 10
21
* @return string
22
*/
23
function generateTransRef(int $length = 10)
24
{
25
5
return bin2hex(random_bytes($length));
26
}
27
}
28
29
if (!function_exists("Gbowo\\toKobo")) {
30
/**
31
* Convert a given amount to it's kobo equivalent.
32
* This is just an helper function and you def' can do without it
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: