mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Applied PHP-CS-Fixer rules
This commit is contained in:
@@ -17,14 +17,14 @@ abstract class BaseBarcodeLookupPlugin
|
||||
return $pluginOutput;
|
||||
}
|
||||
|
||||
// Plugin must return an associative array
|
||||
// Plugin must return an associative array
|
||||
if (!is_array($pluginOutput))
|
||||
{
|
||||
throw new \Exception('Plugin output must be an associative array');
|
||||
}
|
||||
|
||||
if (!IsAssociativeArray($pluginOutput)) // $pluginOutput is at least an indexed array here
|
||||
{
|
||||
if (!IsAssociativeArray($pluginOutput))
|
||||
{ // $pluginOutput is at least an indexed array here
|
||||
throw new \Exception('Plugin output must be an associative array');
|
||||
}
|
||||
|
||||
@@ -44,10 +44,9 @@ abstract class BaseBarcodeLookupPlugin
|
||||
{
|
||||
throw new \Exception("Plugin output does not provide needed property $prop");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// $pluginOutput contains all needed properties here
|
||||
// $pluginOutput contains all needed properties here
|
||||
|
||||
// Check referenced entity ids are valid
|
||||
$locationId = $pluginOutput['location_id'];
|
||||
|
@@ -24,7 +24,6 @@ class PrerequisiteChecker
|
||||
{
|
||||
throw new ERequirementNotMet('/vendor/autoload.php not found. Have you run Composer?');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkForConfigDistFile()
|
||||
@@ -33,7 +32,6 @@ class PrerequisiteChecker
|
||||
{
|
||||
throw new ERequirementNotMet('config-dist.php not found. Please do not remove this file.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkForConfigFile()
|
||||
@@ -42,7 +40,6 @@ class PrerequisiteChecker
|
||||
{
|
||||
throw new ERequirementNotMet('config.php in data directory (' . GROCY_DATAPATH . ') not found. Have you copied config-dist.php to the data directory and renamed it to config.php?');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkForPhpExtensions()
|
||||
@@ -55,9 +52,7 @@ class PrerequisiteChecker
|
||||
{
|
||||
throw new ERequirementNotMet("PHP module '{$extension}' not installed, but required.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function checkForSqliteVersion()
|
||||
@@ -68,7 +63,6 @@ class PrerequisiteChecker
|
||||
{
|
||||
throw new ERequirementNotMet('SQLite ' . REQUIRED_SQLITE_VERSION . ' is required, however you are running ' . $sqliteVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getSqlVersionAsString()
|
||||
@@ -76,5 +70,4 @@ class PrerequisiteChecker
|
||||
$dbh = new PDO('sqlite::memory:');
|
||||
return $dbh->query('select sqlite_version()')->fetch()[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -12,11 +12,10 @@ class UrlManager
|
||||
{
|
||||
return rtrim($this->BasePath, '/') . $relativePath;
|
||||
}
|
||||
else // Is not a resource and URL rewriting is disabled
|
||||
{
|
||||
else
|
||||
{ // Is not a resource and URL rewriting is disabled
|
||||
return rtrim($this->BasePath, '/') . '/index.php' . $relativePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function __construct(string $basePath)
|
||||
@@ -29,7 +28,6 @@ class UrlManager
|
||||
{
|
||||
$this->BasePath = $basePath;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function GetBaseUrl()
|
||||
@@ -41,5 +39,4 @@ class UrlManager
|
||||
|
||||
return (isset($_SERVER['HTTPS']) ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ function FindObjectInArrayByPropertyValue($array, $propertyName, $propertyValue)
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -25,7 +24,7 @@ function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyVa
|
||||
{
|
||||
case '==':
|
||||
|
||||
if ($object-> {$propertyName}
|
||||
if ($object->{$propertyName}
|
||||
== $propertyValue)
|
||||
{
|
||||
$returnArray[] = $object;
|
||||
@@ -34,7 +33,7 @@ function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyVa
|
||||
break;
|
||||
case '>':
|
||||
|
||||
if ($object-> {$propertyName}
|
||||
if ($object->{$propertyName}
|
||||
> $propertyValue)
|
||||
{
|
||||
$returnArray[] = $object;
|
||||
@@ -43,7 +42,7 @@ function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyVa
|
||||
break;
|
||||
case '<':
|
||||
|
||||
if ($object-> {$propertyName}
|
||||
if ($object->{$propertyName}
|
||||
< $propertyValue)
|
||||
{
|
||||
$returnArray[] = $object;
|
||||
@@ -51,7 +50,6 @@ function FindAllObjectsInArrayByPropertyValue($array, $propertyName, $propertyVa
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
@@ -90,7 +88,6 @@ function FindAllItemsInArrayByValue($array, $value, $operator = '==')
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
@@ -122,7 +119,6 @@ function GetClassConstants($className, $prefix = null)
|
||||
$matchingKeys = preg_grep('!^' . $prefix . '!', array_keys($constants));
|
||||
return array_intersect_key($constants, array_flip($matchingKeys));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function RandomString($length, $allowedChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
@@ -188,17 +184,15 @@ function Setting(string $name, $value)
|
||||
{
|
||||
define('GROCY_' . $name, ExternalSettingValue(file_get_contents($settingOverrideFile)));
|
||||
}
|
||||
elseif (getenv('GROCY_' . $name) !== false) // An environment variable with the same name and prefix GROCY_ overwrites the given setting
|
||||
{
|
||||
elseif (getenv('GROCY_' . $name) !== false)
|
||||
{ // An environment variable with the same name and prefix GROCY_ overwrites the given setting
|
||||
define('GROCY_' . $name, ExternalSettingValue(getenv('GROCY_' . $name)));
|
||||
}
|
||||
else
|
||||
{
|
||||
define('GROCY_' . $name, $value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
global $GROCY_DEFAULT_USER_SETTINGS;
|
||||
@@ -211,7 +205,6 @@ function DefaultUserSetting(string $name, $value)
|
||||
{
|
||||
$GROCY_DEFAULT_USER_SETTINGS[$name] = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetUserDisplayName($user)
|
||||
|
Reference in New Issue
Block a user