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

aimeos / aimeos-core / 4f8b7e8d-5595-43b2-ba5c-df9921830178

17 May 2026 07:32AM UTC coverage: 92.581%. Remained the same
4f8b7e8d-5595-43b2-ba5c-df9921830178

push

circleci

aimeos
Fixed PHPStan issues

896 of 980 new or added lines in 165 files covered. (91.43%)

35 existing lines in 29 files now uncovered.

9734 of 10514 relevant lines covered (92.58%)

80.53 hits per line

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

84.0
/src/MShop/Context.php
1
<?php
2

3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2015-2026
6
 * @package MShop
7
 */
8

9

10
namespace Aimeos\MShop;
11

12

13
/**
14
 * Common objects which must to be available for all manager objects.
15
 *
16
 * @package MShop
17
 */
18
class Context implements \Aimeos\MShop\ContextIface
19
{
20
        private ?\Aimeos\Base\Cache\Iface $cache = null;
21
        private ?\Aimeos\Base\Config\Iface $config = null;
22
        private ?\Aimeos\Base\DB\Manager\Iface $db = null;
23
        private ?\Aimeos\Base\Filesystem\Manager\Iface $fs = null;
24
        private ?\Aimeos\MShop\Locale\Item\Iface $locale = null;
25
        private ?\Aimeos\Base\Logger\Iface $logger = null;
26
        private ?\Aimeos\Base\Mail\Manager\Iface $mail = null;
27
        private ?\Aimeos\Base\MQueue\Manager\Iface $queue = null;
28
        private ?\Aimeos\Base\Password\Iface $password = null;
29
        private ?\Aimeos\Base\Process\Iface $process = null;
30
        private ?\Aimeos\Base\Session\Iface $session = null;
31
        private ?\Aimeos\Base\View\Iface $view = null;
32
        private ?string $datetime = null;
33
        private ?string $nonce = null;
34
        private ?string $token = null;
35
        private string $editor = '';
36
        private array $i18n = [];
37
        private \Closure|array|null $groups = null;
38
        private \Closure|\Aimeos\MShop\Customer\Item\Iface|null $user = null;
39

40

41
        /**
42
         * Cleans up the stored resources
43
         */
44
        public function __destruct()
45
        {
46
                $this->cache = null;
485✔
47
                $this->config = null;
485✔
48
                $this->db = null;
485✔
49
                $this->fs = null;
485✔
50
                $this->locale = null;
485✔
51
                $this->logger = null;
485✔
52
                $this->mail = null;
485✔
53
                $this->queue = null;
485✔
54
                $this->password = null;
485✔
55
                $this->process = null;
485✔
56
                $this->session = null;
485✔
57
                $this->view = null;
485✔
58
                $this->i18n = [];
485✔
59
        }
60

61

62
        /**
63
         * Clones internal objects of the context item.
64
         */
65
        public function __clone()
66
        {
67
                $this->cache = ( isset( $this->cache ) ? clone $this->cache : null );
1,776✔
68
                $this->config = ( isset( $this->config ) ? clone $this->config : null );
1,776✔
69
                $this->fs = ( isset( $this->fs ) ? clone $this->fs : null );
1,776✔
70
                $this->locale = ( isset( $this->locale ) ? clone $this->locale : null );
1,776✔
71
                $this->logger = ( isset( $this->logger ) ? clone $this->logger : null );
1,776✔
72
                $this->mail = ( isset( $this->mail ) ? clone $this->mail : null );
1,776✔
73
                $this->queue = ( isset( $this->queue ) ? clone $this->queue : null );
1,776✔
74
                $this->password = ( isset( $this->password ) ? clone $this->password : null );
1,776✔
75
                $this->process = ( isset( $this->process ) ? clone $this->process : null );
1,776✔
76
                $this->session = ( isset( $this->session ) ? clone $this->session : null );
1,776✔
77
                // view is always cloned
78

79
                foreach( $this->i18n as $locale => $object ) {
1,776✔
80
                        $this->i18n[$locale] = clone $this->i18n[$locale]; // @phpstan-ignore clone.nonObject
1,776✔
81
                }
82
        }
83

84

85
        /**
86
         * Cleans up internal objects of the context item
87
         *
88
         * @return array List of object property names
89
         */
90
        public function __sleep() : array
91
        {
92
                $objects = array(
×
93
                        $this->cache, $this->config, $this->db, $this->fs, $this->locale, $this->logger,
×
94
                        $this->mail, $this->queue, $this->password, $this->process, $this->session, $this->view
×
95
                );
×
96

97
                foreach( $objects as $object )
×
98
                {
99
                        if( is_object( $object ) && method_exists( $object, '__sleep' ) ) {
×
100
                                $object->__sleep();
×
101
                        }
102
                }
103

104
                return array_keys( get_object_vars( $this ) );
×
105
        }
106

107

108
        /**
109
         * Returns a hash identifying the context object.
110
         *
111
         * @return string Hash for identifying the context object
112
         */
113
        public function __toString() : string
114
        {
115
                $objects = array(
×
116
                        $this, $this->cache, $this->config, $this->db, $this->fs, $this->locale,
×
117
                        $this->logger, $this->mail, $this->queue, $this->password, $this->process,
×
118
                        $this->session, $this->view
×
119
                );
×
120

121
                return md5( $this->hash( $objects ) );
×
122
        }
123

124

125
        /**
126
         * Checks the permissions of the currently logged in user.
127
         *
128
         * @param string|array $groups Group codes to check
129
         * @return bool TRUE if access is allowed, FALSE if not
130
         */
131
        public function access( $groups ) : bool
132
        {
133
                return $this->view ? $this->view->access( $groups ) : true;
1✔
134
        }
135

136

137
        /**
138
         * Sets the cache object.
139
         *
140
         * @param \Aimeos\Base\Cache\Iface $cache Cache object
141
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
142
         */
143
        public function setCache( \Aimeos\Base\Cache\Iface $cache ) : \Aimeos\MShop\ContextIface
144
        {
145
                $this->cache = $cache;
1✔
146

147
                return $this;
1✔
148
        }
149

150

151
        /**
152
         * Returns the cache object.
153
         *
154
         * @return \Aimeos\Base\Cache\Iface Cache object
155
         */
156
        public function cache() : \Aimeos\Base\Cache\Iface
157
        {
158
                if( !isset( $this->cache ) ) {
10✔
159
                        throw new \Aimeos\MShop\Exception( sprintf( 'Cache object not available' ) );
×
160
                }
161

162
                return $this->cache;
10✔
163
        }
164

165

166
        /**
167
         * Sets the configuration object.
168
         *
169
         * @param \Aimeos\Base\Config\Iface $config Configuration object
170
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
171
         */
172
        public function setConfig( \Aimeos\Base\Config\Iface $config ) : \Aimeos\MShop\ContextIface
173
        {
174
                $this->config = $config;
2✔
175

176
                return $this;
2✔
177
        }
178

179

180
        /**
181
         * Returns the configuration object.
182
         *
183
         * @return \Aimeos\Base\Config\Iface Configuration object
184
         */
185
        public function config() : \Aimeos\Base\Config\Iface
186
        {
187
                if( !isset( $this->config ) ) {
1,772✔
188
                        throw new \Aimeos\MShop\Exception( sprintf( 'Configuration object not available' ) );
1✔
189
                }
190

191
                return $this->config;
1,771✔
192
        }
193

194

195
        /**
196
         * Sets the database connection manager object.
197
         *
198
         * @param \Aimeos\Base\DB\Manager\Iface $manager Database manager object
199
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
200
         */
201
        public function setDatabaseManager( \Aimeos\Base\DB\Manager\Iface $manager ) : \Aimeos\MShop\ContextIface
202
        {
203
                $this->db = $manager;
2✔
204

205
                return $this;
2✔
206
        }
207

208

209
        /**
210
         * Returns the database connection object.
211
         *
212
         * @param string $resource Database resource name
213
         * @param bool $new Create a new database connection
214
         * @return \Aimeos\Base\DB\Connection\Iface Database connection object
215
         */
216
        public function db( string $resource = 'db', bool $new = false ) : \Aimeos\Base\DB\Connection\Iface
217
        {
218
                if( !isset( $this->db ) ) {
1,131✔
219
                        throw new \Aimeos\MShop\Exception( sprintf( 'Database manager object not available' ) );
1✔
220
                }
221

222
                return $this->db->get( $resource, $new );
1,130✔
223
        }
224

225

226
        /**
227
         * Sets the current date and time
228
         *
229
         * @param string $datetime Date and time as ISO string (YYYY-MM-DD HH:mm:ss)
230
         */
231
        public function setDateTime( string $datetime ) : \Aimeos\MShop\ContextIface
232
        {
233
                $regex = '/^[0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$/';
1✔
234

235
                if( preg_match( $regex, (string) $datetime ) !== 1 ) {
1✔
236
                        throw new \Aimeos\MShop\Exception( sprintf( 'Invalid characters in date "%1$s". ISO format "YYYY-MM-DD hh:mm:ss" expected.', $datetime ) );
×
237
                }
238

239
                $this->datetime = $datetime;
1✔
240

241
                return $this;
1✔
242
        }
243

244

245
        /**
246
         * Returns the current date and time
247
         * This is especially useful to share the same request time or if applications
248
         * allow to travel in time.
249
         *
250
         * @return string Current date and time as ISO string (YYYY-MM-DD HH:mm:ss)
251
         */
252
        public function datetime() : string
253
        {
254
                if( $this->datetime === null ) {
820✔
255
                        $this->datetime = date( 'Y-m-d H:i:s' );
819✔
256
                }
257

258
                return $this->datetime;
820✔
259
        }
260

261

262
        /**
263
         * Sets the file system manager object.
264
         *
265
         * @param \Aimeos\Base\Filesystem\Manager\Iface $manager File system object
266
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
267
         */
268
        public function setFilesystemManager( \Aimeos\Base\Filesystem\Manager\Iface $manager ) : \Aimeos\MShop\ContextIface
269
        {
270
                $this->fs = $manager;
3✔
271
                return $this;
3✔
272
        }
273

274

275
        /**
276
         * Returns the file system object for the given resource name.
277
         *
278
         * @param string $resource Resource name, e.g. "fs-admin"
279
         * @return \Aimeos\Base\Filesystem\Iface File system object
280
         */
281
        public function fs( string $resource = 'fs' ) : \Aimeos\Base\Filesystem\Iface
282
        {
283
                if( !isset( $this->fs ) ) {
11✔
284
                        throw new \Aimeos\MShop\Exception( sprintf( 'File system manager object not available' ) );
1✔
285
                }
286

287
                return $this->fs->get( $resource );
10✔
288
        }
289

290

291
        /**
292
         * Sets the translation/internationalization objects.
293
         *
294
         * @param array $translations Associative list of internationalization objects implementing
295
         *         \Aimeos\Base\Translation\Iface with locale as key
296
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
297
         */
298
        public function setI18n( array $translations ) : \Aimeos\MShop\ContextIface
299
        {
300
                $this->i18n = $translations;
2✔
301

302
                return $this;
2✔
303
        }
304

305

306
        /**
307
         * Returns the translation/internationalization object for the given locale (null for default one).
308
         *
309
         * @param string|null $locale Two letter language ISO code for specific language instead of default one
310
         * @return \Aimeos\Base\Translation\Iface Internationalization object
311
         */
312
        public function i18n( ?string $locale = null ) : \Aimeos\Base\Translation\Iface
313
        {
314
                if( isset( $this->locale ) && $locale === null ) {
143✔
315
                        $locale = $this->locale()->getLanguageId();
142✔
316
                }
317

318
                if( isset( $this->locale ) && $locale === null && reset( $this->i18n ) !== false ) {
143✔
319
                        $locale = key( $this->i18n );
×
320
                }
321

322
                if( $locale !== null && isset( $this->i18n[$locale] ) ) {
143✔
323
                        // @phpstan-ignore return.type
324
                        return $this->i18n[$locale];
142✔
325
                }
326

327
                if( isset( $this->i18n['en'] ) ) {
1✔
328
                        // @phpstan-ignore return.type
UNCOV
329
                        return $this->i18n['en'];
×
330
                }
331

332
                /// Locale ID %1$s
333
                throw new \Aimeos\MShop\Exception( sprintf( 'Internationalization object not available for "%1$s"', $locale ) );
1✔
334
        }
335

336

337
        /**
338
         * Translates a string if possible
339
         *
340
         * @param string $domain Name of the translation domain
341
         * @param string $singular Singular string to translate
342
         * @param string $plural Plural string to translate if count is not one
343
         * @param int $number Number for plural translations
344
         * @param string|null $locale Locale (e.g. en, en_US, de, etc.) or NULL for current locale
345
         * @return string Translated string if possible
346
         */
347
        public function translate( string $domain, string $singular, ?string $plural = null, int $number = 1, ?string $locale = null ) : string
348
        {
349
                if( empty( $this->i18n ) ) {
141✔
NEW
350
                        return $number === 1 ? $singular : ( $plural ?? '' );
×
351
                }
352

353
                if( $plural ) {
141✔
354
                        return $this->i18n( $locale )->dn( $domain, $singular, $plural, $number );
1✔
355
                }
356

357
                return $this->i18n( $locale )->dt( $domain, $singular );
141✔
358
        }
359

360

361
        /**
362
         * Sets the localization object.
363
         *
364
         * @param \Aimeos\MShop\Locale\Item\Iface $locale Localization object
365
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
366
         */
367
        public function setLocale( \Aimeos\MShop\Locale\Item\Iface $locale ) : \Aimeos\MShop\ContextIface
368
        {
369
                $this->locale = $locale;
3✔
370

371
                return $this;
3✔
372
        }
373

374

375
        /**
376
         * Returns the localization object.
377
         *
378
         * @return \Aimeos\MShop\Locale\Item\Iface Localization object
379
         */
380
        public function locale() : \Aimeos\MShop\Locale\Item\Iface
381
        {
382
                if( !isset( $this->locale ) ) {
1,429✔
383
                        throw new \Aimeos\MShop\Exception( sprintf( 'Locale object not available' ) );
1✔
384
                }
385

386
                return $this->locale;
1,428✔
387
        }
388

389

390
        /**
391
         * Sets the logger object.
392
         *
393
         * @param \Aimeos\Base\Logger\Iface $logger Logger object
394
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
395
         */
396
        public function setLogger( \Aimeos\Base\Logger\Iface $logger ) : \Aimeos\MShop\ContextIface
397
        {
398
                $this->logger = $logger;
4✔
399

400
                return $this;
4✔
401
        }
402

403

404
        /**
405
         * Returns the logger object.
406
         *
407
         * @return \Aimeos\Base\Logger\Iface Logger object
408
         */
409
        public function logger() : \Aimeos\Base\Logger\Iface
410
        {
411
                if( !isset( $this->logger ) ) {
940✔
412
                        throw new \Aimeos\MShop\Exception( sprintf( 'Log manager object not available' ) );
1✔
413
                }
414

415
                return $this->logger;
939✔
416
        }
417

418

419
        /**
420
         * Sets the mail manager object.
421
         *
422
         * @param \Aimeos\Base\Mail\Manager\Iface $mail Mail manager object
423
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
424
         */
425
        public function setMail( \Aimeos\Base\Mail\Manager\Iface $mail ) : \Aimeos\MShop\ContextIface
426
        {
427
                $this->mail = $mail;
2✔
428

429
                return $this;
2✔
430
        }
431

432

433
        /**
434
         * Returns the mail object.
435
         *
436
         * @param string|null $name Name of the mail configuration, NULL for default mailer
437
         * @return \Aimeos\Base\Mail\Iface Mail object
438
         */
439
        public function mail( ?string $name = null ) : \Aimeos\Base\Mail\Iface
440
        {
441
                if( !isset( $this->mail ) ) {
3✔
442
                        throw new \Aimeos\MShop\Exception( sprintf( 'Mail object not available' ) );
1✔
443
                }
444

445
                return $this->mail->get( $name );
2✔
446
        }
447

448

449
        /**
450
         * Sets the message queue manager object.
451
         *
452
         * @param \Aimeos\Base\MQueue\Manager\Iface $mqManager Message queue manager object
453
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
454
         */
455
        public function setMessageQueueManager( \Aimeos\Base\MQueue\Manager\Iface $mqManager ) : \Aimeos\MShop\ContextIface
456
        {
457
                $this->queue = $mqManager;
2✔
458

459
                return $this;
2✔
460
        }
461

462

463
        /**
464
         * Returns the message queue object.
465
         *
466
         * @param string $resource Resource name, e.g. "mq-email"
467
         * @param string $queue Message queue name, e.g. "order/email/payment"
468
         * @return \Aimeos\Base\MQueue\Queue\Iface Message queue object
469
         */
470
        public function queue( string $resource, string $queue ) : \Aimeos\Base\MQueue\Queue\Iface
471
        {
472
                if( !isset( $this->queue ) ) {
2✔
473
                        throw new \Aimeos\MShop\Exception( sprintf( 'Message queue object not available' ) );
1✔
474
                }
475

476
                return $this->queue->get( $resource )->getQueue( $queue );
1✔
477
        }
478

479

480
        /**
481
         * Returns the nonce value for inline Javascript
482
         *
483
         * @return string|null Nonce value
484
         */
485
        public function nonce() : ?string
486
        {
487
                return $this->nonce;
1✔
488
        }
489

490

491
        /**
492
         * Sets the nonce value for inline Javascript
493
         *
494
         * @param string $value Nonce value
495
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
496
         */
497
        public function setNonce( ?string $value ) : \Aimeos\MShop\ContextIface
498
        {
499
                $this->nonce = $value;
1✔
500
                return $this;
1✔
501
        }
502

503

504
        /**
505
         * Returns the password adapter object.
506
         *
507
         * @return \Aimeos\Base\Password\Iface Password adapter
508
         */
509
        public function password() : \Aimeos\Base\Password\Iface
510
        {
511
                if( !isset( $this->password ) ) {
40✔
512
                        throw new \Aimeos\MShop\Exception( sprintf( 'Password object not available' ) );
1✔
513
                }
514

515
                return $this->password;
39✔
516
        }
517

518

519
        /**
520
         * Sets the password adapter object.
521
         *
522
         * @param \Aimeos\Base\Password\Iface $password Password adapter
523
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
524
         */
525
        public function setPassword( \Aimeos\Base\Password\Iface $password ) : \Aimeos\MShop\ContextIface
526
        {
527
                $this->password = $password;
2✔
528
                return $this;
2✔
529
        }
530

531

532
        /**
533
         * Sets the process object.
534
         *
535
         * @param \Aimeos\Base\Process\Iface $process Process object
536
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
537
         */
538
        public function setProcess( \Aimeos\Base\Process\Iface $process ) : \Aimeos\MShop\ContextIface
539
        {
540
                $this->process = $process;
1✔
541

542
                return $this;
1✔
543
        }
544

545

546
        /**
547
         * Returns the process object.
548
         *
549
         * @return \Aimeos\Base\Process\Iface Process object
550
         */
551
        public function process() : \Aimeos\Base\Process\Iface
552
        {
553
                if( !isset( $this->process ) ) {
2✔
554
                        throw new \Aimeos\MShop\Exception( sprintf( 'Process object not available' ) );
1✔
555
                }
556

557
                return $this->process;
1✔
558
        }
559

560

561
        /**
562
         * Sets the session object.
563
         *
564
         * @param \Aimeos\Base\Session\Iface $session Session object
565
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
566
         */
567
        public function setSession( \Aimeos\Base\Session\Iface $session ) : \Aimeos\MShop\ContextIface
568
        {
569
                $this->session = $session;
2✔
570

571
                return $this;
2✔
572
        }
573

574

575
        /**
576
         * Returns the session object.
577
         *
578
         * @return \Aimeos\Base\Session\Iface Session object
579
         */
580
        public function session() : \Aimeos\Base\Session\Iface
581
        {
582
                if( !isset( $this->session ) ) {
3✔
583
                        throw new \Aimeos\MShop\Exception( sprintf( 'Session object not available' ) );
1✔
584
                }
585

586
                return $this->session;
2✔
587
        }
588

589
        /**
590
         * Returns the session token.
591
         *
592
         * @return string|null Session token
593
         */
594
        public function token() : ?string
595
        {
596
                return $this->token;
3✔
597
        }
598

599

600
        /**
601
         * Sets the ion token.
602
         *
603
         * @param string $token Session token
604
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
605
         */
606
        public function setToken( string $token ) : \Aimeos\MShop\ContextIface
607
        {
608
                $this->token = $token;
1✔
609
                return $this;
1✔
610
        }
611

612

613
        /**
614
         * Sets the view object.
615
         *
616
         * @param \Aimeos\Base\View\Iface $view View object
617
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
618
         */
619
        public function setView( \Aimeos\Base\View\Iface $view ) : \Aimeos\MShop\ContextIface
620
        {
621
                $this->view = $view;
2✔
622

623
                return $this;
2✔
624
        }
625

626

627
        /**
628
         * Returns the view object.
629
         *
630
         * @return \Aimeos\Base\View\Iface View object
631
         */
632
        public function view() : \Aimeos\Base\View\Iface
633
        {
634
                if( !isset( $this->view ) ) {
4✔
635
                        throw new \Aimeos\MShop\Exception( sprintf( 'View object not available' ) );
1✔
636
                }
637

638
                return clone $this->view;
3✔
639
        }
640

641

642
        /**
643
         * Sets the account name of the user/editor.
644
         *
645
         * @param string $name Account name of the user/editor
646
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
647
         */
648
        public function setEditor( string $name ) : \Aimeos\MShop\ContextIface
649
        {
650
                $this->editor = $name;
2✔
651

652
                return $this;
2✔
653
        }
654

655

656
        /**
657
         * Returns the account name of the user/editor.
658
         *
659
         * @return string Account name of the user/editor
660
         */
661
        public function editor() : string
662
        {
663
                return $this->editor;
574✔
664
        }
665

666

667
        /**
668
         * Returns the user/customer item of the logged in user.
669
         *
670
         * @return \Aimeos\MShop\Customer\Item\Iface|null User/customer item of the logged in user
671
         */
672
        public function user() : ?\Aimeos\MShop\Customer\Item\Iface
673
        {
674
                if( $this->user instanceof \Closure )
26✔
675
                {
676
                        $fcn = $this->user;
1✔
677
                        $this->user = $fcn();
1✔
678
                }
679

680
                return $this->user; // @phpstan-ignore return.type
26✔
681
        }
682

683

684
        /**
685
         * Sets the user/customer item of the logged in user.
686
         *
687
         * @param \Closure|null $user User/customer item of the logged in user or closure to retrieve them
688
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
689
         */
690
        public function setUser( $user ) : \Aimeos\MShop\ContextIface
691
        {
692
                $this->user = $user;
16✔
693

694
                return $this;
16✔
695
        }
696

697

698
        /**
699
         * Returns the group ID/code pairs of the logged in user.
700
         *
701
         * @return array Group ID/item pairs of the logged in user
702
         */
703
        public function groups() : array
704
        {
705
                if( $this->groups instanceof \Closure )
1✔
706
                {
707
                        $fcn = $this->groups;
1✔
708
                        $this->groups = $fcn();
1✔
709
                }
710

711
                return (array) $this->groups;
1✔
712
        }
713

714

715
        /**
716
         * Sets the group IDs of the logged in user.
717
         *
718
         * @param \Closure|array $groups Group ID/item pairs of the logged in user or closure to retrieve them
719
         * @return \Aimeos\MShop\ContextIface Context item for chaining method calls
720
         */
721
        public function setGroups( $groups ) : \Aimeos\MShop\ContextIface
722
        {
723
                $this->groups = $groups;
1✔
724

725
                return $this;
1✔
726
        }
727

728

729
        /**
730
         * Returns a hash for the given objects
731
         *
732
         * @param array $list List of objects
733
         * @return string Hash for the objects
734
         */
735
        private function hash( array $list ) : string
736
        {
737
                $hash = '';
×
738

739
                foreach( $list as $item )
×
740
                {
741
                        if( is_object( $item ) ) {
×
742
                                $hash .= spl_object_hash( $item );
×
743
                        }
744
                }
745

746
                return $hash;
×
747
        }
748
}
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