Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Fix Lint
  • Loading branch information
NaysKutzu committed Jul 25, 2024
1 parent c76907f commit d180de4
Show file tree
Hide file tree
Showing 80 changed files with 1,194 additions and 1,359 deletions.
25 changes: 2 additions & 23 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]

permissions:
contents: read

jobs:
lint:
name: Lint
Expand All @@ -25,25 +25,4 @@ jobs:
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist

- name: PHP CS Fixer (APP)
run: vendor/bin/php-cs-fixer fix app --dry-run

- name: PHP CS Fixer (Tests)
run: vendor/bin/php-cs-fixer fix tests --dry-run
- name: PHP CS Fixer (Routes)
run: vendor/bin/php-cs-fixer fix routes --dry-run
- name: PHP CS Fixer (Lang)
run: vendor/bin/php-cs-fixer fix lang --dry-run
- name: PHP CS Fixer (Cron)
run: vendor/bin/php-cs-fixer fix lang --dry-run
- name: PHP CS Fixer (API)
run: vendor/bin/php-cs-fixer fix api --dry-run
- name: PHP CS Fixer (Addons)
run: vendor/bin/php-cs-fixer fix addons --dry-run
- name: PHP CS Fixer (Commands)
run: vendor/bin/php-cs-fixer fix commands --dry-run
- name: PHP CS Fixer (Install)
run: vendor/bin/php-cs-fixer fix install --dry-run
- name: PHP CS Fixer (Public)
run: vendor/bin/php-cs-fixer fix public --dry-run
- name: PHP CS Fixer (Migrate)
run: vendor/bin/php-cs-fixer fix migrate --dry-run
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php
69 changes: 69 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php
try {
if (file_exists('vendor/autoload.php')) {
require('vendor/autoload.php');
} else {
die('Hello, it looks like you did not run: "composer install --no-dev --optimize-autoloader". Please run that and refresh the page');
}
} catch (Exception $e) {
die('Hello, it looks like you did not run: composer install --no-dev --optimize-autoloader Please run that and refresh');
}


use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = (new Finder())
->in(__DIR__)
->exclude([
'vendor',
'node_modules',
'.github',
'.vscode',
'.git',
'docs',
'caches',
'devtools',
'logs',
'themes',
'app/Handlers/interfaces'
])
->notName(['_ide_helper*']);

return (new Config())
->setRiskyAllowed(true)
->setFinder($finder)
->setRules([
'@Symfony' => true,
'@PSR1' => true,
'@PSR2' => true,
'@PSR12' => true,
'align_multiline_comment' => ['comment_type' => 'phpdocs_like'],
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'heredoc_to_nowdoc' => true,
'no_alias_functions' => true,
'no_unreachable_default_argument_value' => true,
'no_useless_return' => true,
'ordered_imports' => [
'sort_algorithm' => 'length',
],
'phpdoc_align' => [
'align' => 'left',
'tags' => [
'param',
'property',
'return',
'throws',
'type',
'var',
],
],
'random_api_migration' => true,
'ternary_to_null_coalescing' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
]);
2 changes: 0 additions & 2 deletions addons/Example/Example.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?php


class Example
{
public function Main(array $args = [])
{

}
}
5 changes: 2 additions & 3 deletions api/System/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

api::init();


if ($_SERVER['REQUEST_METHOD'] === 'GET') {
api::OK("Showing you latest logs", [
"logs" => Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER, 10)
api::OK('Showing you latest logs', [
'logs' => Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER, 10),
]);
}
3 changes: 0 additions & 3 deletions api/User/login.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?php


use MythicalSystems\Api\Api as api;
use MythicalSystemsFramework\Managers\ConfigManager as cfg;

api::init();
api::allowOnlyPOST();

if (isset($_POST['email']) && isset($_POST['password'])) {

}
69 changes: 1 addition & 68 deletions app/Cli/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,161 +4,101 @@

class Colors
{
/**
* @return string
*/
public static function Black(): string
{
return "\033[0;30m";
}

/**
* @return string
*/
public static function DarkBlue(): string
{
return "\033[0;34m";
}

/**
* @return string
*/
public static function DarkGreen(): string
{
return "\033[0;32m";
}

/**
* @return string
*/
public static function DarkAqua(): string
{
return "\033[0;36m";
}

/**
* @return string
*/
public static function DarkRed(): string
{
return "\033[0;31m";
}

/**
* @return string
*/
public static function DarkPurple(): string
{
return "\033[0;35m";
}

/**
* @return string
*/
public static function Gold(): string
{
return "\033[0;33m";
}

/**
* @return string
*/
public static function Gray(): string
{
return "\033[0;37m";
}

/**
* @return string
*/
public static function DarkGray(): string
{
return "\033[1;30m";
}

/**
* @return string
*/
public static function Blue(): string
{
return "\033[1;34m";
}

/**
* @return string
*/
public static function Green(): string
{
return "\033[1;32m";
}

/**
* @return string
*/
public static function Aqua(): string
{
return "\033[1;36m";
}

/**
* @return string
*/
public static function Red(): string
{
return "\033[1;31m";
}

/**
* @return string
*/
public static function LightPurple(): string
{
return "\033[1;35m";
}

/**
* @return string
*/
public static function Yellow(): string
{
return "\033[1;33m";
}

/**
* @return string
*/
public static function White(): string
{
return "\033[1;37m";
}

/**
* @return string
*/
public static function Reset(): string
{
return "\033[0m";
}

/**
* @return string
*/
public static function Bold(): string
{
return "\033[1m";
}

/**
* @return string
*/
public static function Strike(): string
{
return "\033[9m";
}

/**
* @return string
*/
public static function Underline(): string
{
return "\033[4m";
Expand All @@ -169,23 +109,16 @@ public static function NewLine(): string
return "\n";
}

/**
* @param string $message
* @return string
*/
public static function translateColorsCode(string $message): string
{
$pattern = '/&([0-9a-fklmnor])/i';
$message = preg_replace_callback($pattern, function ($matches) {
return self::getColorCode($matches[1]);
}, $message);

return $message;
}

/**
* @param string $colorCode
* @return string
*/
private static function getColorCode(string $colorCode): string
{
switch ($colorCode) {
Expand Down
2 changes: 1 addition & 1 deletion app/Cli/Commands/Colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Colors extends Command

public static function execute(bool $isFrameworkCommand = false): void
{
$colors = "Colors: &0Black&r, &1Dark Blue&r, &2Dark Green&r, &3Dark Aqua&r, &4Dark Red&r, &5Dark Purple&r, &6Gold&r, &7Gray&r, &8Dark Gray&r, &9Blue&r, &aGreen&r, &bAqua&r, &cRed&r, &dLight Purple&r, &eYellow&r, &fWhite&r, &rReset&r, &lBold&r, &nUnderline&r, &mStrikethrough&r";
$colors = 'Colors: &0Black&r, &1Dark Blue&r, &2Dark Green&r, &3Dark Aqua&r, &4Dark Red&r, &5Dark Purple&r, &6Gold&r, &7Gray&r, &8Dark Gray&r, &9Blue&r, &aGreen&r, &bAqua&r, &cRed&r, &dLight Purple&r, &eYellow&r, &fWhite&r, &rReset&r, &lBold&r, &nUnderline&r, &mStrikethrough&r';
echo self::translateColorsCode($colors);
echo PHP_EOL;
echo str_replace('&r', '', $colors);
Expand Down
Loading

0 comments on commit d180de4

Please sign in to comment.