Skip to content

Commit

Permalink
Fixed cs
Browse files Browse the repository at this point in the history
  • Loading branch information
damianz5 committed Oct 8, 2021
1 parent 2e3664e commit 43a2b18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions src/lib/Configuration/Provider/CKEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getName(): string
public function getConfiguration(): array
{
return [
'toolbar' => \array_values($this->getToolbar()),
'toolbar' => array_values($this->getToolbar()),
];
}

Expand All @@ -66,7 +66,7 @@ private function getToolbar(): array
$this->getSiteAccessConfigArray(RichText::TOOLBARS_SA_SETTINGS_ID)
);

if (\in_array(self::CUSTOM_STYLE_INLINE, $filteredButtons) && !$this->hasInlineCustomStyles()) {
if (in_array(self::CUSTOM_STYLE_INLINE, $filteredButtons) && !$this->hasInlineCustomStyles()) {
return $this->removeInlineCustomStyleButton($filteredButtons);
}

Expand All @@ -83,29 +83,29 @@ private function filterButtonsByGroups(
): array {
$buttons = [];

$groupsConfiguration = \array_filter(
$groupsConfiguration = array_filter(
$groupsConfiguration,
static function (array $group): bool {
return $group['visible'];
}
);

\uasort($groupsConfiguration, static function (array $a, array $b): int {
uasort($groupsConfiguration, static function (array $a, array $b): int {
return $b['priority'] <=> $a['priority'];
});

foreach ($groupsConfiguration as $configuration) {
$filteredButtons = $this->filterButtons($configuration['buttons'] ?? []);

if (\count($filteredButtons) === 0) {
if (count($filteredButtons) === 0) {
continue;
}

$buttons = \array_merge($buttons, $filteredButtons, [self::SEPARATOR]);
$buttons = array_merge($buttons, $filteredButtons, [self::SEPARATOR]);
}

// Removes last separator from the buttons list.
\array_pop($buttons);
array_pop($buttons);

return $buttons;
}
Expand All @@ -117,25 +117,25 @@ static function (array $group): bool {
*/
private function filterButtons(array $buttons): array
{
$buttons = \array_filter($buttons, static function (array $button): bool {
$buttons = array_filter($buttons, static function (array $button): bool {
return $button['visible'];
});

\uasort($buttons, static function (array $a, array $b): int {
uasort($buttons, static function (array $a, array $b): int {
return $b['priority'] <=> $a['priority'];
});

return \array_keys($buttons);
return array_keys($buttons);
}

private function hasInlineCustomStyles(): bool
{
$enabledCustomStyles = $this->getSiteAccessConfigArray('fieldtypes.ezrichtext.custom_styles');

return 0 !== \count(\array_filter(
return 0 !== count(array_filter(
$this->customStylesConfiguration,
static function (array $customStyle, string $name) use ($enabledCustomStyles): bool {
return \in_array($name, $enabledCustomStyles, true) && $customStyle['inline'];
return in_array($name, $enabledCustomStyles, true) && $customStyle['inline'];
},
ARRAY_FILTER_USE_BOTH
));
Expand All @@ -146,7 +146,7 @@ static function (array $customStyle, string $name) use ($enabledCustomStyles): b
*/
private function removeInlineCustomStyleButton(array $filteredButtons): array
{
return \array_filter(
return array_filter(
$filteredButtons,
static function (string $buttonValue): bool {
return $buttonValue !== self::CUSTOM_STYLE_INLINE;
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/Configuration/Provider/CKEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testGetConfiguration(): void
$provider = $this->createProvider();

$this->configResolver
->expects($this->exactly(1))
->expects(self::once())
->method('hasParameter')
->willReturn(false);

Expand Down

0 comments on commit 43a2b18

Please sign in to comment.