MINOR Linting fixes

This commit is contained in:
Damian Mooyman 2019-03-26 16:29:58 +13:00
parent 83ec0b69fa
commit 6dc41e50a0
No known key found for this signature in database
GPG Key ID: 4327857F75021D92
2 changed files with 23 additions and 21 deletions

View File

@ -86,9 +86,9 @@ class GridFieldLevelup implements GridField_HTMLProvider
));
$template = SSViewer::get_templates_by_class($this, '', __CLASS__);
return array(
return [
'before' => $forTemplate->renderWith($template),
);
];
}
public function setAttributes($attrs)

View File

@ -41,11 +41,12 @@ if (!defined('BASE_PATH')) {
define('BASE_PATH', call_user_func(function () {
// Determine BASE_PATH based on the composer autoloader
foreach (debug_backtrace() as $backtraceItem) {
if (isset($backtraceItem['file']) && preg_match(
'#^(?<base>.*)(/|\\\\)vendor(/|\\\\)composer(/|\\\\)autoload_real.php#',
$backtraceItem['file'],
$matches
)) {
if (isset($backtraceItem['file'])
&& preg_match(
'#^(?<base>.*)(/|\\\\)vendor(/|\\\\)composer(/|\\\\)autoload_real.php#',
$backtraceItem['file'],
$matches
)) {
return realpath($matches['base']) ?: DIRECTORY_SEPARATOR;
}
}
@ -132,23 +133,24 @@ if (!defined('BASE_URL')) {
// When htaccess redirects from /base to /base/public folder, we need to only include /public
// in the BASE_URL if it's also present in the request
if ($baseURL
&& PUBLIC_DIR
&& isset($_SERVER['REQUEST_URI'])
&& substr($baseURL, -strlen(PUBLIC_DIR)) === PUBLIC_DIR
if (!$baseURL
|| !PUBLIC_DIR
|| !isset($_SERVER['REQUEST_URI'])
|| substr($baseURL, -strlen(PUBLIC_DIR)) !== PUBLIC_DIR
) {
$requestURI = $_SERVER['REQUEST_URI'];
// Check if /base/public or /base are in the request
foreach ([$baseURL, dirname($baseURL)] as $candidate) {
if (stripos($requestURI, $candidate) === 0) {
return $candidate;
}
}
// Ambiguous
return '';
return $baseURL;
}
return $baseURL;
$requestURI = $_SERVER['REQUEST_URI'];
// Check if /base/public or /base are in the request
foreach ([$baseURL, dirname($baseURL)] as $candidate) {
if (stripos($requestURI, $candidate) === 0) {
return $candidate;
}
}
// Ambiguous
return '';
}));
}