for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
if (!function_exists('backpack_url')) {
/**
* Appends the configured backpack prefix and returns
* the URL using the standard Laravel helpers.
*
* @param $path
* @return string
*/
function backpack_url($path = null)
{
$path = !$path || (substr($path, 1, 1) == '/') ? $path : '/'.$path;
return url(config('backpack.base.route_prefix', 'admin').$path);
}
if (!function_exists('backpack_avatar')) {
* Returns the avatar URL of a user.
* @param $user
function backpack_avatar_url($user)
switch (config('backpack.base.avatar_type')) {
case 'gravatar':
return Gravatar::fallback('https://placehold.it/160x160/00a65a/ffffff/&text='.$user->name[0])->get($user->email);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case 'placehold':
return 'https://placehold.it/160x160/00a65a/ffffff/&text='.$user->name[0];
default:
return $user->{config('backpack.base.avatar_type')};
if (!function_exists('backpack_middleware')) {
* Return the key of the middleware used across Backpack.
* That middleware checks if the visitor is an admin.
function backpack_middleware()
return config('backpack.base.middleware_key', 'admin');
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.