From 6299ac4c0bed79e3ef54a9bbadab2539a07dc71c Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 4 Feb 2024 21:31:20 +0100 Subject: [PATCH] Run cs-fixer --- Core/Frameworks/Baikal/Core/Server.php | 7 ++-- Core/Frameworks/Baikal/Model/Calendar.php | 2 +- .../Baikal/Model/Calendar/Calendar.php | 2 +- Core/Frameworks/Baikal/Model/Config.php | 6 ++-- Core/Frameworks/Baikal/Model/User.php | 2 +- .../Controller/Install/Initialize.php | 2 +- .../Controller/Install/VersionUpgrade.php | 10 +++--- .../Controller/Navigation/Topbar.php | 6 ++-- .../Controller/Settings/Database.php | 4 +-- .../GlyphiconsPro/generate-sprite.php | 2 +- Core/Frameworks/Flake/Controller/Cli.php | 6 ++-- Core/Frameworks/Flake/Core/Collection.php | 32 +++++++++---------- Core/Frameworks/Flake/Core/Controller.php | 1 + .../Flake/Core/Database/Statement.php | 2 +- .../Flake/Core/Datastructure/ChainLink.php | 4 +-- Core/Frameworks/Flake/Framework.php | 2 +- Core/Frameworks/Flake/Util/Tools.php | 22 ++++++------- Core/Frameworks/Formal/Form.php | 8 ++--- Core/Frameworks/Formal/Form/Morphology.php | 2 +- 19 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Core/Frameworks/Baikal/Core/Server.php b/Core/Frameworks/Baikal/Core/Server.php index f08c110..b0baf5a 100644 --- a/Core/Frameworks/Baikal/Core/Server.php +++ b/Core/Frameworks/Baikal/Core/Server.php @@ -27,7 +27,6 @@ namespace Baikal\Core; -use PDO; use Symfony\Component\Yaml\Yaml; /** @@ -71,7 +70,7 @@ class Server { /** * Reference to Database object. * - * @var PDO + * @var \PDO */ protected $pdo; @@ -96,10 +95,10 @@ class Server { * @param bool $enableCardDAV * @param string $authType * @param string $authRealm - * @param PDO $pdo + * @param \PDO $pdo * @param string $baseUri */ - function __construct($enableCalDAV, $enableCardDAV, $authType, $authRealm, PDO $pdo, $baseUri) { + function __construct($enableCalDAV, $enableCardDAV, $authType, $authRealm, \PDO $pdo, $baseUri) { $this->enableCalDAV = $enableCalDAV; $this->enableCardDAV = $enableCardDAV; $this->authType = $authType; diff --git a/Core/Frameworks/Baikal/Model/Calendar.php b/Core/Frameworks/Baikal/Model/Calendar.php index d90af60..c27ba9c 100644 --- a/Core/Frameworks/Baikal/Model/Calendar.php +++ b/Core/Frameworks/Baikal/Model/Calendar.php @@ -246,7 +246,7 @@ class Calendar extends \Flake\Core\Model\Db { $rSql = $GLOBALS["DB"]->exec_SELECTquery( "count(*)", "calendarinstances", - "calendarid" . "='" . $this->aData["calendarid"] . "'" + "calendarid='" . $this->aData["calendarid"] . "'" ); if (($aRs = $rSql->fetch()) === false) { diff --git a/Core/Frameworks/Baikal/Model/Calendar/Calendar.php b/Core/Frameworks/Baikal/Model/Calendar/Calendar.php index 4dfe464..9c75ade 100644 --- a/Core/Frameworks/Baikal/Model/Calendar/Calendar.php +++ b/Core/Frameworks/Baikal/Model/Calendar/Calendar.php @@ -40,7 +40,7 @@ class Calendar extends \Flake\Core\Model\Db { $rSql = $GLOBALS["DB"]->exec_SELECTquery( "count(*)", "calendarinstances", - "calendarid" . "='" . $this->aData["id"] . "'" + "calendarid='" . $this->aData["id"] . "'" ); if (($aRs = $rSql->fetch()) === false) { diff --git a/Core/Frameworks/Baikal/Model/Config.php b/Core/Frameworks/Baikal/Model/Config.php index 357a7eb..77c6fe4 100644 --- a/Core/Frameworks/Baikal/Model/Config.php +++ b/Core/Frameworks/Baikal/Model/Config.php @@ -68,9 +68,9 @@ abstract class Config extends \Flake\Core\Model\NoDb { function writable() { return ( - @file_exists(PROJECT_PATH_CONFIG . "baikal.yaml") && - @is_file(PROJECT_PATH_CONFIG . "baikal.yaml") && - @is_writable(PROJECT_PATH_CONFIG . "baikal.yaml") + @file_exists(PROJECT_PATH_CONFIG . "baikal.yaml") + && @is_file(PROJECT_PATH_CONFIG . "baikal.yaml") + && @is_writable(PROJECT_PATH_CONFIG . "baikal.yaml") ); } diff --git a/Core/Frameworks/Baikal/Model/User.php b/Core/Frameworks/Baikal/Model/User.php index d632b96..4bb9ade 100644 --- a/Core/Frameworks/Baikal/Model/User.php +++ b/Core/Frameworks/Baikal/Model/User.php @@ -39,7 +39,7 @@ class User extends \Flake\Core\Model\Db { "digesta1" => "", ]; - protected $oIdentityPrincipal = null; + protected $oIdentityPrincipal; function initByPrimary($sPrimary) { parent::initByPrimary($sPrimary); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php index 66c7c45..f1cc643 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/Initialize.php @@ -108,7 +108,7 @@ class Initialize extends \Flake\Core\Controller { exit(0); #$sMessage = "

Baïkal is now configured. You may Access the Baïkal admin

"; - #$sForm = ""; + #$sForm = ""; } else { $sMessage = ""; $sForm = $this->oForm->render(); diff --git a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php index 92281a1..d4cd91e 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Install/VersionUpgrade.php @@ -387,7 +387,7 @@ CREATE TABLE calendarinstances ( UNIQUE (calendarid, share_href) ); SQL - ); + ); $this->aSuccess[] = 'Created calendarinstances table'; $pdo->exec(' INSERT INTO calendarinstances @@ -426,7 +426,7 @@ CREATE TABLE calendars ( components text NOT NULL ); SQL - ); + ); $this->aSuccess[] = 'Created new calendars table'; } else { // mysql $pdo->exec(<<aSuccess[] = 'Created calendarinstances table'; $pdo->exec(' INSERT INTO calendarinstances @@ -489,14 +489,14 @@ CREATE TABLE calendars ( components VARBINARY(21) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; SQL -); + ); $this->aSuccess[] = 'Created new calendars table'; } $pdo->exec(<<aSuccess[] = 'Migrated calendars table'; } if (version_compare($sVersionFrom, '0.9.4', '<')) { diff --git a/Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php b/Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php index f2a4aed..0fa081f 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Navigation/Topbar.php @@ -48,9 +48,9 @@ class Topbar extends \Flake\Core\Controller { $sActiveHome = "active"; } if ( - $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Users") || - $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\Calendars") || - $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\AddressBooks") + $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\Users") + || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\Calendars") + || $sCurrentRoute === $GLOBALS["ROUTER"]::getRouteForController("\BaikalAdmin\Controller\User\AddressBooks") ) { $sActiveUsers = "active"; } diff --git a/Core/Frameworks/BaikalAdmin/Controller/Settings/Database.php b/Core/Frameworks/BaikalAdmin/Controller/Settings/Database.php index 54d376a..84d10d5 100644 --- a/Core/Frameworks/BaikalAdmin/Controller/Settings/Database.php +++ b/Core/Frameworks/BaikalAdmin/Controller/Settings/Database.php @@ -171,8 +171,8 @@ class Database extends \Flake\Core\Controller { } catch (\Exception $e) { $oForm->declareError( $oMorpho->element("sqlite_file"), - "Baïkal was not able to establish a connexion to the SQLite database as configured.
SQLite says: " . $e->getMessage() . (string) $e - ); + "Baïkal was not able to establish a connexion to the SQLite database as configured.
SQLite says: " . $e->getMessage() . (string) $e + ); } } } diff --git a/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php b/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php index 1425387..7a2114b 100644 --- a/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php +++ b/Core/Frameworks/BaikalAdmin/Resources/GlyphiconsPro/generate-sprite.php @@ -456,7 +456,7 @@ CSS; CSS; } - $sCss = "\n" . "/* " . count($aSprites) . " glyphs, generated on " . strftime("%Y-%m-%d %H:%M:%S") . "; C=" . $iCols . "; R=" . $iRows . "; W=" . $iPngWidth . "; H=" . $iPngHeight . "; PREFIX=" . $sClassPrefix . " */\n" . $sCss; + $sCss = "\n/* " . count($aSprites) . " glyphs, generated on " . strftime("%Y-%m-%d %H:%M:%S") . "; C=" . $iCols . "; R=" . $iRows . "; W=" . $iPngWidth . "; H=" . $iPngHeight . "; PREFIX=" . $sClassPrefix . " */\n" . $sCss; return $sCss; } diff --git a/Core/Frameworks/Flake/Controller/Cli.php b/Core/Frameworks/Flake/Controller/Cli.php index 4f41a27..e3d899f 100644 --- a/Core/Frameworks/Flake/Controller/Cli.php +++ b/Core/Frameworks/Flake/Controller/Cli.php @@ -90,9 +90,9 @@ class Cli extends \Flake\Core\Render\Container { function header($sMsg) { $sStr = "\n" . str_repeat("#", 80); - $sStr .= "\n" . "#" . str_repeat(" ", 78) . "#"; - $sStr .= "\n" . "#" . str_pad(strtoupper($sMsg), 78, " ", STR_PAD_BOTH) . "#"; - $sStr .= "\n" . "#" . str_repeat(" ", 78) . "#"; + $sStr .= "\n#" . str_repeat(" ", 78) . "#"; + $sStr .= "\n#" . str_pad(strtoupper($sMsg), 78, " ", STR_PAD_BOTH) . "#"; + $sStr .= "\n#" . str_repeat(" ", 78) . "#"; $sStr .= "\n" . str_repeat("#", 80); $sStr .= "\n"; diff --git a/Core/Frameworks/Flake/Core/Collection.php b/Core/Frameworks/Flake/Core/Collection.php index 84b661d..a77f9e0 100644 --- a/Core/Frameworks/Flake/Core/Collection.php +++ b/Core/Frameworks/Flake/Core/Collection.php @@ -175,14 +175,14 @@ class Collection extends \Flake\Core\FLObject implements \Iterator { function &__call($sName, $aArguments) { if ( - strlen($sName) > 7 && - $sName[0] === "s" && - $sName[1] === "e" && - $sName[2] === "t" && - $sName[3] === "M" && - $sName[4] === "e" && - $sName[5] === "t" && - $sName[6] === "a" + strlen($sName) > 7 + && $sName[0] === "s" + && $sName[1] === "e" + && $sName[2] === "t" + && $sName[3] === "M" + && $sName[4] === "e" + && $sName[5] === "t" + && $sName[6] === "a" ) { $sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8); $mValue = &$aArguments[0]; @@ -199,14 +199,14 @@ class Collection extends \Flake\Core\FLObject implements \Iterator { return $res; # To avoid 'Notice: Only variable references should be returned by reference' } elseif ( - strlen($sName) > 7 && - $sName[0] === "g" && - $sName[1] === "e" && - $sName[2] === "t" && - $sName[3] === "M" && - $sName[4] === "e" && - $sName[5] === "t" && - $sName[6] === "a" + strlen($sName) > 7 + && $sName[0] === "g" + && $sName[1] === "e" + && $sName[2] === "t" + && $sName[3] === "M" + && $sName[4] === "e" + && $sName[5] === "t" + && $sName[6] === "a" ) { $sKey = strtolower(substr($sName, 7, 1)) . substr($sName, 8); if (array_key_exists($sKey, $this->aMeta)) { diff --git a/Core/Frameworks/Flake/Core/Controller.php b/Core/Frameworks/Flake/Core/Controller.php index 33c81e4..0268684 100644 --- a/Core/Frameworks/Flake/Core/Controller.php +++ b/Core/Frameworks/Flake/Core/Controller.php @@ -46,6 +46,7 @@ abstract class Controller extends \Flake\Core\FLObject { # TODO: il faut remplacer le mécanisme basé sur un nombre variable de paramètres en un mécanisme basé sur un seul paramètre "tableau" #$aParams = func_get_args(); $sController = "\\" . get_called_class(); + #array_unshift($aParams, $sController); # Injecting current controller as first param #return call_user_func_array($GLOBALS["ROUTER"] . "::buildRouteForController", $aParams); return $GLOBALS["ROUTER"]::buildRouteForController($sController, $aParams); diff --git a/Core/Frameworks/Flake/Core/Database/Statement.php b/Core/Frameworks/Flake/Core/Database/Statement.php index ed1e84f..ddc24a2 100644 --- a/Core/Frameworks/Flake/Core/Database/Statement.php +++ b/Core/Frameworks/Flake/Core/Database/Statement.php @@ -28,7 +28,7 @@ namespace Flake\Core\Database; class Statement extends \Flake\Core\FLObject { - protected $stmt = null; + protected $stmt; function __construct($stmt) { $this->stmt = $stmt; diff --git a/Core/Frameworks/Flake/Core/Datastructure/ChainLink.php b/Core/Frameworks/Flake/Core/Datastructure/ChainLink.php index 8bd4479..1ae1d0f 100644 --- a/Core/Frameworks/Flake/Core/Datastructure/ChainLink.php +++ b/Core/Frameworks/Flake/Core/Datastructure/ChainLink.php @@ -28,8 +28,8 @@ namespace Flake\Core\Datastructure; abstract class ChainLink implements \Flake\Core\Datastructure\Chainable { - protected $__container = null; - protected $__key = null; + protected $__container; + protected $__key; function chain(Chain $container, $key) { $this->__container = $container; diff --git a/Core/Frameworks/Flake/Framework.php b/Core/Frameworks/Flake/Framework.php index 8ea382d..579e25a 100644 --- a/Core/Frameworks/Flake/Framework.php +++ b/Core/Frameworks/Flake/Framework.php @@ -211,7 +211,7 @@ class Framework extends \Flake\Core\Framework { if (isset($config["system"]["base_uri"]) && $config["system"]["base_uri"] !== "") { // SabreDAV needs a "/" at the beginning of BASEURL define("PROJECT_BASEURI", - self::prependSlash(self::appendSlash($config["system"]["base_uri"]))); + self::prependSlash(self::appendSlash($config["system"]["base_uri"]))); define("PROJECT_URI", \Flake\Util\Tools::getCurrentProtocol() . "://" . $_SERVER["HTTP_HOST"] . PROJECT_BASEURI); diff --git a/Core/Frameworks/Flake/Util/Tools.php b/Core/Frameworks/Flake/Util/Tools.php index d396044..ec10f9d 100644 --- a/Core/Frameworks/Flake/Util/Tools.php +++ b/Core/Frameworks/Flake/Util/Tools.php @@ -342,10 +342,10 @@ class Tools extends \Flake\Core\FLObject { TEST; - $sHeaders = "From: " . $sFromName . "<" . $sFromAddress . ">" . "\r\n"; - $sHeaders .= "Reply-To: " . $sReplyToName . "<" . $sReplyToAddress . ">" . "\r\n"; - $sHeaders .= "Bcc: " . $sReplyToName . "<" . $sReplyToAddress . ">" . "\r\n"; - $sHeaders .= "Content-Type: text/html" . "\r\n"; + $sHeaders = "From: " . $sFromName . "<" . $sFromAddress . ">\r\n"; + $sHeaders .= "Reply-To: " . $sReplyToName . "<" . $sReplyToAddress . ">\r\n"; + $sHeaders .= "Bcc: " . $sReplyToName . "<" . $sReplyToAddress . ">\r\n"; + $sHeaders .= "Content-Type: text/html\r\n"; mail($sToAddress, $sSubject, $sMessage, $sHeaders); } @@ -761,14 +761,14 @@ TEST; $data = ""; if ($bodylen > 0) { switch ($method) { - case 8: - // Currently the only supported compression method: - $data = gzinflate($body, $maxlength); - break; - default: - $error = "Unknown compression method."; + case 8: + // Currently the only supported compression method: + $data = gzinflate($body, $maxlength); + break; + default: + $error = "Unknown compression method."; - return false; + return false; } } // zero-byte body content is allowed // Verifiy CRC32 diff --git a/Core/Frameworks/Formal/Form.php b/Core/Frameworks/Formal/Form.php index 41c69c0..cd925cc 100644 --- a/Core/Frameworks/Formal/Form.php +++ b/Core/Frameworks/Formal/Form.php @@ -38,15 +38,15 @@ class Form { "hook.validation" => false, "hook.morphology" => false, ]; - protected $oModelInstance = null; - protected $oElements = null; + protected $oModelInstance; + protected $oElements; protected $aErrors = []; - protected $bPersisted = null; # TRUE when form has persisted; available only after execute + protected $bPersisted; # TRUE when form has persisted; available only after execute protected $sDisplayTitle = ""; # Displayed form title; generated in setModelInstance() protected $sDisplayMessage = ""; # Displayed confirm message; generated in execute() - protected $oMorpho = null; + protected $oMorpho; function __construct($sModelClass, $aOptions = []) { $this->sModelClass = $sModelClass; diff --git a/Core/Frameworks/Formal/Form/Morphology.php b/Core/Frameworks/Formal/Form/Morphology.php index 6cdfd50..fd49dfe 100644 --- a/Core/Frameworks/Formal/Form/Morphology.php +++ b/Core/Frameworks/Formal/Form/Morphology.php @@ -28,7 +28,7 @@ namespace Formal\Form; class Morphology { - protected $oElements = null; + protected $oElements; function __construct() { $this->oElements = new \Flake\Core\CollectionTyped("\Formal\Element");