Skip to content

Commit

Permalink
library numbering reworked
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Sep 1, 2023
1 parent 64d6726 commit 5893a14
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 31 deletions.
5 changes: 3 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -75,8 +75,9 @@ php-vitexsoftware-ease-core (1.40.0) UNRELEASED; urgency=medium
* Init Added
* appVersion added
* Shared::Init for sqlite
* phpstan

-- vitex <[email protected]> Fri, 18 Aug 2023 10:12:06 +0200
-- vitex <[email protected]> Fri, 01 Sep 2023 12:08:01 +0200

php-vitexsoftware-ease-core (0.12) UNRELEASED; urgency=medium

Expand Down
10 changes: 1 addition & 9 deletions src/Ease/Atom.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @copyright 2009-2021 Vitex@hippy.cz (G)
* @license https://opensource.org/licenses/MIT
*
* PHP 7
* PHP 8
*/

namespace Ease;
Expand All @@ -23,14 +23,6 @@
*/
class Atom
{

/**
* Version of EasePHP Framework
*
* @var string
*/
public static $frameworkVersion = '0.5';

/**
* Debug mode flag.
*
Expand Down
7 changes: 5 additions & 2 deletions src/Ease/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
15 changes: 10 additions & 5 deletions src/Ease/Logger/Logging.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

declare(strict_types=1);

/**
* Logging trait
*
Expand Down Expand Up @@ -83,18 +82,24 @@ public function getLogger($options = null)
/**
* Add Info about used PHP and EasePHP Library
*
* @param string $prefix banner prefix text
* @param string $prefix banner prefix text (default is APPName)
* @param string $suffix banner suffix text
*/
public function logBanner($prefix = '', $suffix = '')
{
if (\Ease\Functions::cfg('DEBUG') === true) {
$suffix .= ' Loggers: ' . \Ease\Functions::cfg('EASE_LOGGER');
}

if (method_exists('Composer\InstalledVersions', 'getPrettyVersion')) {
$version = \Composer\InstalledVersions::getPrettyVersion('vitexsoftware/ease-core');
} else {
$version = 'n/a';
}

$this->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'
);
}

}
}
2 changes: 1 addition & 1 deletion src/Ease/Logger/Regent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class to Rule message loggers.
*
* @author Vitex <vitex@hippy.cz>
* @copyright 2016-2021 Vitex@hippy.cz (G)
* @copyright 2016-2023 Vitex@hippy.cz (G)
*/

namespace Ease\Logger;
Expand Down
4 changes: 2 additions & 2 deletions src/Ease/Logger/ToConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Ease/Logger/ToEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ToEmail extends ToMemory implements Loggingable
/**
* Handle to mailer.
*
* @var resource
* @var \Ease\Mailer
*/
public $mailer = null;

Expand Down
5 changes: 1 addition & 4 deletions src/Ease/Logger/ToEventlog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

}
4 changes: 2 additions & 2 deletions src/Ease/Shared.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Ease/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnIGlkPSJzdmcyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAwIiB3aWR0aD0iMjAwIiB2ZXJzaW9uPSIxLjAiPgogPHBhdGggaWQ9InBhdGgyMzgyIiBkPSJtMTY1LjMzIDExMy40NGExMDMuNjEgMTAzLjYxIDAgMSAxIC0yMDcuMjIgMCAxMDMuNjEgMTAzLjYxIDAgMSAxIDIwNy4yMiAweiIgdHJhbnNmb3JtPSJtYXRyaXgoLjkzNzM5IDAgMCAuOTM3MzkgNDIuMTQzIC02LjMzOTIpIiBzdHJva2Utd2lkdGg9IjAiIGZpbGw9IiNmZmYiLz4KIDxnIGlkPSJsYXllcj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gyOS0xMC43OCA5LjQwNy0zLjYgMi45NDQtNi4wNCA1LjE1Ni04LjEyIDcuMzQzLTQuOTQzIDUuMTc5LTcuMTkxIDkuMDY5LTguNTY0IDE0LjcxOS0wLjkwNSAzLjcyLTEuMjU2IDcuNTUtMS4xNTYgMTMuMTkgMC4wMjUgMS40IDAuMDYyIDIuNzMgMC4wNjIgMi45N3YwLjQzaDIxLjU5OGwwLjAzLTIuNGMwLjAzLTMuMjcgMC4yMS01LjM3IDAuNTYtNy40MSAwLjU3LTMuMjcgMS40My01IDMuOTQtNy44MSAxLjYtMS44IDMuNy0zLjc2IDYuOTMtNi40NyA0Ljc3LTMuOTkxIDguMTEtNi45OSAxMS4yNi0xMC4xMjUgNC45MS00LjkwNyA3LjQ2LTguMjYgOS4yOC0xMi4xODcgMS40My0zLjA5MiAyLjIyLTYuMTY2IDIuNDYtOS41MzIgMC4wNi0wLjgxNiAwLjA3LTMuMDMgMC0zLjk2OC0wLjQ1LTcuMDQzLTMuMS0xMy4yNTMtOC4xNS0xOS4wMzItMC44LTAuOTA5LTIuNzgtMi44ODctMy43Mi0zLjcxOC00Ljk2LTQuMzk0LTEwLjY5LTcuMzUzLTE3LjU2LTkuMDk0LTQuMTktMS4wNjItOC4yMy0xLjYtMTMuMzUtMS43NS0wLjc4LTAuMDIzLTEuNTktMC4wMzYtMi4zNy0wLjAzMnptLTEwLjkwOCAxMDMuNnYyMmgyMS45OTh2LTIyaC0yMS45OTh6Ii8+CiA8L2c+Cjwvc3ZnPgo=';
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/src/Ease/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public function testGetUserEmail() {
* @covers Ease\User::draw
*/
public function testDraw($whatWant = null) {
$this->assertEquals('<img class="avatar" src="">', $this->object->draw());
$this->assertEquals('<img class="avatar" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYW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y43Mi0zLjcxOC00Ljk2LTQuMzk0LTEwLjY5LTcuMzUzLTE3LjU2LTkuMDk0LTQuMTktMS4wNjItOC4yMy0xLjYtMTMuMzUtMS43NS0wLjc4LTAuMDIzLTEuNTktMC4wMzYtMi4zNy0wLjAzMnptLTEwLjkwOCAxMDMuNnYyMmgyMS45OTh2LTIyaC0yMS45OTh6Ii8+CiA8L2c+Cjwvc3ZnPgo=">', $this->object->draw());
}

/**
* @covers Ease\User::getIcon
*/
public function testGetIcon() {
$this->assertEmpty($this->object->getIcon());
$this->assertEquals('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnIGlkPSJzdmcyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjAwIiB3aWR0aD0iMjAwIiB2ZXJzaW9uPSIxLjAiPgogPHBhdGggaWQ9InBhdGgyMzgyIiBkPSJtMTY1LjMzIDExMy40NGExMDMuNjEgMTAzLjYxIDAgMSAxIC0yMDcuMjIgMCAxMDMuNjEgMTAzLjYxIDAgMSAxIDIwNy4yMiAweiIgdHJhbnNmb3JtPSJtYXRyaXgoLjkzNzM5IDAgMCAuOTM3MzkgNDIuMTQzIC02LjMzOTIpIiBzdHJva2Utd2lkdGg9IjAiIGZpbGw9IiNmZmYiLz4KIDxnIGlkPSJsYXllcjEiPgogIDxwYXRoIGlkPSJwYXRoMjQxMyIgZD0ibTEwMCAwYy01NS4yIDAtMTAwIDQ0LjgtMTAwIDEwMC01LjA0OTVlLTE1IDU1LjIgNDQuOCAxMDAgMTAwIDEwMHMxMDAtNDQuOCAxMDAtMTAwLTQ0LjgtMTAwLTEwMC0xMDB6bTAgMTIuODEyYzQ4LjEzIDAgODcuMTkgMzkuMD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jU5OGwwLjAzLTIuNGMwLjAzLTMuMjcgMC4yMS01LjM3IDAuNTYtNy40MSAwLjU3LTMuMjcgMS40My01IDMuOTQtNy44MSAxLjYtMS44IDMuNy0zLjc2IDYuOTMtNi40NyA0Ljc3LTMuOTkxIDguMTEtNi45OSAxMS4yNi0xMC4xMjUgNC45MS00LjkwNyA3LjQ2LTguMjYgOS4yOC0xMi4xODcgMS40My0zLjA5MiAyLjIyLTYuMTY2IDIuNDYtOS41MzIgMC4wNi0wLjgxNiAwLjA3LTMuMDMgMC0zLjk2OC0wLjQ1LTcuMDQzLTMuMS0xMy4yNTMtOC4xNS0xOS4wMzItMC44LTAuOTA5LTIuNzgtMi44ODctMy43Mi0zLjcxOC00Ljk2LTQuMzk0LTEwLjY5LTcuMzUzLTE3LjU2LTkuMDk0LTQuMTktMS4wNjItOC4yMy0xLjYtMTMuMzUtMS43NS0wLjc4LTAuMDIzLTEuNTktMC4wMzYtMi4zNy0wLjAzMnptLTEwLjkwOCAxMDMuNnYyMmgyMS45OTh2LTIyaC0yMS45OTh6Ii8+CiA8L2c+Cjwvc3ZnPgo=',$this->object->getIcon());
$this->object->setDataValue('email', '[email protected]');
$this->assertEquals('http://www.gravatar.com/avatar/f00226a1c6fe891010a2543531ed432c?s=800&d=mm&r=g', $this->object->getIcon());
}
Expand Down

0 comments on commit 5893a14

Please sign in to comment.