Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
idmarinas committed Nov 9, 2023
1 parent 7d900ab commit 3f7ae6a
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/core/Fixed/Doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Doctrine\ORM\QueryBuilder;
use LotgdResponse;
use Doctrine\ORM\Tools\SchemaTool;
use function class_alias;

/**
* @method static Expr getExpressionBuilder()
Expand Down
3 changes: 2 additions & 1 deletion src/core/Fixed/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Lotgd\Core\Fixed;

use Symfony\Contracts\EventDispatcher\Event;
use function class_alias;

/**
* @method static Event dispatch($event, string $eventName = null)
Expand All @@ -23,4 +24,4 @@ class EventDispatcher
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\EventDispatcher', 'LotgdEventDispatcher', false);
class_alias('Lotgd\Core\Fixed\EventDispatcher', 'LotgdEventDispatcher', false);
14 changes: 8 additions & 6 deletions src/core/Fixed/FlashMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

class FlashMessages
{
use StaticTrait;
Expand All @@ -23,7 +25,7 @@ class FlashMessages
* @param array|string $message
* @param string $type
*/
public static function addMessage($message, $type = null)
public static function addMessage($message, string $type = null): void
{
$type = $type ?: 'info';

Expand All @@ -37,7 +39,7 @@ public static function addMessage($message, $type = null)
*
* @return FlashMessages
*/
public static function addInfoMessage($message)
public static function addInfoMessage($message): void
{
self::$instance->add('info', $message);
}
Expand All @@ -49,7 +51,7 @@ public static function addInfoMessage($message)
*
* @return FlashMessages
*/
public static function addSuccessMessage($message)
public static function addSuccessMessage($message): void
{
self::$instance->add('success', $message);
}
Expand All @@ -61,7 +63,7 @@ public static function addSuccessMessage($message)
*
* @return FlashMessages
*/
public static function addErrorMessage($message)
public static function addErrorMessage($message): void
{
self::$instance->add('error', $message);
}
Expand All @@ -73,10 +75,10 @@ public static function addErrorMessage($message)
*
* @return FlashMessages
*/
public static function addWarningMessage($message)
public static function addWarningMessage($message): void
{
self::$instance->add('warning', $message);
}
}

\class_alias('Lotgd\Core\Fixed\FlashMessages', 'LotgdFlashMessages', false);
class_alias('Lotgd\Core\Fixed\FlashMessages', 'LotgdFlashMessages', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* This class is for format a string
* For example: format a number or a date.
Expand All @@ -27,4 +29,4 @@ class Format
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Format', 'LotgdFormat', false);
class_alias('Lotgd\Core\Fixed\Format', 'LotgdFormat', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

class Kernel
{
use StaticTrait;
Expand Down Expand Up @@ -42,4 +44,4 @@ public static function getInstance()
}
}

\class_alias('Lotgd\Core\Fixed\Kernel', 'LotgdKernel', false);
class_alias('Lotgd\Core\Fixed\Kernel', 'LotgdKernel', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static void game(string $message, string $category = 'general', bool $filed = false)
* @method static void debug(string $message, ?int $target = null, ?int $user = null, ?string $field = null, ?int $value = null, bool $consolidate = true)
Expand All @@ -22,4 +24,4 @@ class Log
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Log', 'LotgdLog', false);
class_alias('Lotgd\Core\Fixed\Log', 'LotgdLog', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static $this addNav(?string $label, ?string $link = null, array $options = [])
* @method static $this addNavNotl(?string $label, ?string $link = null, array $options = [])
Expand All @@ -32,4 +34,4 @@ class Navigation
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Navigation', 'LotgdNavigation', false);
class_alias('Lotgd\Core\Fixed\Navigation', 'LotgdNavigation', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static mixed getQuery($name, $default = null)
* @method static mixed getPost($name, $default = null)
Expand All @@ -22,4 +24,4 @@ class Request
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Request', 'LotgdRequest', false);
class_alias('Lotgd\Core\Fixed\Request', 'LotgdRequest', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static void pageStart($title = null, $parameters = [], $textDomain = null, $locale = null)
* @method static void pageTitle($message, $parameters = [], $textDomain = null, $locale = null)
Expand All @@ -24,4 +26,4 @@ class Response
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Response', 'LotgdResponse', false);
class_alias('Lotgd\Core\Fixed\Response', 'LotgdResponse', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Sanitize.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* This class is for sanitize a string
* For example: sanitize a number or a date.
Expand All @@ -31,4 +33,4 @@ class Sanitize
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Sanitize', 'LotgdSanitize', false);
class_alias('Lotgd\Core\Fixed\Sanitize', 'LotgdSanitize', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

class Session
{
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Session', 'LotgdSession', false);
class_alias('Lotgd\Core\Fixed\Session', 'LotgdSession', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static mixed getSetting($settingname, $default = null)
* @method static bool saveSetting(string $settingname, $value)
Expand All @@ -22,4 +24,4 @@ class Setting
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Setting', 'LotgdSetting', false);
class_alias('Lotgd\Core\Fixed\Setting', 'LotgdSetting', false);
6 changes: 5 additions & 1 deletion src/core/Fixed/StaticTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
namespace Lotgd\Core\Fixed;

use BadMethodCallException;
use function get_class_methods;
use function implode;
use function method_exists;

trait StaticTrait
{
/**
Expand All @@ -38,7 +42,7 @@ public static function __callStatic($method, $arguments)

$methods = implode(', ', get_class_methods(self::$instance));

throw new BadMethodCallException("Undefined method '{$method}'. The method name must be one of '{$methods}'");
throw new BadMethodCallException("Undefined method '$method'. The method name must be one of '$methods'");
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/core/Fixed/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static string render($name, array $context = [])
* @method static void display($name, array $context = [])
Expand All @@ -23,4 +25,4 @@ class Theme
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Theme', 'LotgdTheme', false);
class_alias('Lotgd\Core\Fixed\Theme', 'LotgdTheme', false);
4 changes: 3 additions & 1 deletion src/core/Fixed/Tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace Lotgd\Core\Fixed;

use function class_alias;

/**
* @method static void addNews(string $text, array $params = [], string $textDomain = 'partial_news', bool $hideFromBio = false)
* @method static int expForNextLevel(int $curlevel, int $curdk)
Expand All @@ -35,4 +37,4 @@ class Tool
use StaticTrait;
}

\class_alias('Lotgd\Core\Fixed\Tool', 'LotgdTool', false);
class_alias('Lotgd\Core\Fixed\Tool', 'LotgdTool', false);
12 changes: 8 additions & 4 deletions src/core/Fixed/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
namespace Lotgd\Core\Fixed;

use BadMethodCallException;
use function class_alias;
use function get_class_methods;
use function implode;
use function method_exists;

/**
* @method static string t($id, array $parameters = [], $domain = null, $locale = null)
Expand All @@ -33,7 +37,7 @@ class Translator
*/
public static function __callStatic($method, $arguments)
{
if (\method_exists(self::$instance, $method))
if (method_exists(self::$instance, $method))
{
return self::$instance->{$method}(...$arguments);
}
Expand All @@ -43,10 +47,10 @@ public static function __callStatic($method, $arguments)
return self::$instance->trans(...$arguments);
}

$methods = \implode(', ', \get_class_methods(self::$instance));
$methods = implode(', ', get_class_methods(self::$instance));

throw new BadMethodCallException("Undefined method '{$method}'. The method name must be one of '{$methods}'");
throw new BadMethodCallException("Undefined method '$method'. The method name must be one of '$methods'");
}
}

\class_alias('Lotgd\Core\Fixed\Translator', 'LotgdTranslator', false);
class_alias('Lotgd\Core\Fixed\Translator', 'LotgdTranslator', false);

0 comments on commit 3f7ae6a

Please sign in to comment.