UserDependencyProvider::addGroupPlugin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of the Spryker Commerce OS.
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types = 1);
9
10
namespace Pyz\Zed\User;
11
12
use Spryker\Zed\Acl\Communication\Plugin\GroupPlugin;
13
use Spryker\Zed\AgentGui\Communication\Plugin\UserAgentFormExpanderPlugin;
14
use Spryker\Zed\AgentGui\Communication\Plugin\UserAgentTableConfigExpanderPlugin;
15
use Spryker\Zed\AgentGui\Communication\Plugin\UserAgentTableDataExpanderPlugin;
16
use Spryker\Zed\CustomerUserConnectorGui\Communication\Plugin\UserTableActionExpanderPlugin;
17
use Spryker\Zed\Kernel\Container;
18
use Spryker\Zed\User\UserDependencyProvider as SprykerUserDependencyProvider;
19
use Spryker\Zed\UserLocale\Communication\Plugin\User\AssignUserLocalePreSavePlugin;
20
use Spryker\Zed\UserLocale\Communication\Plugin\User\UserLocaleTransferExpanderPlugin;
21
use Spryker\Zed\UserLocaleGui\Communication\Plugin\UserLocaleFormExpanderPlugin;
22
23
class UserDependencyProvider extends SprykerUserDependencyProvider
24
{
25
    protected function addGroupPlugin(Container $container): Container
26
    {
27
        $container->set(static::PLUGIN_GROUP, function (Container $container) { // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter
0 ignored issues
show
Unused Code introduced by
The parameter $container is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

27
        $container->set(static::PLUGIN_GROUP, function (/** @scrutinizer ignore-unused */ Container $container) { // phpcs:ignore SlevomatCodingStandard.Functions.UnusedParameter

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
            return new GroupPlugin();
29
        });
30
31
        return $container;
32
    }
33
34
    /**
35
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableActionExpanderPluginInterface>
36
     */
37
    protected function getUserTableActionExpanderPlugins(): array
38
    {
39
        return [
40
            new UserTableActionExpanderPlugin(),
41
        ];
42
    }
43
44
    /**
45
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserFormExpanderPluginInterface>
46
     */
47
    protected function getUserFormExpanderPlugins(): array
48
    {
49
        return [
50
            new UserAgentFormExpanderPlugin(),
51
            new UserLocaleFormExpanderPlugin(),
52
        ];
53
    }
54
55
    /**
56
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableConfigExpanderPluginInterface>
57
     */
58
    protected function getUserTableConfigExpanderPlugins(): array
59
    {
60
        return [
61
            new UserAgentTableConfigExpanderPlugin(),
62
        ];
63
    }
64
65
    /**
66
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTableDataExpanderPluginInterface>
67
     */
68
    protected function getUserTableDataExpanderPlugins(): array
69
    {
70
        return [
71
            new UserAgentTableDataExpanderPlugin(),
72
        ];
73
    }
74
75
    /**
76
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserPreSavePluginInterface>
77
     */
78
    protected function getUserPreSavePlugins(): array
79
    {
80
        return [
81
            new AssignUserLocalePreSavePlugin(),
82
        ];
83
    }
84
85
    /**
86
     * @return array<\Spryker\Zed\UserExtension\Dependency\Plugin\UserTransferExpanderPluginInterface>
87
     */
88
    protected function getUserTransferExpanderPlugins(): array
89
    {
90
        return [
0 ignored issues
show
Bug Best Practice introduced by
The expression return array(new Spryker...ansferExpanderPlugin()) returns the type array<integer,Spryker\Ze...TransferExpanderPlugin> which is incompatible with the return type mandated by Spryker\Zed\User\UserDep...ansferExpanderPlugins() of Spryker\Zed\UserExtensio...reSavePluginInterface[].

In the issue above, the returned value is violating the contract defined by the mentioned interface.

Let's take a look at an example:

interface HasName {
    /** @return string */
    public function getName();
}

class Name {
    public $name;
}

class User implements HasName {
    /** @return string|Name */
    public function getName() {
        return new Name('foo'); // This is a violation of the ``HasName`` interface
                                // which only allows a string value to be returned.
    }
}
Loading history...
91
            new UserLocaleTransferExpanderPlugin(),
0 ignored issues
show
Deprecated Code introduced by
The class Spryker\Zed\UserLocale\C...eTransferExpanderPlugin has been deprecated: Use {@link \Spryker\Zed\UserLocale\Communication\Plugin\User\LocaleUserExpanderPlugin} instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

91
            /** @scrutinizer ignore-deprecated */ new UserLocaleTransferExpanderPlugin(),
Loading history...
92
        ];
93
    }
94
}
95