• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aimeos / aimeos-core / 69437571-b082-4b11-ac5a-25c958bba87a

06 Aug 2024 10:26AM UTC coverage: 91.754%. Remained the same
69437571-b082-4b11-ac5a-25c958bba87a

push

circleci

aimeos
Removed @category tags from config documentation

11005 of 11994 relevant lines covered (91.75%)

55.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/MAdmin/Common/Factory/Base.php
1
<?php
2

3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2014
6
 * @copyright Aimeos (aimeos.org), 2015-2024
7
 * @package MAdmin
8
 * @subpackage Common
9
 */
10

11

12
namespace Aimeos\MAdmin\Common\Factory;
13

14

15
/**
16
 * Common methods for all factories.
17
 *
18
 * @package MShop
19
 * @subpackage Common
20
 */
21
abstract class Base
22
        extends \Aimeos\MShop\Common\Factory\Base
23
{
24
        /**
25
         * Adds the decorators to the manager object.
26
         *
27
         * @param \Aimeos\MShop\ContextIface $context Context instance with necessary objects
28
         * @param \Aimeos\MShop\Common\Manager\Iface $manager Manager object
29
         * @param string $domain Domain name in lower case, e.g. "product"
30
         * @return \Aimeos\MShop\Common\Manager\Iface Manager object
31
         */
32
        protected static function addManagerDecorators( \Aimeos\MShop\ContextIface $context,
33
                \Aimeos\MShop\Common\Manager\Iface $manager, string $domain ) : \Aimeos\MShop\Common\Manager\Iface
34
        {
35
                $config = $context->config();
×
36

37
                /** madmin/common/manager/decorators/default
38
                 * Configures the list of decorators applied to all admin managers
39
                 *
40
                 * Decorators extend the functionality of a class by adding new aspects
41
                 * (e.g. log what is currently done), executing the methods of the underlying
42
                 * class only in certain conditions (e.g. only for logged in users) or
43
                 * modify what is returned to the caller.
44
                 *
45
                 * This option allows you to configure a list of decorator names that should
46
                 * be wrapped around the original instances of all created managers:
47
                 *
48
                 *  madmin/common/manager/decorators/default = array( 'decorator1', 'decorator2' )
49
                 *
50
                 * This would wrap the decorators named "decorator1" and "decorator2" around
51
                 * all controller instances in that order. The decorator classes would be
52
                 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator1" and
53
                 * "\Aimeos\MShop\Common\Manager\Decorator\Decorator2".
54
                 *
55
                 * @param array List of decorator names
56
                 * @since 2014.03
57
                 */
58
                $decorators = $config->get( 'madmin/common/manager/decorators/default', [] );
×
59
                $excludes = $config->get( 'madmin/' . $domain . '/manager/decorators/excludes', [] );
×
60

61
                foreach( $decorators as $key => $name )
×
62
                {
63
                        if( in_array( $name, $excludes ) ) {
×
64
                                unset( $decorators[$key] );
×
65
                        }
66
                }
67

68
                $classprefix = '\Aimeos\MShop\Common\Manager\Decorator\\';
×
69
                $manager = self::addDecorators( $context, $manager, $decorators, $classprefix );
×
70

71
                $classprefix = '\Aimeos\MShop\Common\Manager\Decorator\\';
×
72
                $decorators = $config->get( 'madmin/' . $domain . '/manager/decorators/global', [] );
×
73
                $manager = self::addDecorators( $context, $manager, $decorators, $classprefix );
×
74

75
                $classprefix = '\Aimeos\MShop\\' . ucfirst( $domain ) . '\Manager\Decorator\\';
×
76
                $decorators = $config->get( 'madmin/' . $domain . '/manager/decorators/local', [] );
×
77
                $manager = self::addDecorators( $context, $manager, $decorators, $classprefix );
×
78

79
                return $manager;
×
80
        }
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc