diff --git a/debian/changelog b/debian/changelog index 62a868c..c64b826 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -php-vitexsoftware-ease-core (1.40.0) UNRELEASED; urgency=medium +php-vitexsoftware-ease-core (1.40.1) UNRELEASED; urgency=medium [ Vítězslav Dvořák ] * all unit tests pass @@ -75,8 +75,9 @@ php-vitexsoftware-ease-core (1.40.0) UNRELEASED; urgency=medium * Init Added * appVersion added * Shared::Init for sqlite + * phpstan - -- vitex Fri, 18 Aug 2023 10:12:06 +0200 + -- vitex Fri, 01 Sep 2023 12:08:01 +0200 php-vitexsoftware-ease-core (0.12) UNRELEASED; urgency=medium diff --git a/src/Ease/Atom.php b/src/Ease/Atom.php index 585d68b..3ed6ad7 100644 --- a/src/Ease/Atom.php +++ b/src/Ease/Atom.php @@ -11,7 +11,7 @@ * @copyright 2009-2021 Vitex@hippy.cz (G) * @license https://opensource.org/licenses/MIT * - * PHP 7 + * PHP 8 */ namespace Ease; @@ -23,14 +23,6 @@ */ class Atom { - - /** - * Version of EasePHP Framework - * - * @var string - */ - public static $frameworkVersion = '0.5'; - /** * Debug mode flag. * diff --git a/src/Ease/Functions.php b/src/Ease/Functions.php index e30748a..9d9e085 100644 --- a/src/Ease/Functions.php +++ b/src/Ease/Functions.php @@ -440,8 +440,11 @@ public static function cfg(/*string*/ $constant, $cfg = null) { $cfg = constant($constant); } elseif (array_key_exists($constant, $_ENV)) { $cfg = getenv($constant,true); - } elseif (($env = getenv($constant)) && !empty($env)) { - $cfg = getenv($constant); + } else { + $env = getenv($constant); + if (!empty($env)) { + $cfg = $env; + } } return $cfg; } diff --git a/src/Ease/Logger/Logging.php b/src/Ease/Logger/Logging.php index 774170b..c144f20 100644 --- a/src/Ease/Logger/Logging.php +++ b/src/Ease/Logger/Logging.php @@ -1,7 +1,6 @@ addStatusMessage( - trim($prefix . ' PHP v' . phpversion() . ' EasePHP Framework v' . \Ease\Atom::$frameworkVersion . ' ' . $suffix), + trim(($prefix ? $prefix : \Ease\Shared::appName()) . ' PHP v' . phpversion() . ' EasePHP Framework v' . $version . ' ' . $suffix), 'debug' ); } - -} +} \ No newline at end of file diff --git a/src/Ease/Logger/Regent.php b/src/Ease/Logger/Regent.php index 69dbbe1..fb9cf11 100644 --- a/src/Ease/Logger/Regent.php +++ b/src/Ease/Logger/Regent.php @@ -6,7 +6,7 @@ * Class to Rule message loggers. * * @author Vitex - * @copyright 2016-2021 Vitex@hippy.cz (G) + * @copyright 2016-2023 Vitex@hippy.cz (G) */ namespace Ease\Logger; diff --git a/src/Ease/Logger/ToConsole.php b/src/Ease/Logger/ToConsole.php index f096260..20d3754 100644 --- a/src/Ease/Logger/ToConsole.php +++ b/src/Ease/Logger/ToConsole.php @@ -29,14 +29,14 @@ class ToConsole extends ToMemory implements Loggingable * * @var resource|false */ - public $stdout = false; + public $stdout; /** * Standard error handle * * @var resource */ - public $stderr = false; + public $stderr; /** * Ansi Codes diff --git a/src/Ease/Logger/ToEmail.php b/src/Ease/Logger/ToEmail.php index 9f3ec7d..552a07d 100644 --- a/src/Ease/Logger/ToEmail.php +++ b/src/Ease/Logger/ToEmail.php @@ -70,7 +70,7 @@ class ToEmail extends ToMemory implements Loggingable /** * Handle to mailer. * - * @var resource + * @var \Ease\Mailer */ public $mailer = null; diff --git a/src/Ease/Logger/ToEventlog.php b/src/Ease/Logger/ToEventlog.php index 80c13fd..9fa975f 100644 --- a/src/Ease/Logger/ToEventlog.php +++ b/src/Ease/Logger/ToEventlog.php @@ -51,10 +51,7 @@ public function finalizeMessage($messageRaw) */ public static function singleton() { - if (!isset(self::$instance)) { - self::$instance = new self(\Ease\Shared::appName() ? \Ease\Shared::appName() : 'EaseFramework'); - } - return self::$instance; + return is_object(self::$instance) ? self::$instance : new self(\Ease\Shared::appName() ? \Ease\Shared::appName() : 'EaseFramework'); } } diff --git a/src/Ease/Shared.php b/src/Ease/Shared.php index 82a166c..71b4c04 100644 --- a/src/Ease/Shared.php +++ b/src/Ease/Shared.php @@ -230,9 +230,9 @@ public static function logger() } /** - * Vrací, případně i založí objekt uživatele. + * Gives you shared User object. Create it first if not exist yet. * - * @param User|Anonym|string $user objekt nového uživatele nebo + * @param Person|User|Anonym|string $user objekt nového uživatele nebo * název třídy * * @return User diff --git a/src/Ease/User.php b/src/Ease/User.php index f78ef9f..9d2db42 100644 --- a/src/Ease/User.php +++ b/src/Ease/User.php @@ -147,7 +147,7 @@ public function getIcon() if ($email) { return self::getGravatar($email, 800, 'mm', 'g'); } else { - return; + return 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnIGlkPSJzdmcyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAwIiB3aWR0aD0iMjAwIiB2ZXJzaW9uPSIxLjAiPgogPHBhdGggaWQ9InBhdGgyMzgyIiBkPSJtMTY1LjMzIDExMy40NGExMDMuNjEgMTAzLjYxIDAgMSAxIC0yMDcuMjIgMCAxMDMuNjEgMTAzLjYxIDAgMSAxIDIwNy4yMiAweiIgdHJhbnNmb3JtPSJtYXRyaXgoLjkzNzM5IDAgMCAuOTM3MzkgNDIuMTQzIC02LjMzOTIpIiBzdHJva2Utd2lkdGg9IjAiIGZpbGw9IiNmZmYiLz4KIDxnIGlkPSJsYXllcjEiPgogIDxwYXRoIGlkPSJwYXRoMjQxMyIgZD0ibTEwMCAwYy01NS4yIDAtMTAwIDQ0LjgtMTAwIDEwMC01LjA0OTVlLTE1IDU1LjIgNDQuOCAxMDAgMTAwIDEwMHMxMDAtNDQuOCAxMDAtMTAwLTQ0LjgtMTAwLTEwMC0xMDB6bTAgMTIuODEyYzQ4LjEzIDAgODcuMTkgMzkuMDU4IDg3LjE5IDg3LjE4OHMtMzku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uMjcgMC4yMS01LjM3IDAuNTYtNy40MSAwLjU3LTMuMjcgMS40My01IDMuOTQtNy44MSAxLjYtMS44IDMuNy0zLjc2IDYuOTMtNi40NyA0Ljc3LTMuOTkxIDguMTEtNi45OSAxMS4yNi0xMC4xMjUgNC45MS00LjkwNyA3LjQ2LTguMjYgOS4yOC0xMi4xODcgMS40My0zLjA5MiAyLjIyLTYuMTY2IDIuNDYtOS41MzIgMC4wNi0wLjgxNiAwLjA3LTMuMDMgMC0zLjk2OC0wLjQ1LTcuMDQzLTMuMS0xMy4yNTMtOC4xNS0xOS4wMzItMC44LTAuOTA5LTIuNzgtMi44ODctMy43Mi0zLjcxOC00Ljk2LTQuMzk0LTEwLjY5LTcuMzUzLTE3LjU2LTkuMDk0LTQuMTktMS4wNjItOC4yMy0xLjYtMTMuMzUtMS43NS0wLjc4LTAuMDIzLTEuNTktMC4wMzYtMi4zNy0wLjAzMnptLTEwLjkwOCAxMDMuNnYyMmgyMS45OTh2LTIyaC0yMS45OTh6Ii8+CiA8L2c+Cjwvc3ZnPgo='; } } diff --git a/tests/src/Ease/UserTest.php b/tests/src/Ease/UserTest.php index 673dd84..509e922 100644 --- a/tests/src/Ease/UserTest.php +++ b/tests/src/Ease/UserTest.php @@ -68,14 +68,14 @@ public function testGetUserEmail() { * @covers Ease\User::draw */ public function testDraw($whatWant = null) { - $this->assertEquals('', $this->object->draw()); + $this->assertEquals('', $this->object->draw()); } /** * @covers Ease\User::getIcon */ public function testGetIcon() { - $this->assertEmpty($this->object->getIcon()); + $this->assertEquals('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnIGlkPSJzdmcyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaW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uNnYyMmgyMS45OTh2LTIyaC0yMS45OTh6Ii8+CiA8L2c+Cjwvc3ZnPgo=',$this->object->getIcon()); $this->object->setDataValue('email', 'info@vitexsoftware.cz'); $this->assertEquals('http://www.gravatar.com/avatar/f00226a1c6fe891010a2543531ed432c?s=800&d=mm&r=g', $this->object->getIcon()); }