Skip to content

Commit

Permalink
fix: More folder structure changes for validator and update code and …
Browse files Browse the repository at this point in the history
…config for PHP-CS 3.0

Signed-off-by: Michel Mendiola <[email protected]>
  • Loading branch information
MissAllSunday committed May 6, 2021
1 parent 1521419 commit e294767
Show file tree
Hide file tree
Showing 93 changed files with 522 additions and 355 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Thumbs.db
# Dev stuff
.php_cs.cache
.php_cs
.php-cs-fixer.dist.php
phpunit.xml
/vendor
/breezeVendor
26 changes: 16 additions & 10 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@
->in(__DIR__ . '/Sources/Breeze/')
->in(__DIR__ . '/tests/');

return PhpCsFixer\Config::create()
$config = new PhpCsFixer\Config();

return $config
->setRules([
'@PHP71Migration:risky' => true,
'@PHP74Migration' => true,
'@PHPUnit60Migration:risky' => true,
'indentation_type' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_opening_tag' => true,
'concat_space' => ['spacing' => 'one'],
'class_attributes_separation' => ['elements' => ['method', 'property']],
'class_attributes_separation' => ['elements' => ['const' => 'one', 'method' => 'one', 'property' => 'one']],
'declare_strict_types' => true,
'increment_style' => ['style' => 'post'],
'is_null' => ['use_yoda_style' => false],
'is_null' => true,
'list_syntax' => ['syntax' => 'short'],
'blank_line_after_namespace' => true,
'blank_line_before_return' => true,
'blank_line_before_statement' => true,
'method_chaining_indentation' => true,
'modernize_types_casting' => true,
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => false,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_useless_else' => true,
Expand All @@ -43,12 +45,16 @@
'encoding' => true,
'line_ending' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'native_constant_invocation' => false,
'method_argument_space' => ['ensure_fully_multiline' => true],
'method_argument_space' => ['after_heredoc' => true],
'constant_case' => true,
'lowercase_keywords' => true,
'visibility_required' => true,
'native_constant_invocation' => true,
'no_unneeded_curly_braces' => true,
'function_declaration' => true,
])
->setIndent("\t")
->setLineEnding("\n")
->setFinder($finder)
->setUsingCache(true)
->setRiskyAllowed(true);
->setRiskyAllowed(true);
13 changes: 9 additions & 4 deletions Sources/Breeze/Breeze.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ class Breeze
use TextTrait;

public const NAME = 'Breeze';

public const VERSION = '2.0';

public const PATTERN = self::NAME . '_';

public const FEED = 'https://api.github.com/repos/MissAllSunday/Breeze/releases';

public const SUPPORT_URL = 'https://missallsunday.com';

public const VUE_VERSION = '2.5.16';

protected Container $container;
Expand Down Expand Up @@ -126,10 +131,10 @@ public function profileMenuWrapper(array &$profileAreas): void
'subsections' => [
'settings' => [
$this->getText('user_settings_name_alerts_settings'),
['is_not_guest', 'profile_view']],
['is_not_guest', 'profile_view'], ],
'edit' => [
$this->getText('user_settings_name_alerts_edit'),
['is_not_guest', 'profile_view']],
['is_not_guest', 'profile_view'], ],
],
'permission' => [
'own' => 'is_not_guest',
Expand Down Expand Up @@ -276,13 +281,13 @@ public function adminMenuWrapper(array &$adminMenu): void

if ($this->isEnable(SettingsEntity::ENABLE_MOOD)) {
$adminMenu['config']['areas'][AdminService::AREA]['subsections']['moodList'] = [
$this->getText(AdminService::AREA . '_moodList_title')
$this->getText(AdminService::AREA . '_moodList_title'),
];
}

// Pay no attention to that woman behind the curtain!
$adminMenu['config']['areas'][AdminService::AREA]['subsections']['donate'] = [
$this->getText(AdminService::AREA . '_donate_title')
$this->getText(AdminService::AREA . '_donate_title'),
];
}

Expand Down
7 changes: 4 additions & 3 deletions Sources/Breeze/Config/MapperAggregate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

class MapperAggregate
{
const MAPPERS_FOLDER = __DIR__ . '/Mappers';
const MAPPER_KEY = 'Mapper';
public const MAPPERS_FOLDER = __DIR__ . '/Mappers';

public const MAPPER_KEY = 'Mapper';

protected array $mappers = [];

Expand All @@ -18,7 +19,7 @@ public function getMappers(): array
$scannedMappers = Folder::getFilesInFolder(self::MAPPERS_FOLDER);

foreach ($scannedMappers as $mapperFile) {
$mapperFileInfo = pathinfo($mapperFile, PATHINFO_FILENAME);
$mapperFileInfo = pathinfo($mapperFile, \PATHINFO_FILENAME);
$mapperKey = str_replace(self::MAPPER_KEY, '', $mapperFileInfo);

$this->mappers[$mapperKey] = include(self::MAPPERS_FOLDER . '/' . $mapperFile);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Breeze/Config/Mappers/ClientMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
return [
'client.db' => [
'class' => DatabaseClient::class,
]
],
];
24 changes: 12 additions & 12 deletions Sources/Breeze/Config/Mappers/ControllersMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,54 +28,54 @@
'arguments'=> [
AdminService::class,
MoodService::class,
]
],
],
'controller.wall' => [
'class' => WallController::class,
'arguments'=> [
WallService::class,
UserService::class
]
UserService::class,
],
],
'controller.status' => [
'class' => StatusController::class,
'arguments'=> [
StatusService::class,
UserService::class,
ValidateGateway::class
]
ValidateGateway::class,
],
],
'controller.comment' => [
'class' => CommentController::class,
'arguments'=> [
CommentService::class,
StatusService::class,
UserService::class,
ValidateGateway::class
]
ValidateGateway::class,
],
],
'controller.user.alerts' => [
'class' => AlertsController::class,
'arguments'=> [
UserService::class,
]
],
],
'controller.user.settings' => [
'class' => UserSettingsController::class,
'arguments'=> [
UserSettingsService::class,
UserService::class,
UserSettingsBuilder::class,
ValidateGateway::class
]
ValidateGateway::class,
],
],
'controller.mood' => [
'class' => MoodController::class,
'arguments'=> [
UserService::class,
UserSettingsService::class,
MoodService::class,
ValidateGateway::class
]
ValidateGateway::class,
],
],
];
18 changes: 9 additions & 9 deletions Sources/Breeze/Config/Mappers/ModelsMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@
return [
'model.mood' => [
'class' => MoodModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.alert' => [
'class' => AlertModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.comment' => [
'class' => CommentModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.like' => [
'class' => LikeModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.log' => [
'class' => LogModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.mention' => [
'class' => MentionModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.notification' => [
'class' => NotificationModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.status' => [
'class' => StatusModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
'model.user' => [
'class' => UserModel::class,
'arguments'=> [DatabaseClient::class]
'arguments'=> [DatabaseClient::class],
],
];
8 changes: 4 additions & 4 deletions Sources/Breeze/Config/Mappers/RepositoriesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
return [
'repo.user.mood' => [
'class' => MoodRepository::class,
'arguments'=> [MoodModel::class]
'arguments'=> [MoodModel::class],
],
'repo.user' => [
'class' => UserRepository::class,
'arguments'=> [UserModel::class]
'arguments'=> [UserModel::class],
],
'repo.status' => [
'class' => StatusRepository::class,
'arguments'=> [StatusModel::class, CommentRepository::class]
'arguments'=> [StatusModel::class, CommentRepository::class],
],
'repo.comment' => [
'class' => CommentRepository::class,
'arguments'=> [CommentModel::class]
'arguments'=> [CommentModel::class],
],
];
16 changes: 8 additions & 8 deletions Sources/Breeze/Config/Mappers/ServicesMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@
return [
'service.mood' => [
'class' => MoodService::class,
'arguments'=> [MoodRepository::class, UserRepository::class, Components::class]
'arguments'=> [MoodRepository::class, UserRepository::class, Components::class],
],
'service.admin' => [
'class' => AdminService::class,
'arguments'=> [SettingsBuilder::class, Components::class]
'arguments'=> [SettingsBuilder::class, Components::class],
],
'service.user' => [
'class' => UserService::class,
'arguments'=> [UserRepository::class]
'arguments'=> [UserRepository::class],
],
'service.user.settings' => [
'class' => UserSettingsService::class,
'arguments'=> [
UserRepository::class,
Components::class,
UserSettingsBuilder::class]
UserSettingsBuilder::class, ],
],
'service.permissions' => [
'class' => PermissionsService::class,
Expand All @@ -51,18 +51,18 @@
UserService::class,
StatusRepository::class,
CommentRepository::class,
Components::class]
Components::class, ],
],
'service.status' => [
'class' => StatusService::class,
'arguments'=> [UserService::class, StatusRepository::class, CommentRepository::class]
'arguments'=> [UserService::class, StatusRepository::class, CommentRepository::class],
],
'service.comment' => [
'class' => CommentService::class,
'arguments'=> [UserService::class, StatusRepository::class, CommentRepository::class]
'arguments'=> [UserService::class, StatusRepository::class, CommentRepository::class],
],
'service.validate' => [
'class' => ValidateService::class,
'arguments'=> [UserService::class]
'arguments'=> [UserService::class],
],
];
18 changes: 9 additions & 9 deletions Sources/Breeze/Config/Mappers/UtilMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@

return [
'util.folder' => [
'class' => Folder::class
'class' => Folder::class,
],
'util.components' => [
'class' => Components::class
'class' => Components::class,
],
'util.UserSettingsBuilder' => [
'class' => UserSettingsBuilder::class
'class' => UserSettingsBuilder::class,
],
'util.SettingsBuilder' => [
'class' => SettingsBuilder::class
'class' => SettingsBuilder::class,
],
'util.formatter.check' => [
'class' => CheckType::class
'class' => CheckType::class,
],
'util.formatter.int' => [
'class' => IntType::class
'class' => IntType::class,
],
'util.formatter.select' => [
'class' => SelectType::class
'class' => SelectType::class,
],
'util.formatter.text' => [
'class' => TextType::class
'class' => TextType::class,
],
'util.validate.gateway' => [
'class' => ValidateGateway::class,
'arguments'=> [UserService::class]
'arguments'=> [UserService::class],
],
];
2 changes: 2 additions & 0 deletions Sources/Breeze/Controller/API/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
class CommentController extends ApiBaseController implements ApiBaseInterface
{
public const ACTION_POST_COMMENT = 'postComment';

public const ACTION_DELETE = 'deleteComment';

public const SUB_ACTIONS = [
self::ACTION_POST_COMMENT,
self::ACTION_DELETE,
Expand Down
6 changes: 6 additions & 0 deletions Sources/Breeze/Controller/API/MoodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@
class MoodController extends ApiBaseController implements ApiBaseInterface
{
public const ACTION_POST = 'createMood';

public const ACTION_DELETE = 'deleteMood';

public const ACTION_PATCH = 'editMood';

public const ACTION_ACTIVE = 'getActiveMoods';

public const ACTION_USER_SET = 'setUserMood';

public const ACTION_ALL = 'getAllMoods';

public const SUB_ACTIONS = [
self::ACTION_POST,
self::ACTION_DELETE,
Expand Down
Loading

0 comments on commit e294767

Please sign in to comment.